给订单去除仓库

This commit is contained in:
季圣华
2021-09-23 22:44:13 +08:00
parent a7ac4581fd
commit cbfdb3b875
3 changed files with 41 additions and 21 deletions

View File

@@ -67,12 +67,14 @@ public class BusinessConstants {
public static final String BILLS_STATUS_SKIP = "2"; public static final String BILLS_STATUS_SKIP = "2";
/** /**
* 出入库分类 * 出入库分类
*采购、采购退货、其它、零售、销售、调拨 *采购、采购退货、其它、零售、销售、调拨
* */ * */
public static final String SUB_TYPE_PURCHASE_ORDER = "采购订单";
public static final String SUB_TYPE_PURCHASE = "采购"; public static final String SUB_TYPE_PURCHASE = "采购";
public static final String SUB_TYPE_PURCHASE_TETURNS = "采购退货"; public static final String SUB_TYPE_PURCHASE_TETURNS = "采购退货";
public static final String SUB_TYPE_OTHER = "其它"; public static final String SUB_TYPE_OTHER = "其它";
public static final String SUB_TYPE_RETAIL = "零售"; public static final String SUB_TYPE_RETAIL = "零售";
public static final String SUB_TYPE_SALES_ORDER = "销售订单";
public static final String SUB_TYPE_SALES = "销售"; public static final String SUB_TYPE_SALES = "销售";
public static final String SUB_TYPE_TRANSFER = "调拨"; public static final String SUB_TYPE_TRANSFER = "调拨";
/** /**

View File

@@ -105,8 +105,7 @@ public class DepotHeadService {
List<DepotHeadVo4List> resList = new ArrayList<>(); List<DepotHeadVo4List> resList = new ArrayList<>();
List<DepotHeadVo4List> list=new ArrayList<>(); List<DepotHeadVo4List> list=new ArrayList<>();
try{ try{
String depotIds = depotService.findDepotStrByCurrentUser(); String [] depotArray = getDepotArray(subType);
String [] depotArray=StringUtil.isNotEmpty(depotIds)?depotIds.split(","):null;
String [] creatorArray = getCreatorArray(roleType); String [] creatorArray = getCreatorArray(roleType);
Map<Long,String> personMap = personService.getPersonMap(); Map<Long,String> personMap = personService.getPersonMap();
Map<Long,String> accountMap = accountService.getAccountMap(); Map<Long,String> accountMap = accountService.getAccountMap();
@@ -154,8 +153,7 @@ public class DepotHeadService {
String materialParam, Long organId, Long creator, Long depotId) throws Exception{ String materialParam, Long organId, Long creator, Long depotId) throws Exception{
Long result=null; Long result=null;
try{ try{
String depotIds = depotService.findDepotStrByCurrentUser(); String [] depotArray = getDepotArray(subType);
String [] depotArray=StringUtil.isNotEmpty(depotIds)?depotIds.split(","):null;
String [] creatorArray = getCreatorArray(roleType); String [] creatorArray = getCreatorArray(roleType);
beginTime = Tools.parseDayToTime(beginTime,BusinessConstants.DAY_FIRST_TIME); beginTime = Tools.parseDayToTime(beginTime,BusinessConstants.DAY_FIRST_TIME);
endTime = Tools.parseDayToTime(endTime,BusinessConstants.DAY_LAST_TIME); endTime = Tools.parseDayToTime(endTime,BusinessConstants.DAY_LAST_TIME);
@@ -167,6 +165,21 @@ public class DepotHeadService {
return result; return result;
} }
/**
* 根据单据类型获取仓库数组
* @param subType
* @return
* @throws Exception
*/
public String[] getDepotArray(String subType) throws Exception {
String [] depotArray = null;
if(!BusinessConstants.SUB_TYPE_PURCHASE_ORDER.equals(subType) && !BusinessConstants.SUB_TYPE_SALES_ORDER.equals(subType)) {
String depotIds = depotService.findDepotStrByCurrentUser();
depotArray = StringUtil.isNotEmpty(depotIds) ? depotIds.split(",") : null;
}
return depotArray;
}
/** /**
* 根据角色类型获取操作员数组 * 根据角色类型获取操作员数组
* @param roleType * @param roleType

View File

@@ -363,8 +363,11 @@ public class DepotItemService {
if (StringUtil.isExist(rowObj.get("depotId"))) { if (StringUtil.isExist(rowObj.get("depotId"))) {
depotItem.setDepotId(rowObj.getLong("depotId")); depotItem.setDepotId(rowObj.getLong("depotId"));
} else { } else {
throw new BusinessRunTimeException(ExceptionConstants.DEPOT_HEAD_DEPOT_FAILED_CODE, if(!BusinessConstants.SUB_TYPE_PURCHASE_ORDER.equals(depotHead.getSubType())
String.format(ExceptionConstants.DEPOT_HEAD_DEPOT_FAILED_MSG)); && !BusinessConstants.SUB_TYPE_SALES_ORDER.equals(depotHead.getSubType())) {
throw new BusinessRunTimeException(ExceptionConstants.DEPOT_HEAD_DEPOT_FAILED_CODE,
String.format(ExceptionConstants.DEPOT_HEAD_DEPOT_FAILED_MSG));
}
} }
if(BusinessConstants.SUB_TYPE_TRANSFER.equals(depotHead.getSubType())) { if(BusinessConstants.SUB_TYPE_TRANSFER.equals(depotHead.getSubType())) {
if (StringUtil.isExist(rowObj.get("anotherDepotId"))) { if (StringUtil.isExist(rowObj.get("anotherDepotId"))) {
@@ -576,20 +579,22 @@ public class DepotItemService {
* @param dId * @param dId
*/ */
public void updateCurrentStockFun(Long mId, Long dId) { public void updateCurrentStockFun(Long mId, Long dId) {
MaterialCurrentStockExample example = new MaterialCurrentStockExample(); if(mId!=null && dId!=null) {
example.createCriteria().andMaterialIdEqualTo(mId).andDepotIdEqualTo(dId) MaterialCurrentStockExample example = new MaterialCurrentStockExample();
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED); example.createCriteria().andMaterialIdEqualTo(mId).andDepotIdEqualTo(dId)
List<MaterialCurrentStock> list = materialCurrentStockMapper.selectByExample(example); .andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
MaterialCurrentStock materialCurrentStock = new MaterialCurrentStock(); List<MaterialCurrentStock> list = materialCurrentStockMapper.selectByExample(example);
materialCurrentStock.setMaterialId(mId); MaterialCurrentStock materialCurrentStock = new MaterialCurrentStock();
materialCurrentStock.setDepotId(dId); materialCurrentStock.setMaterialId(mId);
materialCurrentStock.setCurrentNumber(getStockByParam(dId,mId,null,null)); materialCurrentStock.setDepotId(dId);
if(list!=null && list.size()>0) { materialCurrentStock.setCurrentNumber(getStockByParam(dId,mId,null,null));
Long mcsId = list.get(0).getId(); if(list!=null && list.size()>0) {
materialCurrentStock.setId(mcsId); Long mcsId = list.get(0).getId();
materialCurrentStockMapper.updateByPrimaryKeySelective(materialCurrentStock); materialCurrentStock.setId(mcsId);
} else { materialCurrentStockMapper.updateByPrimaryKeySelective(materialCurrentStock);
materialCurrentStockMapper.insertSelective(materialCurrentStock); } else {
materialCurrentStockMapper.insertSelective(materialCurrentStock);
}
} }
} }
} }