优化表结构
This commit is contained in:
@@ -224,15 +224,15 @@ public class AccountService {
|
||||
Date eTime = StringUtil.getDateByString(timeStr + "-31 00:00:00", null);
|
||||
Date mTime = StringUtil.getDateByString(timeStr + "-01 00:00:00", null);
|
||||
if (type.equals("month")) {
|
||||
example.createCriteria().andAccountidEqualTo(id).andPaytypeNotEqualTo("预付款")
|
||||
.andOpertimeGreaterThanOrEqualTo(bTime).andOpertimeLessThanOrEqualTo(eTime)
|
||||
example.createCriteria().andAccountIdEqualTo(id).andPayTypeNotEqualTo("预付款")
|
||||
.andOperTimeGreaterThanOrEqualTo(bTime).andOperTimeLessThanOrEqualTo(eTime)
|
||||
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
} else if (type.equals("date")) {
|
||||
example.createCriteria().andAccountidEqualTo(id).andPaytypeNotEqualTo("预付款")
|
||||
.andOpertimeLessThanOrEqualTo(mTime).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
example.createCriteria().andAccountIdEqualTo(id).andPayTypeNotEqualTo("预付款")
|
||||
.andOperTimeLessThanOrEqualTo(mTime).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
}
|
||||
} else {
|
||||
example.createCriteria().andAccountidEqualTo(id).andPaytypeNotEqualTo("预付款")
|
||||
example.createCriteria().andAccountIdEqualTo(id).andPayTypeNotEqualTo("预付款")
|
||||
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
}
|
||||
List<DepotHead> dataList=null;
|
||||
@@ -243,8 +243,8 @@ public class AccountService {
|
||||
}
|
||||
if (dataList != null) {
|
||||
for (DepotHead depotHead : dataList) {
|
||||
if(depotHead.getChangeamount()!=null) {
|
||||
accountSum = accountSum .add(depotHead.getChangeamount()) ;
|
||||
if(depotHead.getChangeAmount()!=null) {
|
||||
accountSum = accountSum .add(depotHead.getChangeAmount()) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -269,16 +269,16 @@ public class AccountService {
|
||||
Date eTime = StringUtil.getDateByString(timeStr + "-31 00:00:00", null);
|
||||
Date mTime = StringUtil.getDateByString(timeStr + "-01 00:00:00", null);
|
||||
if (type.equals("month")) {
|
||||
example.createCriteria().andAccountidEqualTo(id)
|
||||
.andBilltimeGreaterThanOrEqualTo(bTime).andBilltimeLessThanOrEqualTo(eTime)
|
||||
example.createCriteria().andAccountIdEqualTo(id)
|
||||
.andBillTimeGreaterThanOrEqualTo(bTime).andBillTimeLessThanOrEqualTo(eTime)
|
||||
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
} else if (type.equals("date")) {
|
||||
example.createCriteria().andAccountidEqualTo(id)
|
||||
.andBilltimeLessThanOrEqualTo(mTime)
|
||||
example.createCriteria().andAccountIdEqualTo(id)
|
||||
.andBillTimeLessThanOrEqualTo(mTime)
|
||||
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
}
|
||||
} else {
|
||||
example.createCriteria().andAccountidEqualTo(id)
|
||||
example.createCriteria().andAccountIdEqualTo(id)
|
||||
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
}
|
||||
List<AccountHead> dataList=null;
|
||||
@@ -289,8 +289,8 @@ public class AccountService {
|
||||
}
|
||||
if (dataList != null) {
|
||||
for (AccountHead accountHead : dataList) {
|
||||
if(accountHead.getChangeamount()!=null) {
|
||||
accountSum = accountSum.add(accountHead.getChangeamount());
|
||||
if(accountHead.getChangeAmount()!=null) {
|
||||
accountSum = accountSum.add(accountHead.getChangeAmount());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -315,10 +315,10 @@ public class AccountService {
|
||||
Date eTime = StringUtil.getDateByString(timeStr + "-31 00:00:00", null);
|
||||
Date mTime = StringUtil.getDateByString(timeStr + "-01 00:00:00", null);
|
||||
if (type.equals("month")) {
|
||||
example.createCriteria().andBilltimeGreaterThanOrEqualTo(bTime).andBilltimeLessThanOrEqualTo(eTime)
|
||||
example.createCriteria().andBillTimeGreaterThanOrEqualTo(bTime).andBillTimeLessThanOrEqualTo(eTime)
|
||||
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
} else if (type.equals("date")) {
|
||||
example.createCriteria().andBilltimeLessThanOrEqualTo(mTime)
|
||||
example.createCriteria().andBillTimeLessThanOrEqualTo(mTime)
|
||||
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
}
|
||||
}
|
||||
@@ -339,13 +339,13 @@ public class AccountService {
|
||||
AccountItemExample exampleAi = new AccountItemExample();
|
||||
if (!ids.equals("")) {
|
||||
List<Long> idList = StringUtil.strToLongList(ids);
|
||||
exampleAi.createCriteria().andAccountidEqualTo(id).andHeaderidIn(idList)
|
||||
exampleAi.createCriteria().andAccountIdEqualTo(id).andHeaderIdIn(idList)
|
||||
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
List<AccountItem> dataListOne = accountItemMapper.selectByExample(exampleAi);
|
||||
if (dataListOne != null) {
|
||||
for (AccountItem accountItem : dataListOne) {
|
||||
if(accountItem.getEachamount()!=null) {
|
||||
accountSum = accountSum.add(accountItem.getEachamount());
|
||||
if(accountItem.getEachAmount()!=null) {
|
||||
accountSum = accountSum.add(accountItem.getEachAmount());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -374,16 +374,16 @@ public class AccountService {
|
||||
Date eTime = StringUtil.getDateByString(timeStr + "-31 00:00:00", null);
|
||||
Date mTime = StringUtil.getDateByString(timeStr + "-01 00:00:00", null);
|
||||
if (type.equals("month")) {
|
||||
example.createCriteria().andAccountidlistLike("%" +id.toString() + "%")
|
||||
.andOpertimeGreaterThanOrEqualTo(bTime).andOpertimeLessThanOrEqualTo(eTime)
|
||||
example.createCriteria().andAccountIdListLike("%" +id.toString() + "%")
|
||||
.andOperTimeGreaterThanOrEqualTo(bTime).andOperTimeLessThanOrEqualTo(eTime)
|
||||
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
} else if (type.equals("date")) {
|
||||
example.createCriteria().andAccountidlistLike("%" +id.toString() + "%")
|
||||
.andOpertimeLessThanOrEqualTo(mTime)
|
||||
example.createCriteria().andAccountIdListLike("%" +id.toString() + "%")
|
||||
.andOperTimeLessThanOrEqualTo(mTime)
|
||||
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
}
|
||||
} else {
|
||||
example.createCriteria().andAccountidlistLike("%" +id.toString() + "%")
|
||||
example.createCriteria().andAccountIdListLike("%" +id.toString() + "%")
|
||||
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
}
|
||||
List<DepotHead> dataList=null;
|
||||
@@ -394,8 +394,8 @@ public class AccountService {
|
||||
}
|
||||
if (dataList != null) {
|
||||
for (DepotHead depotHead : dataList) {
|
||||
String accountIdList = depotHead.getAccountidlist();
|
||||
String accountMoneyList = depotHead.getAccountmoneylist();
|
||||
String accountIdList = depotHead.getAccountIdList();
|
||||
String accountMoneyList = depotHead.getAccountMoneyList();
|
||||
if(StringUtil.isNotEmpty(accountIdList) && StringUtil.isNotEmpty(accountMoneyList)) {
|
||||
accountIdList = accountIdList.replace("[", "").replace("]", "").replace("\"", "");
|
||||
accountMoneyList = accountMoneyList.replace("[", "").replace("]", "").replace("\"", "");
|
||||
@@ -488,7 +488,7 @@ public class AccountService {
|
||||
* 校验:
|
||||
* 1、财务主表 jsh_accounthead
|
||||
* 2、财务子表 jsh_accountitem
|
||||
* 3、单据主表 jsh_depothead
|
||||
* 3、单据主表 jsh_depot_head
|
||||
* 是否有相关数据
|
||||
* */
|
||||
int deleteTotal=0;
|
||||
@@ -527,7 +527,7 @@ public class AccountService {
|
||||
ExceptionConstants.DELETE_FORCE_CONFIRM_MSG);
|
||||
}
|
||||
/**
|
||||
* 校验单据主表 jsh_depothead
|
||||
* 校验单据主表 jsh_depot_head
|
||||
* */
|
||||
List<DepotHead> depotHeadList =null;
|
||||
try{
|
||||
|
||||
@@ -89,13 +89,13 @@ public class AccountHeadService {
|
||||
}
|
||||
if (null != list) {
|
||||
for (AccountHeadVo4ListEx ah : list) {
|
||||
if(ah.getChangeamount() != null) {
|
||||
ah.setChangeamount(ah.getChangeamount().abs());
|
||||
if(ah.getChangeAmount() != null) {
|
||||
ah.setChangeAmount(ah.getChangeAmount().abs());
|
||||
}
|
||||
if(ah.getTotalprice() != null) {
|
||||
ah.setTotalprice(ah.getTotalprice().abs());
|
||||
if(ah.getTotalPrice() != null) {
|
||||
ah.setTotalPrice(ah.getTotalPrice().abs());
|
||||
}
|
||||
ah.setBillTimeStr(getCenternTime(ah.getBilltime()));
|
||||
ah.setBillTimeStr(getCenternTime(ah.getBillTime()));
|
||||
resList.add(ah);
|
||||
}
|
||||
}
|
||||
@@ -119,7 +119,7 @@ public class AccountHeadService {
|
||||
try{
|
||||
result = accountHeadMapper.insertSelective(accountHead);
|
||||
logService.insertLog("财务",
|
||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_ADD).append(accountHead.getBillno()).toString(), request);
|
||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_ADD).append(accountHead.getBillNo()).toString(), request);
|
||||
}catch(Exception e){
|
||||
JshException.writeFail(logger, e);
|
||||
}
|
||||
@@ -134,7 +134,7 @@ public class AccountHeadService {
|
||||
try{
|
||||
result = accountHeadMapper.updateByPrimaryKeySelective(accountHead);
|
||||
logService.insertLog("财务",
|
||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(accountHead.getBillno()).toString(), request);
|
||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(accountHead.getBillNo()).toString(), request);
|
||||
}catch(Exception e){
|
||||
JshException.writeFail(logger, e);
|
||||
}
|
||||
@@ -148,7 +148,7 @@ public class AccountHeadService {
|
||||
AccountHead accountHead = accountHeadMapper.selectByPrimaryKey(id);
|
||||
result = accountHeadMapper.deleteByPrimaryKey(id);
|
||||
logService.insertLog("财务",
|
||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(accountHead.getBillno()).toString(), request);
|
||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(accountHead.getBillNo()).toString(), request);
|
||||
}catch(Exception e){
|
||||
JshException.writeFail(logger, e);
|
||||
}
|
||||
@@ -195,9 +195,9 @@ public class AccountHeadService {
|
||||
public BigDecimal findAllMoney(Integer supplierId, String type, String mode, String endTime) {
|
||||
String modeName = "";
|
||||
if (mode.equals("实际")) {
|
||||
modeName = "ChangeAmount";
|
||||
modeName = "change_amount";
|
||||
} else if (mode.equals("合计")) {
|
||||
modeName = "TotalPrice";
|
||||
modeName = "total_price";
|
||||
}
|
||||
BigDecimal result = null;
|
||||
try{
|
||||
@@ -268,11 +268,11 @@ public class AccountHeadService {
|
||||
}
|
||||
if (null != list) {
|
||||
for (AccountHeadVo4ListEx ah : list) {
|
||||
if(ah.getChangeamount() != null) {
|
||||
ah.setChangeamount(ah.getChangeamount().abs());
|
||||
if(ah.getChangeAmount() != null) {
|
||||
ah.setChangeAmount(ah.getChangeAmount().abs());
|
||||
}
|
||||
if(ah.getTotalprice() != null) {
|
||||
ah.setTotalprice(ah.getTotalprice().abs());
|
||||
if(ah.getTotalPrice() != null) {
|
||||
ah.setTotalPrice(ah.getTotalPrice().abs());
|
||||
}
|
||||
resList.add(ah);
|
||||
}
|
||||
@@ -285,7 +285,7 @@ public class AccountHeadService {
|
||||
sb.append(BusinessConstants.LOG_OPERATION_TYPE_DELETE);
|
||||
List<AccountHead> list = getAccountHeadListByIds(ids);
|
||||
for(AccountHead accountHead: list){
|
||||
sb.append("[").append(accountHead.getBillno()).append("]");
|
||||
sb.append("[").append(accountHead.getBillNo()).append("]");
|
||||
}
|
||||
logService.insertLog("财务", sb.toString(),
|
||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||
|
||||
@@ -201,21 +201,21 @@ public class AccountItemService {
|
||||
for (int i = 0; i < insertedJson.size(); i++) {
|
||||
AccountItem accountItem = new AccountItem();
|
||||
JSONObject tempInsertedJson = JSONObject.parseObject(insertedJson.getString(i));
|
||||
accountItem.setHeaderid(headerId);
|
||||
accountItem.setHeaderId(headerId);
|
||||
if (tempInsertedJson.get("AccountId") != null && !tempInsertedJson.get("AccountId").equals("")) {
|
||||
accountItem.setAccountid(tempInsertedJson.getLong("AccountId"));
|
||||
accountItem.setAccountId(tempInsertedJson.getLong("AccountId"));
|
||||
}
|
||||
if (tempInsertedJson.get("InOutItemId") != null && !tempInsertedJson.get("InOutItemId").equals("")) {
|
||||
accountItem.setInoutitemid(tempInsertedJson.getLong("InOutItemId"));
|
||||
accountItem.setInOutItemId(tempInsertedJson.getLong("InOutItemId"));
|
||||
}
|
||||
if (tempInsertedJson.get("EachAmount") != null && !tempInsertedJson.get("EachAmount").equals("")) {
|
||||
BigDecimal eachAmount = tempInsertedJson.getBigDecimal("EachAmount");
|
||||
if (listType.equals("付款")) {
|
||||
eachAmount = BigDecimal.ZERO.subtract(eachAmount);
|
||||
}
|
||||
accountItem.setEachamount(eachAmount);
|
||||
accountItem.setEachAmount(eachAmount);
|
||||
} else {
|
||||
accountItem.setEachamount(BigDecimal.ZERO);
|
||||
accountItem.setEachAmount(BigDecimal.ZERO);
|
||||
}
|
||||
accountItem.setRemark(tempInsertedJson.getString("Remark"));
|
||||
this.insertAccountItemWithObj(accountItem);
|
||||
@@ -238,21 +238,21 @@ public class AccountItemService {
|
||||
JSONObject tempUpdatedJson = JSONObject.parseObject(updatedJson.getString(i));
|
||||
AccountItem accountItem = this.getAccountItem(tempUpdatedJson.getLong("Id"));
|
||||
accountItem.setId(tempUpdatedJson.getLong("Id"));
|
||||
accountItem.setHeaderid(headerId);
|
||||
accountItem.setHeaderId(headerId);
|
||||
if (tempUpdatedJson.get("AccountId") != null && !tempUpdatedJson.get("AccountId").equals("")) {
|
||||
accountItem.setAccountid(tempUpdatedJson.getLong("AccountId"));
|
||||
accountItem.setAccountId(tempUpdatedJson.getLong("AccountId"));
|
||||
}
|
||||
if (tempUpdatedJson.get("InOutItemId") != null && !tempUpdatedJson.get("InOutItemId").equals("")) {
|
||||
accountItem.setInoutitemid(tempUpdatedJson.getLong("InOutItemId"));
|
||||
accountItem.setInOutItemId(tempUpdatedJson.getLong("InOutItemId"));
|
||||
}
|
||||
if (tempUpdatedJson.get("EachAmount") != null && !tempUpdatedJson.get("EachAmount").equals("")) {
|
||||
BigDecimal eachAmount = tempUpdatedJson.getBigDecimal("EachAmount");
|
||||
if (listType.equals("付款")) {
|
||||
eachAmount = BigDecimal.ZERO.subtract(eachAmount);
|
||||
}
|
||||
accountItem.setEachamount(eachAmount);
|
||||
accountItem.setEachAmount(eachAmount);
|
||||
} else {
|
||||
accountItem.setEachamount(BigDecimal.ZERO);
|
||||
accountItem.setEachAmount(BigDecimal.ZERO);
|
||||
}
|
||||
accountItem.setRemark(tempUpdatedJson.getString("Remark"));
|
||||
this.updateAccountItemWithObj(accountItem);
|
||||
|
||||
@@ -240,8 +240,8 @@ public class DepotService {
|
||||
public int batchDeleteDepotByIdsNormal(String ids) throws Exception {
|
||||
/**
|
||||
* 校验
|
||||
* 1、单据主表 jsh_depothead
|
||||
* 2、单据子表 jsh_depotitem
|
||||
* 1、单据主表 jsh_depot_head
|
||||
* 2、单据子表 jsh_depot_item
|
||||
* 是否有相关数据
|
||||
* */
|
||||
int deleteTotal=0;
|
||||
@@ -251,7 +251,7 @@ public class DepotService {
|
||||
String [] idArray=ids.split(",");
|
||||
|
||||
/**
|
||||
* 校验单据子表 jsh_depotitem
|
||||
* 校验单据子表 jsh_depot_item
|
||||
* */
|
||||
List<DepotItem> depotItemList=null;
|
||||
try{
|
||||
|
||||
@@ -90,26 +90,26 @@ public class DepotHeadService {
|
||||
}
|
||||
if (null != list) {
|
||||
for (DepotHeadVo4List dh : list) {
|
||||
if(dh.getAccountidlist() != null) {
|
||||
String accountidlistStr = dh.getAccountidlist().replace("[", "").replace("]", "").replaceAll("\"", "");
|
||||
dh.setAccountidlist(accountidlistStr);
|
||||
if(dh.getAccountIdList() != null) {
|
||||
String accountidlistStr = dh.getAccountIdList().replace("[", "").replace("]", "").replaceAll("\"", "");
|
||||
dh.setAccountIdList(accountidlistStr);
|
||||
}
|
||||
if(dh.getAccountmoneylist() != null) {
|
||||
String accountmoneylistStr = dh.getAccountmoneylist().replace("[", "").replace("]", "").replaceAll("\"", "");
|
||||
dh.setAccountmoneylist(accountmoneylistStr);
|
||||
if(dh.getAccountMoneyList() != null) {
|
||||
String accountmoneylistStr = dh.getAccountMoneyList().replace("[", "").replace("]", "").replaceAll("\"", "");
|
||||
dh.setAccountMoneyList(accountmoneylistStr);
|
||||
}
|
||||
if(dh.getOthermoneylist() != null) {
|
||||
String otherMoneyListStr = dh.getOthermoneylist().replace("[", "").replace("]", "").replaceAll("\"", "");
|
||||
dh.setOthermoneylist(otherMoneyListStr);
|
||||
if(dh.getOtherMoneyList() != null) {
|
||||
String otherMoneyListStr = dh.getOtherMoneyList().replace("[", "").replace("]", "").replaceAll("\"", "");
|
||||
dh.setOtherMoneyList(otherMoneyListStr);
|
||||
}
|
||||
if(dh.getChangeamount() != null) {
|
||||
dh.setChangeamount(dh.getChangeamount().abs());
|
||||
if(dh.getChangeAmount() != null) {
|
||||
dh.setChangeAmount(dh.getChangeAmount().abs());
|
||||
}
|
||||
if(dh.getTotalprice() != null) {
|
||||
dh.setTotalprice(dh.getTotalprice().abs());
|
||||
if(dh.getTotalPrice() != null) {
|
||||
dh.setTotalPrice(dh.getTotalPrice().abs());
|
||||
}
|
||||
if(dh.getOpertime() != null) {
|
||||
dh.setOpertimeStr(getCenternTime(dh.getOpertime()));
|
||||
if(dh.getOperTime() != null) {
|
||||
dh.setOperTimeStr(getCenternTime(dh.getOperTime()));
|
||||
}
|
||||
dh.setMaterialsList(findMaterialsListByHeaderId(dh.getId()));
|
||||
resList.add(dh);
|
||||
@@ -139,9 +139,9 @@ public class DepotHeadService {
|
||||
if (userInfo != null) {
|
||||
User sessionUser = (User) userInfo;
|
||||
String uName = sessionUser.getUsername();
|
||||
depotHead.setOperpersonname(uName);
|
||||
depotHead.setOperPersonName(uName);
|
||||
}
|
||||
depotHead.setCreatetime(new Timestamp(System.currentTimeMillis()));
|
||||
depotHead.setCreateTime(new Timestamp(System.currentTimeMillis()));
|
||||
depotHead.setStatus(BusinessConstants.BILLS_STATUS_UN_AUDIT);
|
||||
int result=0;
|
||||
try{
|
||||
@@ -164,8 +164,8 @@ public class DepotHeadService {
|
||||
DepotHead depotHead = JSONObject.parseObject(beanJson, DepotHead.class);
|
||||
depotHead.setId(id);
|
||||
depotHead.setStatus(dh.getStatus());
|
||||
depotHead.setCreatetime(dh.getCreatetime());
|
||||
depotHead.setOperpersonname(dh.getOperpersonname());
|
||||
depotHead.setCreateTime(dh.getCreateTime());
|
||||
depotHead.setOperPersonName(dh.getOperPersonName());
|
||||
int result=0;
|
||||
try{
|
||||
result = depotHeadMapper.updateByPrimaryKey(depotHead);
|
||||
@@ -342,9 +342,9 @@ public class DepotHeadService {
|
||||
String modeName = "";
|
||||
BigDecimal allOtherMoney = BigDecimal.ZERO;
|
||||
if (mode.equals("实际")) {
|
||||
modeName = "ChangeAmount";
|
||||
modeName = "change_amount";
|
||||
} else if (mode.equals("合计")) {
|
||||
modeName = "DiscountLastMoney";
|
||||
modeName = "discount_last_money";
|
||||
allOtherMoney = depotHeadMapperEx.findAllOtherMoney(supplierId, type, subType, endTime);
|
||||
}
|
||||
BigDecimal result = BigDecimal.ZERO;
|
||||
@@ -419,29 +419,29 @@ public class DepotHeadService {
|
||||
}
|
||||
if (null != list) {
|
||||
for (DepotHeadVo4List dh : list) {
|
||||
if(dh.getAccountidlist() != null) {
|
||||
String accountidlistStr = dh.getAccountidlist().replace("[", "").replace("]", "").replaceAll("\"", "");
|
||||
dh.setAccountidlist(accountidlistStr);
|
||||
if(dh.getAccountIdList() != null) {
|
||||
String accountidlistStr = dh.getAccountIdList().replace("[", "").replace("]", "").replaceAll("\"", "");
|
||||
dh.setAccountIdList(accountidlistStr);
|
||||
}
|
||||
if(dh.getAccountmoneylist() != null) {
|
||||
String accountmoneylistStr = dh.getAccountmoneylist().replace("[", "").replace("]", "").replaceAll("\"", "");
|
||||
dh.setAccountmoneylist(accountmoneylistStr);
|
||||
if(dh.getAccountMoneyList() != null) {
|
||||
String accountmoneylistStr = dh.getAccountMoneyList().replace("[", "").replace("]", "").replaceAll("\"", "");
|
||||
dh.setAccountMoneyList(accountmoneylistStr);
|
||||
}
|
||||
if(dh.getOthermoneylist() != null) {
|
||||
String otherMoneyListStr = dh.getOthermoneylist().replace("[", "").replace("]", "").replaceAll("\"", "");
|
||||
dh.setOthermoneylist(otherMoneyListStr);
|
||||
if(dh.getOtherMoneyList() != null) {
|
||||
String otherMoneyListStr = dh.getOtherMoneyList().replace("[", "").replace("]", "").replaceAll("\"", "");
|
||||
dh.setOtherMoneyList(otherMoneyListStr);
|
||||
}
|
||||
if(dh.getOthermoneyitem() != null) {
|
||||
String otherMoneyItemStr = dh.getOthermoneyitem().replace("[", "").replace("]", "").replaceAll("\"", "");
|
||||
dh.setOthermoneyitem(otherMoneyItemStr);
|
||||
if(dh.getOtherMoneyItem() != null) {
|
||||
String otherMoneyItemStr = dh.getOtherMoneyItem().replace("[", "").replace("]", "").replaceAll("\"", "");
|
||||
dh.setOtherMoneyItem(otherMoneyItemStr);
|
||||
}
|
||||
if(dh.getChangeamount() != null) {
|
||||
dh.setChangeamount(dh.getChangeamount().abs());
|
||||
if(dh.getChangeAmount() != null) {
|
||||
dh.setChangeAmount(dh.getChangeAmount().abs());
|
||||
}
|
||||
if(dh.getTotalprice() != null) {
|
||||
dh.setTotalprice(dh.getTotalprice().abs());
|
||||
if(dh.getTotalPrice() != null) {
|
||||
dh.setTotalPrice(dh.getTotalPrice().abs());
|
||||
}
|
||||
dh.setOpertimeStr(getCenternTime(dh.getOpertime()));
|
||||
dh.setOperTimeStr(getCenternTime(dh.getOperTime()));
|
||||
dh.setMaterialsList(findMaterialsListByHeaderId(dh.getId()));
|
||||
resList.add(dh);
|
||||
}
|
||||
@@ -466,9 +466,9 @@ public class DepotHeadService {
|
||||
DepotHead depotHead = JSONObject.parseObject(beanJson, DepotHead.class);
|
||||
//判断用户是否已经登录过,登录过不再处理
|
||||
User userInfo=userService.getCurrentUser();
|
||||
depotHead.setHandspersonid(userInfo==null?null:userInfo.getId());
|
||||
depotHead.setOperpersonname(userInfo==null?null:userInfo.getUsername());
|
||||
depotHead.setCreatetime(new Timestamp(System.currentTimeMillis()));
|
||||
depotHead.setHandsPersonId(userInfo==null?null:userInfo.getId());
|
||||
depotHead.setOperPersonName(userInfo==null?null:userInfo.getUsername());
|
||||
depotHead.setCreateTime(new Timestamp(System.currentTimeMillis()));
|
||||
depotHead.setStatus(BusinessConstants.BILLS_STATUS_UN_AUDIT);
|
||||
try{
|
||||
depotHeadMapper.insertSelective(depotHead);
|
||||
@@ -476,14 +476,14 @@ public class DepotHeadService {
|
||||
JshException.writeFail(logger, e);
|
||||
}
|
||||
/**入库和出库处理预付款信息*/
|
||||
if(BusinessConstants.PAY_TYPE_PREPAID.equals(depotHead.getPaytype())){
|
||||
if(depotHead.getOrganid()!=null) {
|
||||
supplierService.updateAdvanceIn(depotHead.getOrganid(), BigDecimal.ZERO.subtract(depotHead.getTotalprice()));
|
||||
if(BusinessConstants.PAY_TYPE_PREPAID.equals(depotHead.getPayType())){
|
||||
if(depotHead.getOrganId()!=null) {
|
||||
supplierService.updateAdvanceIn(depotHead.getOrganId(), BigDecimal.ZERO.subtract(depotHead.getTotalPrice()));
|
||||
}
|
||||
}
|
||||
//根据单据编号查询单据id
|
||||
DepotHeadExample dhExample = new DepotHeadExample();
|
||||
dhExample.createCriteria().andDefaultnumberEqualTo(depotHead.getDefaultnumber()).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
dhExample.createCriteria().andDefaultNumberEqualTo(depotHead.getDefaultNumber()).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
List<DepotHead> list = depotHeadMapper.selectByExample(dhExample);
|
||||
if(list!=null) {
|
||||
Long headId = list.get(0).getId();
|
||||
@@ -491,11 +491,11 @@ public class DepotHeadService {
|
||||
depotItemService.saveDetials(inserted,deleted,updated,headId,tenantId, request);
|
||||
}
|
||||
/**如果关联单据号非空则更新订单的状态为2 */
|
||||
if(depotHead.getLinknumber()!=null) {
|
||||
if(depotHead.getLinkNumber()!=null) {
|
||||
DepotHead depotHeadOrders = new DepotHead();
|
||||
depotHeadOrders.setStatus(BusinessConstants.BILLS_STATUS_SKIP);
|
||||
DepotHeadExample example = new DepotHeadExample();
|
||||
example.createCriteria().andNumberEqualTo(depotHead.getLinknumber());
|
||||
example.createCriteria().andNumberEqualTo(depotHead.getLinkNumber());
|
||||
try{
|
||||
depotHeadMapper.updateByExampleSelective(depotHeadOrders, example);
|
||||
}catch(Exception e){
|
||||
@@ -527,16 +527,16 @@ public class DepotHeadService {
|
||||
//判断用户是否已经登录过,登录过不再处理
|
||||
depotHead.setId(id);
|
||||
User userInfo=userService.getCurrentUser();
|
||||
depotHead.setOperpersonname(userInfo==null?null:userInfo.getUsername());
|
||||
depotHead.setOperPersonName(userInfo==null?null:userInfo.getUsername());
|
||||
try{
|
||||
depotHeadMapper.updateByPrimaryKeySelective(depotHead);
|
||||
}catch(Exception e){
|
||||
JshException.writeFail(logger, e);
|
||||
}
|
||||
/**入库和出库处理预付款信息*/
|
||||
if(BusinessConstants.PAY_TYPE_PREPAID.equals(depotHead.getPaytype())){
|
||||
if(depotHead.getOrganid()!=null){
|
||||
supplierService.updateAdvanceIn(depotHead.getOrganid(), BigDecimal.ZERO.subtract(depotHead.getTotalprice().subtract(preTotalPrice)));
|
||||
if(BusinessConstants.PAY_TYPE_PREPAID.equals(depotHead.getPayType())){
|
||||
if(depotHead.getOrganId()!=null){
|
||||
supplierService.updateAdvanceIn(depotHead.getOrganId(), BigDecimal.ZERO.subtract(depotHead.getTotalPrice().subtract(preTotalPrice)));
|
||||
}
|
||||
}
|
||||
/**入库和出库处理单据子表信息*/
|
||||
@@ -558,7 +558,7 @@ public class DepotHeadService {
|
||||
User userInfo=userService.getCurrentUser();
|
||||
//删除出库数据回收序列号
|
||||
if(BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())
|
||||
&&!BusinessConstants.SUB_TYPE_TRANSFER.equals(depotHead.getSubtype())){
|
||||
&&!BusinessConstants.SUB_TYPE_TRANSFER.equals(depotHead.getSubType())){
|
||||
//查询单据子表列表
|
||||
List<DepotItem> depotItemList=null;
|
||||
try{
|
||||
@@ -571,7 +571,7 @@ public class DepotHeadService {
|
||||
if(depotItemList!=null&&depotItemList.size()>0){
|
||||
for(DepotItem depotItem:depotItemList){
|
||||
//BasicNumber=OperNumber*ratio
|
||||
serialNumberService.cancelSerialNumber(depotItem.getMaterialid(), depotItem.getHeaderid(),(depotItem.getBasicnumber()==null?0:depotItem.getBasicnumber()).intValue(),userInfo);
|
||||
serialNumberService.cancelSerialNumber(depotItem.getMaterialId(), depotItem.getHeaderId(),(depotItem.getBasicNumber()==null?0:depotItem.getBasicNumber()).intValue(),userInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -224,7 +224,7 @@ public class DepotItemService {
|
||||
List<DepotItem> list =null;
|
||||
try{
|
||||
DepotItemExample example = new DepotItemExample();
|
||||
example.createCriteria().andHeaderidEqualTo(headerId);
|
||||
example.createCriteria().andHeaderIdEqualTo(headerId);
|
||||
list = depotItemMapper.selectByExample(example);
|
||||
}catch(Exception e){
|
||||
JshException.readFail(logger, e);
|
||||
@@ -327,7 +327,7 @@ public class DepotItemService {
|
||||
//首先回收序列号,如果是调拨,不用处理序列号
|
||||
JSONObject tempDeletedJson = JSONObject.parseObject(deletedJson.getString(i));
|
||||
if(BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())
|
||||
&&!BusinessConstants.SUB_TYPE_TRANSFER.equals(depotHead.getSubtype())){
|
||||
&&!BusinessConstants.SUB_TYPE_TRANSFER.equals(depotHead.getSubType())){
|
||||
DepotItem depotItem = getDepotItem(tempDeletedJson.getLong("Id"));
|
||||
if(depotItem==null){
|
||||
continue;
|
||||
@@ -335,12 +335,12 @@ public class DepotItemService {
|
||||
/**
|
||||
* 判断商品是否开启序列号,开启的收回序列号,未开启的跳过
|
||||
* */
|
||||
Material material= materialService.getMaterial(depotItem.getMaterialid());
|
||||
Material material= materialService.getMaterial(depotItem.getMaterialId());
|
||||
if(material==null){
|
||||
continue;
|
||||
}
|
||||
if(BusinessConstants.ENABLE_SERIAL_NUMBER_ENABLED.equals(material.getEnableserialnumber())){
|
||||
serialNumberService.cancelSerialNumber(depotItem.getMaterialid(),depotItem.getHeaderid(),(depotItem.getBasicnumber()==null?0:depotItem.getBasicnumber()).intValue(),
|
||||
if(BusinessConstants.ENABLE_SERIAL_NUMBER_ENABLED.equals(material.getEnableSerialNumber())){
|
||||
serialNumberService.cancelSerialNumber(depotItem.getMaterialId(),depotItem.getHeaderId(),(depotItem.getBasicNumber()==null?0:depotItem.getBasicNumber()).intValue(),
|
||||
userInfo);
|
||||
}
|
||||
}
|
||||
@@ -361,14 +361,14 @@ public class DepotItemService {
|
||||
for (int i = 0; i < insertedJson.size(); i++) {
|
||||
DepotItem depotItem = new DepotItem();
|
||||
JSONObject tempInsertedJson = JSONObject.parseObject(insertedJson.getString(i));
|
||||
depotItem.setHeaderid(headerId);
|
||||
depotItem.setHeaderId(headerId);
|
||||
Long materialExtendId = tempInsertedJson.getLong("MaterialExtendId");
|
||||
Long materialId = materialExtendService.getMaterialExtend(materialExtendId).getMaterialId();
|
||||
depotItem.setMaterialid(materialId);
|
||||
depotItem.setMaterialId(materialId);
|
||||
depotItem.setMaterialExtendId(tempInsertedJson.getLong("MaterialExtendId"));
|
||||
depotItem.setMunit(tempInsertedJson.getString("Unit"));
|
||||
depotItem.setMaterialUnit(tempInsertedJson.getString("Unit"));
|
||||
if (!StringUtil.isEmpty(tempInsertedJson.get("OperNumber").toString())) {
|
||||
depotItem.setOpernumber(tempInsertedJson.getBigDecimal("OperNumber"));
|
||||
depotItem.setOperNumber(tempInsertedJson.getBigDecimal("OperNumber"));
|
||||
try {
|
||||
String Unit = tempInsertedJson.get("Unit").toString();
|
||||
BigDecimal oNumber = tempInsertedJson.getBigDecimal("OperNumber");
|
||||
@@ -381,59 +381,59 @@ public class DepotItemService {
|
||||
String otherUnit = unitList.substring(unitList.indexOf(",") + 1); //副单位
|
||||
Integer ratio = Integer.parseInt(ratioList.substring(ratioList.indexOf(":") + 1).replace(")", "")); //比例
|
||||
if (Unit.equals(basicUnit)) { //如果等于基础单位
|
||||
depotItem.setBasicnumber(oNumber); //数量一致
|
||||
depotItem.setBasicNumber(oNumber); //数量一致
|
||||
} else if (Unit.equals(otherUnit)) { //如果等于副单位
|
||||
depotItem.setBasicnumber(oNumber.multiply(new BigDecimal(ratio)) ); //数量乘以比例
|
||||
depotItem.setBasicNumber(oNumber.multiply(new BigDecimal(ratio)) ); //数量乘以比例
|
||||
}
|
||||
} else {
|
||||
depotItem.setBasicnumber(oNumber); //其他情况
|
||||
depotItem.setBasicNumber(oNumber); //其他情况
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error(">>>>>>>>>>>>>>>>>>>设置基础数量异常", e);
|
||||
}
|
||||
}
|
||||
if (!StringUtil.isEmpty(tempInsertedJson.get("UnitPrice").toString())) {
|
||||
depotItem.setUnitprice(tempInsertedJson.getBigDecimal("UnitPrice"));
|
||||
depotItem.setUnitPrice(tempInsertedJson.getBigDecimal("UnitPrice"));
|
||||
}
|
||||
if (!StringUtil.isEmpty(tempInsertedJson.get("TaxUnitPrice").toString())) {
|
||||
depotItem.setTaxunitprice(tempInsertedJson.getBigDecimal("TaxUnitPrice"));
|
||||
depotItem.setTaxUnitPrice(tempInsertedJson.getBigDecimal("TaxUnitPrice"));
|
||||
}
|
||||
if (!StringUtil.isEmpty(tempInsertedJson.get("AllPrice").toString())) {
|
||||
depotItem.setAllprice(tempInsertedJson.getBigDecimal("AllPrice"));
|
||||
depotItem.setAllPrice(tempInsertedJson.getBigDecimal("AllPrice"));
|
||||
}
|
||||
depotItem.setRemark(tempInsertedJson.getString("Remark"));
|
||||
if (tempInsertedJson.get("DepotId") != null && !StringUtil.isEmpty(tempInsertedJson.get("DepotId").toString())) {
|
||||
depotItem.setDepotid(tempInsertedJson.getLong("DepotId"));
|
||||
depotItem.setDepotId(tempInsertedJson.getLong("DepotId"));
|
||||
}
|
||||
if (tempInsertedJson.get("AnotherDepotId") != null && !StringUtil.isEmpty(tempInsertedJson.get("AnotherDepotId").toString())) {
|
||||
depotItem.setAnotherdepotid(tempInsertedJson.getLong("AnotherDepotId"));
|
||||
depotItem.setAnotherDepotId(tempInsertedJson.getLong("AnotherDepotId"));
|
||||
}
|
||||
if (!StringUtil.isEmpty(tempInsertedJson.get("TaxRate").toString())) {
|
||||
depotItem.setTaxrate(tempInsertedJson.getBigDecimal("TaxRate"));
|
||||
depotItem.setTaxRate(tempInsertedJson.getBigDecimal("TaxRate"));
|
||||
}
|
||||
if (!StringUtil.isEmpty(tempInsertedJson.get("TaxMoney").toString())) {
|
||||
depotItem.setTaxmoney(tempInsertedJson.getBigDecimal("TaxMoney"));
|
||||
depotItem.setTaxMoney(tempInsertedJson.getBigDecimal("TaxMoney"));
|
||||
}
|
||||
if (!StringUtil.isEmpty(tempInsertedJson.get("TaxLastMoney").toString())) {
|
||||
depotItem.setTaxlastmoney(tempInsertedJson.getBigDecimal("TaxLastMoney"));
|
||||
depotItem.setTaxLastMoney(tempInsertedJson.getBigDecimal("TaxLastMoney"));
|
||||
}
|
||||
if (tempInsertedJson.get("OtherField1") != null) {
|
||||
depotItem.setOtherfield1(tempInsertedJson.getString("OtherField1"));
|
||||
depotItem.setOtherField1(tempInsertedJson.getString("OtherField1"));
|
||||
}
|
||||
if (tempInsertedJson.get("OtherField2") != null) {
|
||||
depotItem.setOtherfield2(tempInsertedJson.getString("OtherField2"));
|
||||
depotItem.setOtherField2(tempInsertedJson.getString("OtherField2"));
|
||||
}
|
||||
if (tempInsertedJson.get("OtherField3") != null) {
|
||||
depotItem.setOtherfield3(tempInsertedJson.getString("OtherField3"));
|
||||
depotItem.setOtherField3(tempInsertedJson.getString("OtherField3"));
|
||||
}
|
||||
if (tempInsertedJson.get("OtherField4") != null) {
|
||||
depotItem.setOtherfield4(tempInsertedJson.getString("OtherField4"));
|
||||
depotItem.setOtherField4(tempInsertedJson.getString("OtherField4"));
|
||||
}
|
||||
if (tempInsertedJson.get("OtherField5") != null) {
|
||||
depotItem.setOtherfield5(tempInsertedJson.getString("OtherField5"));
|
||||
depotItem.setOtherField5(tempInsertedJson.getString("OtherField5"));
|
||||
}
|
||||
if (tempInsertedJson.get("MType") != null) {
|
||||
depotItem.setMtype(tempInsertedJson.getString("MType"));
|
||||
depotItem.setMaterialType(tempInsertedJson.getString("MType"));
|
||||
}
|
||||
/**
|
||||
* 出库时判断库存是否充足
|
||||
@@ -442,23 +442,23 @@ public class DepotItemService {
|
||||
if(depotItem==null){
|
||||
continue;
|
||||
}
|
||||
Material material= materialService.getMaterial(depotItem.getMaterialid());
|
||||
Material material= materialService.getMaterial(depotItem.getMaterialId());
|
||||
if(material==null){
|
||||
continue;
|
||||
}
|
||||
BigDecimal stock = getStockByParam(depotItem.getDepotid(),depotItem.getMaterialid(),null,null,tenantId);
|
||||
BigDecimal thisBasicNumber = depotItem.getBasicnumber()==null?BigDecimal.ZERO:depotItem.getBasicnumber();
|
||||
BigDecimal stock = getStockByParam(depotItem.getDepotId(),depotItem.getMaterialId(),null,null,tenantId);
|
||||
BigDecimal thisBasicNumber = depotItem.getBasicNumber()==null?BigDecimal.ZERO:depotItem.getBasicNumber();
|
||||
if(systemConfigService.getMinusStockFlag() == false && stock.compareTo(thisBasicNumber)<0){
|
||||
throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_STOCK_NOT_ENOUGH_CODE,
|
||||
String.format(ExceptionConstants.MATERIAL_STOCK_NOT_ENOUGH_MSG,material==null?"":material.getName()));
|
||||
}
|
||||
|
||||
/**出库时处理序列号*/
|
||||
if(!BusinessConstants.SUB_TYPE_TRANSFER.equals(depotHead.getSubtype())) {
|
||||
if(!BusinessConstants.SUB_TYPE_TRANSFER.equals(depotHead.getSubType())) {
|
||||
/**
|
||||
* 判断商品是否开启序列号,开启的收回序列号,未开启的跳过
|
||||
* */
|
||||
if(BusinessConstants.ENABLE_SERIAL_NUMBER_ENABLED.equals(material.getEnableserialnumber())) {
|
||||
if(BusinessConstants.ENABLE_SERIAL_NUMBER_ENABLED.equals(material.getEnableSerialNumber())) {
|
||||
//查询单据子表中开启序列号的数据列表
|
||||
serialNumberService.checkAndUpdateSerialNumber(depotItem, userInfo);
|
||||
}
|
||||
@@ -477,23 +477,23 @@ public class DepotItemService {
|
||||
if(depotItem==null){
|
||||
continue;
|
||||
}
|
||||
Material material= materialService.getMaterial(depotItem.getMaterialid());
|
||||
Material material= materialService.getMaterial(depotItem.getMaterialId());
|
||||
if(material==null){
|
||||
continue;
|
||||
}
|
||||
//首先回收序列号
|
||||
if(BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())
|
||||
&&!BusinessConstants.SUB_TYPE_TRANSFER.equals(depotHead.getSubtype())) {
|
||||
&&!BusinessConstants.SUB_TYPE_TRANSFER.equals(depotHead.getSubType())) {
|
||||
/**
|
||||
* 判断商品是否开启序列号,开启的收回序列号,未开启的跳过
|
||||
* */
|
||||
if(BusinessConstants.ENABLE_SERIAL_NUMBER_ENABLED.equals(material.getEnableserialnumber())) {
|
||||
serialNumberService.cancelSerialNumber(depotItem.getMaterialid(), depotItem.getHeaderid(), (depotItem.getBasicnumber()==null?0:depotItem.getBasicnumber()).intValue(),
|
||||
if(BusinessConstants.ENABLE_SERIAL_NUMBER_ENABLED.equals(material.getEnableSerialNumber())) {
|
||||
serialNumberService.cancelSerialNumber(depotItem.getMaterialId(), depotItem.getHeaderId(), (depotItem.getBasicNumber()==null?0:depotItem.getBasicNumber()).intValue(),
|
||||
userInfo);
|
||||
}
|
||||
/**收回序列号的时候释放库存*/
|
||||
depotItem.setOpernumber(BigDecimal.ZERO);
|
||||
depotItem.setBasicnumber(BigDecimal.ZERO);
|
||||
depotItem.setOperNumber(BigDecimal.ZERO);
|
||||
depotItem.setBasicNumber(BigDecimal.ZERO);
|
||||
this.updateDepotItemWithObj(depotItem);
|
||||
}
|
||||
depotItem.setId(tempUpdatedJson.getLong("Id"));
|
||||
@@ -501,12 +501,12 @@ public class DepotItemService {
|
||||
if (StringUtil.isExist(tempUpdatedJson.get("MaterialExtendId"))) {
|
||||
Long materialExtendId = tempUpdatedJson.getLong("MaterialExtendId");
|
||||
materialId = materialExtendService.getMaterialExtend(materialExtendId).getMaterialId();
|
||||
depotItem.setMaterialid(materialId);
|
||||
depotItem.setMaterialId(materialId);
|
||||
depotItem.setMaterialExtendId(tempUpdatedJson.getLong("MaterialExtendId"));
|
||||
}
|
||||
depotItem.setMunit(tempUpdatedJson.getString("Unit"));
|
||||
depotItem.setMaterialUnit(tempUpdatedJson.getString("Unit"));
|
||||
if (!StringUtil.isEmpty(tempUpdatedJson.get("OperNumber").toString())) {
|
||||
depotItem.setOpernumber(tempUpdatedJson.getBigDecimal("OperNumber"));
|
||||
depotItem.setOperNumber(tempUpdatedJson.getBigDecimal("OperNumber"));
|
||||
try {
|
||||
String Unit = tempUpdatedJson.get("Unit").toString();
|
||||
BigDecimal oNumber = tempUpdatedJson.getBigDecimal("OperNumber");
|
||||
@@ -519,48 +519,48 @@ public class DepotItemService {
|
||||
String otherUnit = unitList.substring(unitList.indexOf(",") + 1); //副单位
|
||||
Integer ratio = Integer.parseInt(ratioList.substring(ratioList.indexOf(":") + 1).replace(")", "")); //比例
|
||||
if (Unit.equals(basicUnit)) { //如果等于基础单位
|
||||
depotItem.setBasicnumber(oNumber); //数量一致
|
||||
depotItem.setBasicNumber(oNumber); //数量一致
|
||||
} else if (Unit.equals(otherUnit)) { //如果等于副单位
|
||||
depotItem.setBasicnumber(oNumber.multiply(new BigDecimal(ratio))); //数量乘以比例
|
||||
depotItem.setBasicNumber(oNumber.multiply(new BigDecimal(ratio))); //数量乘以比例
|
||||
}
|
||||
} else {
|
||||
depotItem.setBasicnumber(oNumber); //其他情况
|
||||
depotItem.setBasicNumber(oNumber); //其他情况
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error(">>>>>>>>>>>>>>>>>>>设置基础数量异常", e);
|
||||
}
|
||||
}
|
||||
if (!StringUtil.isEmpty(tempUpdatedJson.get("UnitPrice").toString())) {
|
||||
depotItem.setUnitprice(tempUpdatedJson.getBigDecimal("UnitPrice"));
|
||||
depotItem.setUnitPrice(tempUpdatedJson.getBigDecimal("UnitPrice"));
|
||||
}
|
||||
if (!StringUtil.isEmpty(tempUpdatedJson.get("TaxUnitPrice").toString())) {
|
||||
depotItem.setTaxunitprice(tempUpdatedJson.getBigDecimal("TaxUnitPrice"));
|
||||
depotItem.setTaxUnitPrice(tempUpdatedJson.getBigDecimal("TaxUnitPrice"));
|
||||
}
|
||||
if (!StringUtil.isEmpty(tempUpdatedJson.get("AllPrice").toString())) {
|
||||
depotItem.setAllprice(tempUpdatedJson.getBigDecimal("AllPrice"));
|
||||
depotItem.setAllPrice(tempUpdatedJson.getBigDecimal("AllPrice"));
|
||||
}
|
||||
depotItem.setRemark(tempUpdatedJson.getString("Remark"));
|
||||
if (tempUpdatedJson.get("DepotId") != null && !StringUtil.isEmpty(tempUpdatedJson.get("DepotId").toString())) {
|
||||
depotItem.setDepotid(tempUpdatedJson.getLong("DepotId"));
|
||||
depotItem.setDepotId(tempUpdatedJson.getLong("DepotId"));
|
||||
}
|
||||
if (tempUpdatedJson.get("AnotherDepotId") != null && !StringUtil.isEmpty(tempUpdatedJson.get("AnotherDepotId").toString())) {
|
||||
depotItem.setAnotherdepotid(tempUpdatedJson.getLong("AnotherDepotId"));
|
||||
depotItem.setAnotherDepotId(tempUpdatedJson.getLong("AnotherDepotId"));
|
||||
}
|
||||
if (!StringUtil.isEmpty(tempUpdatedJson.get("TaxRate").toString())) {
|
||||
depotItem.setTaxrate(tempUpdatedJson.getBigDecimal("TaxRate"));
|
||||
depotItem.setTaxRate(tempUpdatedJson.getBigDecimal("TaxRate"));
|
||||
}
|
||||
if (!StringUtil.isEmpty(tempUpdatedJson.get("TaxMoney").toString())) {
|
||||
depotItem.setTaxmoney(tempUpdatedJson.getBigDecimal("TaxMoney"));
|
||||
depotItem.setTaxMoney(tempUpdatedJson.getBigDecimal("TaxMoney"));
|
||||
}
|
||||
if (!StringUtil.isEmpty(tempUpdatedJson.get("TaxLastMoney").toString())) {
|
||||
depotItem.setTaxlastmoney(tempUpdatedJson.getBigDecimal("TaxLastMoney"));
|
||||
depotItem.setTaxLastMoney(tempUpdatedJson.getBigDecimal("TaxLastMoney"));
|
||||
}
|
||||
depotItem.setOtherfield1(tempUpdatedJson.getString("OtherField1"));
|
||||
depotItem.setOtherfield2(tempUpdatedJson.getString("OtherField2"));
|
||||
depotItem.setOtherfield3(tempUpdatedJson.getString("OtherField3"));
|
||||
depotItem.setOtherfield4(tempUpdatedJson.getString("OtherField4"));
|
||||
depotItem.setOtherfield5(tempUpdatedJson.getString("OtherField5"));
|
||||
depotItem.setMtype(tempUpdatedJson.getString("MType"));
|
||||
depotItem.setOtherField1(tempUpdatedJson.getString("OtherField1"));
|
||||
depotItem.setOtherField2(tempUpdatedJson.getString("OtherField2"));
|
||||
depotItem.setOtherField3(tempUpdatedJson.getString("OtherField3"));
|
||||
depotItem.setOtherField4(tempUpdatedJson.getString("OtherField4"));
|
||||
depotItem.setOtherField5(tempUpdatedJson.getString("OtherField5"));
|
||||
depotItem.setMaterialType(tempUpdatedJson.getString("MType"));
|
||||
/**
|
||||
* create by: qiankunpingtai
|
||||
* create time: 2019/3/25 15:18
|
||||
@@ -569,25 +569,25 @@ public class DepotItemService {
|
||||
* 修改了商品类型时,库中的商品和页面传递的不同
|
||||
* 这里需要重新获取页面传递的商品信息
|
||||
*/
|
||||
if(!material.getId().equals(depotItem.getMaterialid())){
|
||||
material= materialService.getMaterial(depotItem.getMaterialid());
|
||||
if(!material.getId().equals(depotItem.getMaterialId())){
|
||||
material= materialService.getMaterial(depotItem.getMaterialId());
|
||||
if(material==null){
|
||||
continue;
|
||||
}
|
||||
}
|
||||
/**出库时处理序列号*/
|
||||
if(BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())){
|
||||
BigDecimal stock = getStockByParam(depotItem.getDepotid(),depotItem.getMaterialid(),null,null,tenantId);
|
||||
BigDecimal thisBasicNumber = depotItem.getBasicnumber()==null?BigDecimal.ZERO:depotItem.getBasicnumber();
|
||||
BigDecimal stock = getStockByParam(depotItem.getDepotId(),depotItem.getMaterialId(),null,null,tenantId);
|
||||
BigDecimal thisBasicNumber = depotItem.getBasicNumber()==null?BigDecimal.ZERO:depotItem.getBasicNumber();
|
||||
if(systemConfigService.getMinusStockFlag() == false && stock.compareTo(thisBasicNumber)<0){
|
||||
throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_STOCK_NOT_ENOUGH_CODE,
|
||||
String.format(ExceptionConstants.MATERIAL_STOCK_NOT_ENOUGH_MSG,material==null?"":material.getName()));
|
||||
}
|
||||
if(!BusinessConstants.SUB_TYPE_TRANSFER.equals(depotHead.getSubtype())) {
|
||||
if(!BusinessConstants.SUB_TYPE_TRANSFER.equals(depotHead.getSubType())) {
|
||||
/**
|
||||
* 判断商品是否开启序列号,开启的收回序列号,未开启的跳过
|
||||
* */
|
||||
if(BusinessConstants.ENABLE_SERIAL_NUMBER_ENABLED.equals(material.getEnableserialnumber())) {
|
||||
if(BusinessConstants.ENABLE_SERIAL_NUMBER_ENABLED.equals(material.getEnableSerialNumber())) {
|
||||
//查询单据子表中开启序列号的数据列表
|
||||
serialNumberService.checkAndUpdateSerialNumber(depotItem, userInfo);
|
||||
}
|
||||
@@ -709,13 +709,13 @@ public class DepotItemService {
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public void updateCurrentStock(DepotItem depotItem, Long tenantId){
|
||||
MaterialCurrentStockExample example = new MaterialCurrentStockExample();
|
||||
example.createCriteria().andMaterialIdEqualTo(depotItem.getMaterialid()).andDepotIdEqualTo(depotItem.getDepotid())
|
||||
example.createCriteria().andMaterialIdEqualTo(depotItem.getMaterialId()).andDepotIdEqualTo(depotItem.getDepotId())
|
||||
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
List<MaterialCurrentStock> list = materialCurrentStockMapper.selectByExample(example);
|
||||
MaterialCurrentStock materialCurrentStock = new MaterialCurrentStock();
|
||||
materialCurrentStock.setMaterialId(depotItem.getMaterialid());
|
||||
materialCurrentStock.setDepotId(depotItem.getDepotid());
|
||||
materialCurrentStock.setCurrentNumber(getStockByParam(depotItem.getDepotid(),depotItem.getMaterialid(),null,null,tenantId));
|
||||
materialCurrentStock.setMaterialId(depotItem.getMaterialId());
|
||||
materialCurrentStock.setDepotId(depotItem.getDepotId());
|
||||
materialCurrentStock.setCurrentNumber(getStockByParam(depotItem.getDepotId(),depotItem.getMaterialId(),null,null,tenantId));
|
||||
if(list!=null && list.size()>0) {
|
||||
Long mcsId = list.get(0).getId();
|
||||
materialCurrentStock.setId(mcsId);
|
||||
|
||||
@@ -119,13 +119,13 @@ public class MaterialService {
|
||||
materialOther = materialOther + ((m.getMfrs() == null || m.getMfrs().equals("")) ? "" : "(" + m.getMfrs() + ")");
|
||||
}
|
||||
if (mpArr[i].equals("自定义1")) {
|
||||
materialOther = materialOther + ((m.getOtherfield1() == null || m.getOtherfield1().equals("")) ? "" : "(" + m.getOtherfield1() + ")");
|
||||
materialOther = materialOther + ((m.getOtherField1() == null || m.getOtherField1().equals("")) ? "" : "(" + m.getOtherField1() + ")");
|
||||
}
|
||||
if (mpArr[i].equals("自定义2")) {
|
||||
materialOther = materialOther + ((m.getOtherfield2() == null || m.getOtherfield2().equals("")) ? "" : "(" + m.getOtherfield2() + ")");
|
||||
materialOther = materialOther + ((m.getOtherField2() == null || m.getOtherField2().equals("")) ? "" : "(" + m.getOtherField2() + ")");
|
||||
}
|
||||
if (mpArr[i].equals("自定义3")) {
|
||||
materialOther = materialOther + ((m.getOtherfield3() == null || m.getOtherfield3().equals("")) ? "" : "(" + m.getOtherfield3() + ")");
|
||||
materialOther = materialOther + ((m.getOtherField3() == null || m.getOtherField3().equals("")) ? "" : "(" + m.getOtherField3() + ")");
|
||||
}
|
||||
}
|
||||
m.setMaterialOther(materialOther);
|
||||
@@ -155,7 +155,7 @@ public class MaterialService {
|
||||
Long mId = null;
|
||||
materialMapper.insertSelective(m);
|
||||
List<Material> materials = getMaterialListByParam(m.getName(),m.getModel(),m.getColor(),
|
||||
m.getStandard(), m.getMfrs(),m.getUnit(),m.getUnitid());
|
||||
m.getStandard(), m.getMfrs(),m.getUnit(),m.getUnitId());
|
||||
if(materials!=null && materials.size()>0) {
|
||||
mId = materials.get(0).getId();
|
||||
}
|
||||
@@ -265,7 +265,7 @@ public class MaterialService {
|
||||
MaterialExample.Criteria criteria = example.createCriteria();
|
||||
criteria.andNameEqualTo(name).andModelEqualTo(model).andColorEqualTo(color)
|
||||
.andStandardEqualTo(standard).andMfrsEqualTo(mfrs)
|
||||
.andOtherfield1EqualTo(otherField1).andOtherfield2EqualTo(otherField2).andOtherfield2EqualTo(otherField3)
|
||||
.andOtherField1EqualTo(otherField1).andOtherField2EqualTo(otherField2).andOtherField2EqualTo(otherField3)
|
||||
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
if (id > 0) {
|
||||
criteria.andIdNotEqualTo(id);
|
||||
@@ -274,7 +274,7 @@ public class MaterialService {
|
||||
criteria.andUnitEqualTo(unit);
|
||||
}
|
||||
if (unitId !=null) {
|
||||
criteria.andUnitidEqualTo(unitId);
|
||||
criteria.andUnitIdEqualTo(unitId);
|
||||
}
|
||||
List<Material> list =null;
|
||||
try{
|
||||
@@ -400,8 +400,8 @@ public class MaterialService {
|
||||
m.setModel(model);
|
||||
m.setColor(color);
|
||||
Long categoryId = materialCategoryService.getCategoryIdByName(categoryName);
|
||||
m.setCategoryid(categoryId);
|
||||
m.setSafetystock(parseBigDecimalEx(safetyStock));
|
||||
m.setCategoryId(categoryId);
|
||||
m.setSafetyStock(parseBigDecimalEx(safetyStock));
|
||||
String manyUnit = ExcelUtils.getContent(src, i, 7); //副单位
|
||||
String barCode = ExcelUtils.getContent(src, i, 8); //基础条码
|
||||
String manyBarCode = ExcelUtils.getContent(src, i, 9); //副条码
|
||||
@@ -422,7 +422,7 @@ public class MaterialService {
|
||||
if(StringUtil.isNotEmpty(manyUnit.trim())){ //多单位
|
||||
String manyUnitAll = unit + "," + manyUnit + "(1:" + ratio + ")";
|
||||
Long unitId = unitService.getUnitIdByName(manyUnitAll);
|
||||
m.setUnitid(unitId);
|
||||
m.setUnitId(unitId);
|
||||
JSONObject otherObj = new JSONObject();
|
||||
otherObj.put("barCode", manyBarCode);
|
||||
otherObj.put("commodityUnit", manyUnit);
|
||||
@@ -466,11 +466,11 @@ public class MaterialService {
|
||||
for(MaterialWithInitStock m: mList) {
|
||||
//判断该商品是否存在,如果不存在就新增,如果存在就更新
|
||||
List<Material> materials = getMaterialListByParam(m.getName(),m.getModel(),m.getColor(),m.getStandard(),
|
||||
m.getMfrs(),m.getUnit(),m.getUnitid());
|
||||
m.getMfrs(),m.getUnit(),m.getUnitId());
|
||||
if(materials.size()<=0) {
|
||||
materialMapper.insertSelective(m);
|
||||
List<Material> newList = getMaterialListByParam(m.getName(),m.getModel(),m.getColor(),m.getStandard(),
|
||||
m.getMfrs(),m.getUnit(),m.getUnitid());
|
||||
m.getMfrs(),m.getUnit(),m.getUnitId());
|
||||
if(newList!=null && newList.size()>0) {
|
||||
mId = newList.get(0).getId();
|
||||
}
|
||||
@@ -561,7 +561,7 @@ public class MaterialService {
|
||||
criteria.andUnitEqualTo(unit);
|
||||
}
|
||||
if (unitId !=null) {
|
||||
criteria.andUnitidEqualTo(unitId);
|
||||
criteria.andUnitIdEqualTo(unitId);
|
||||
}
|
||||
criteria.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
List<Material> list = materialMapper.selectByExample(example);
|
||||
@@ -639,7 +639,7 @@ public class MaterialService {
|
||||
public int batchDeleteMaterialByIdsNormal(String ids) throws Exception{
|
||||
/**
|
||||
* 校验
|
||||
* 1、单据子表 jsh_depotitem
|
||||
* 1、单据子表 jsh_depot_item
|
||||
* 是否有相关数据
|
||||
* */
|
||||
int deleteTotal=0;
|
||||
@@ -649,7 +649,7 @@ public class MaterialService {
|
||||
String [] idArray=ids.split(",");
|
||||
|
||||
/**
|
||||
* 校验单据子表 jsh_depotitem
|
||||
* 校验单据子表 jsh_depot_item
|
||||
* */
|
||||
List<DepotItem> depotItemList =null;
|
||||
try{
|
||||
|
||||
@@ -236,7 +236,7 @@ public class PersonService {
|
||||
/**
|
||||
* 校验
|
||||
* 1、财务主表 jsh_accounthead
|
||||
* 2、单据主表 jsh_depothead
|
||||
* 2、单据主表 jsh_depot_head
|
||||
* 是否有相关数据
|
||||
* */
|
||||
int deleteTotal=0;
|
||||
@@ -260,7 +260,7 @@ public class PersonService {
|
||||
ExceptionConstants.DELETE_FORCE_CONFIRM_MSG);
|
||||
}
|
||||
/**
|
||||
* 校验单据主表 jsh_depothead
|
||||
* 校验单据主表 jsh_depot_head
|
||||
* */
|
||||
List<DepotHead> depotHeadList =null;
|
||||
try{
|
||||
|
||||
@@ -346,7 +346,7 @@ public class SerialNumberService {
|
||||
|
||||
}
|
||||
//获得唯一商品
|
||||
if (BusinessConstants.ENABLE_SERIAL_NUMBER_NOT_ENABLED.equals(mlist.get(0).getEnableserialnumber())) {
|
||||
if (BusinessConstants.ENABLE_SERIAL_NUMBER_NOT_ENABLED.equals(mlist.get(0).getEnableSerialNumber())) {
|
||||
//商品未开启序列号
|
||||
throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_NOT_ENABLE_SERIAL_NUMBER_CODE,
|
||||
ExceptionConstants.MATERIAL_NOT_ENABLE_SERIAL_NUMBER_MSG);
|
||||
@@ -400,16 +400,16 @@ public class SerialNumberService {
|
||||
public void checkAndUpdateSerialNumber(DepotItem depotItem,User userInfo) throws Exception{
|
||||
if(depotItem!=null){
|
||||
//查询商品下已分配的可用序列号数量
|
||||
int SerialNumberSum= serialNumberMapperEx.countSerialNumberByMaterialIdAndDepotheadId(depotItem.getMaterialid(),null,BusinessConstants.IS_SELL_HOLD);
|
||||
int SerialNumberSum= serialNumberMapperEx.countSerialNumberByMaterialIdAndDepotheadId(depotItem.getMaterialId(),null,BusinessConstants.IS_SELL_HOLD);
|
||||
//BasicNumber=OperNumber*ratio
|
||||
if((depotItem.getBasicnumber()==null?0:depotItem.getBasicnumber()).intValue()>SerialNumberSum){
|
||||
if((depotItem.getBasicNumber()==null?0:depotItem.getBasicNumber()).intValue()>SerialNumberSum){
|
||||
//获取商品名称
|
||||
Material material= materialMapper.selectByPrimaryKey(depotItem.getMaterialid());
|
||||
Material material= materialMapper.selectByPrimaryKey(depotItem.getMaterialId());
|
||||
throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_SERIAL_NUMBERE_NOT_ENOUGH_CODE,
|
||||
String.format(ExceptionConstants.MATERIAL_SERIAL_NUMBERE_NOT_ENOUGH_MSG,material==null?"":material.getName()));
|
||||
}
|
||||
//商品下序列号充足,分配序列号
|
||||
sellSerialNumber(depotItem.getMaterialid(),depotItem.getHeaderid(),(depotItem.getBasicnumber()==null?0:depotItem.getBasicnumber()).intValue(),userInfo);
|
||||
sellSerialNumber(depotItem.getMaterialId(),depotItem.getHeaderId(),(depotItem.getBasicNumber()==null?0:depotItem.getBasicNumber()).intValue(),userInfo);
|
||||
}
|
||||
}
|
||||
/**
|
||||
|
||||
@@ -103,11 +103,11 @@ public class SupplierService {
|
||||
supType = "vendor";
|
||||
}
|
||||
BigDecimal sum = BigDecimal.ZERO;
|
||||
BigDecimal beginNeedGet = s.getBeginneedget();
|
||||
BigDecimal beginNeedGet = s.getBeginNeedGet();
|
||||
if(beginNeedGet==null) {
|
||||
beginNeedGet = BigDecimal.ZERO;
|
||||
}
|
||||
BigDecimal beginNeedPay = s.getBeginneedpay();
|
||||
BigDecimal beginNeedPay = s.getBeginNeedPay();
|
||||
if(beginNeedPay==null) {
|
||||
beginNeedPay = BigDecimal.ZERO;
|
||||
}
|
||||
@@ -115,12 +115,12 @@ public class SupplierService {
|
||||
sum = sum.add(accountHeadService.findTotalPay(supplierId, endTime, supType));
|
||||
if(("客户").equals(s.getType())) {
|
||||
sum = sum.add(beginNeedGet).subtract(beginNeedPay);
|
||||
s.setAllneedget(sum);
|
||||
s.setAllneedpay(BigDecimal.ZERO);
|
||||
s.setAllNeedGet(sum);
|
||||
s.setAllNeedPay(BigDecimal.ZERO);
|
||||
} else if(("供应商").equals(s.getType())) {
|
||||
sum = sum.add(beginNeedPay).subtract(beginNeedGet);
|
||||
s.setAllneedget(BigDecimal.ZERO);
|
||||
s.setAllneedpay(sum);
|
||||
s.setAllNeedGet(BigDecimal.ZERO);
|
||||
s.setAllNeedPay(sum);
|
||||
}
|
||||
resList.add(s);
|
||||
}
|
||||
@@ -157,11 +157,11 @@ public class SupplierService {
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int updateSupplier(String beanJson, Long id, HttpServletRequest request)throws Exception {
|
||||
Supplier supplier = JSONObject.parseObject(beanJson, Supplier.class);
|
||||
if(supplier.getBeginneedpay() == null) {
|
||||
supplier.setBeginneedpay(BigDecimal.ZERO);
|
||||
if(supplier.getBeginNeedPay() == null) {
|
||||
supplier.setBeginNeedPay(BigDecimal.ZERO);
|
||||
}
|
||||
if(supplier.getBeginneedget() == null) {
|
||||
supplier.setBeginneedget(BigDecimal.ZERO);
|
||||
if(supplier.getBeginNeedGet() == null) {
|
||||
supplier.setBeginNeedGet(BigDecimal.ZERO);
|
||||
}
|
||||
supplier.setId(id);
|
||||
int result=0;
|
||||
@@ -229,7 +229,7 @@ public class SupplierService {
|
||||
int result=0;
|
||||
try{
|
||||
if(supplier!=null){
|
||||
supplier.setAdvancein(supplier.getAdvancein().add(advanceIn)); //增加预收款的金额,可能增加的是负值
|
||||
supplier.setAdvanceIn(supplier.getAdvanceIn().add(advanceIn)); //增加预收款的金额,可能增加的是负值
|
||||
result=supplierMapper.updateByPrimaryKeySelective(supplier);
|
||||
}
|
||||
}catch(Exception e){
|
||||
@@ -391,7 +391,7 @@ public class SupplierService {
|
||||
/**
|
||||
* 校验
|
||||
* 1、财务主表 jsh_accounthead
|
||||
* 2、单据主表 jsh_depothead
|
||||
* 2、单据主表 jsh_depot_head
|
||||
* 是否有相关数据
|
||||
* */
|
||||
int deleteTotal=0;
|
||||
@@ -415,7 +415,7 @@ public class SupplierService {
|
||||
ExceptionConstants.DELETE_FORCE_CONFIRM_MSG);
|
||||
}
|
||||
/**
|
||||
* 校验单据主表 jsh_depothead
|
||||
* 校验单据主表 jsh_depot_head
|
||||
* */
|
||||
List<DepotHead> depotHeadList=null;
|
||||
try{
|
||||
|
||||
Reference in New Issue
Block a user