给订单去除仓库
This commit is contained in:
@@ -67,12 +67,14 @@ public class BusinessConstants {
|
||||
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_TETURNS = "采购退货";
|
||||
public static final String SUB_TYPE_OTHER = "其它";
|
||||
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_TRANSFER = "调拨";
|
||||
/**
|
||||
|
||||
@@ -105,8 +105,7 @@ public class DepotHeadService {
|
||||
List<DepotHeadVo4List> resList = new ArrayList<>();
|
||||
List<DepotHeadVo4List> list=new ArrayList<>();
|
||||
try{
|
||||
String depotIds = depotService.findDepotStrByCurrentUser();
|
||||
String [] depotArray=StringUtil.isNotEmpty(depotIds)?depotIds.split(","):null;
|
||||
String [] depotArray = getDepotArray(subType);
|
||||
String [] creatorArray = getCreatorArray(roleType);
|
||||
Map<Long,String> personMap = personService.getPersonMap();
|
||||
Map<Long,String> accountMap = accountService.getAccountMap();
|
||||
@@ -154,8 +153,7 @@ public class DepotHeadService {
|
||||
String materialParam, Long organId, Long creator, Long depotId) throws Exception{
|
||||
Long result=null;
|
||||
try{
|
||||
String depotIds = depotService.findDepotStrByCurrentUser();
|
||||
String [] depotArray=StringUtil.isNotEmpty(depotIds)?depotIds.split(","):null;
|
||||
String [] depotArray = getDepotArray(subType);
|
||||
String [] creatorArray = getCreatorArray(roleType);
|
||||
beginTime = Tools.parseDayToTime(beginTime,BusinessConstants.DAY_FIRST_TIME);
|
||||
endTime = Tools.parseDayToTime(endTime,BusinessConstants.DAY_LAST_TIME);
|
||||
@@ -167,6 +165,21 @@ public class DepotHeadService {
|
||||
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
|
||||
|
||||
@@ -363,8 +363,11 @@ public class DepotItemService {
|
||||
if (StringUtil.isExist(rowObj.get("depotId"))) {
|
||||
depotItem.setDepotId(rowObj.getLong("depotId"));
|
||||
} else {
|
||||
throw new BusinessRunTimeException(ExceptionConstants.DEPOT_HEAD_DEPOT_FAILED_CODE,
|
||||
String.format(ExceptionConstants.DEPOT_HEAD_DEPOT_FAILED_MSG));
|
||||
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,
|
||||
String.format(ExceptionConstants.DEPOT_HEAD_DEPOT_FAILED_MSG));
|
||||
}
|
||||
}
|
||||
if(BusinessConstants.SUB_TYPE_TRANSFER.equals(depotHead.getSubType())) {
|
||||
if (StringUtil.isExist(rowObj.get("anotherDepotId"))) {
|
||||
@@ -576,20 +579,22 @@ public class DepotItemService {
|
||||
* @param dId
|
||||
*/
|
||||
public void updateCurrentStockFun(Long mId, Long dId) {
|
||||
MaterialCurrentStockExample example = new MaterialCurrentStockExample();
|
||||
example.createCriteria().andMaterialIdEqualTo(mId).andDepotIdEqualTo(dId)
|
||||
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
List<MaterialCurrentStock> list = materialCurrentStockMapper.selectByExample(example);
|
||||
MaterialCurrentStock materialCurrentStock = new MaterialCurrentStock();
|
||||
materialCurrentStock.setMaterialId(mId);
|
||||
materialCurrentStock.setDepotId(dId);
|
||||
materialCurrentStock.setCurrentNumber(getStockByParam(dId,mId,null,null));
|
||||
if(list!=null && list.size()>0) {
|
||||
Long mcsId = list.get(0).getId();
|
||||
materialCurrentStock.setId(mcsId);
|
||||
materialCurrentStockMapper.updateByPrimaryKeySelective(materialCurrentStock);
|
||||
} else {
|
||||
materialCurrentStockMapper.insertSelective(materialCurrentStock);
|
||||
if(mId!=null && dId!=null) {
|
||||
MaterialCurrentStockExample example = new MaterialCurrentStockExample();
|
||||
example.createCriteria().andMaterialIdEqualTo(mId).andDepotIdEqualTo(dId)
|
||||
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
List<MaterialCurrentStock> list = materialCurrentStockMapper.selectByExample(example);
|
||||
MaterialCurrentStock materialCurrentStock = new MaterialCurrentStock();
|
||||
materialCurrentStock.setMaterialId(mId);
|
||||
materialCurrentStock.setDepotId(dId);
|
||||
materialCurrentStock.setCurrentNumber(getStockByParam(dId,mId,null,null));
|
||||
if(list!=null && list.size()>0) {
|
||||
Long mcsId = list.get(0).getId();
|
||||
materialCurrentStock.setId(mcsId);
|
||||
materialCurrentStockMapper.updateByPrimaryKeySelective(materialCurrentStock);
|
||||
} else {
|
||||
materialCurrentStockMapper.insertSelective(materialCurrentStock);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user