给订单去除仓库

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,9 +363,12 @@ 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 {
if(!BusinessConstants.SUB_TYPE_PURCHASE_ORDER.equals(depotHead.getSubType())
&& !BusinessConstants.SUB_TYPE_SALES_ORDER.equals(depotHead.getSubType())) {
throw new BusinessRunTimeException(ExceptionConstants.DEPOT_HEAD_DEPOT_FAILED_CODE, throw new BusinessRunTimeException(ExceptionConstants.DEPOT_HEAD_DEPOT_FAILED_CODE,
String.format(ExceptionConstants.DEPOT_HEAD_DEPOT_FAILED_MSG)); 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"))) {
if(rowObj.getLong("anotherDepotId").equals(rowObj.getLong("depotId"))) { if(rowObj.getLong("anotherDepotId").equals(rowObj.getLong("depotId"))) {
@@ -576,6 +579,7 @@ public class DepotItemService {
* @param dId * @param dId
*/ */
public void updateCurrentStockFun(Long mId, Long dId) { public void updateCurrentStockFun(Long mId, Long dId) {
if(mId!=null && dId!=null) {
MaterialCurrentStockExample example = new MaterialCurrentStockExample(); MaterialCurrentStockExample example = new MaterialCurrentStockExample();
example.createCriteria().andMaterialIdEqualTo(mId).andDepotIdEqualTo(dId) example.createCriteria().andMaterialIdEqualTo(mId).andDepotIdEqualTo(dId)
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED); .andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
@@ -593,3 +597,4 @@ public class DepotItemService {
} }
} }
} }
}