|
|
@ -11,12 +11,17 @@ import com.win.module.wms.dal.dataobject.businesstype.BusinesstypeDO; |
|
|
|
import com.win.module.wms.dal.dataobject.expectout.ExpectoutDO; |
|
|
|
import com.win.module.wms.dal.dataobject.itembasic.ItembasicDO; |
|
|
|
import com.win.module.wms.dal.dataobject.location.LocationDO; |
|
|
|
import com.win.module.wms.dal.dataobject.supplier.SupplierDO; |
|
|
|
import com.win.module.wms.dal.mysql.balance.BalanceMapper; |
|
|
|
import com.win.module.wms.dal.mysql.expectout.ExpectoutMapper; |
|
|
|
import com.win.module.wms.dal.mysql.location.LocationMapper; |
|
|
|
import com.win.module.wms.service.balance.BalanceService; |
|
|
|
import com.win.module.wms.service.expectout.ExpectoutService; |
|
|
|
import com.win.module.wms.service.expectout.ExpectoutServiceImpl; |
|
|
|
import com.win.module.wms.service.itembasic.ItembasicService; |
|
|
|
import com.win.module.wms.service.location.LocationService; |
|
|
|
import com.win.module.wms.service.rule.RuleService; |
|
|
|
import com.win.module.wms.service.supplier.SupplierService; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.commons.lang.StringUtils; |
|
|
|
import org.springframework.stereotype.Component; |
|
|
@ -29,6 +34,7 @@ import java.util.Map; |
|
|
|
|
|
|
|
import static com.win.framework.common.exception.util.ServiceExceptionUtil.exception; |
|
|
|
import static com.win.module.wms.enums.ErrorCodeConstants.*; |
|
|
|
|
|
|
|
@Slf4j |
|
|
|
@Component |
|
|
|
public class JobUtils { |
|
|
@ -39,6 +45,9 @@ public class JobUtils { |
|
|
|
@Resource |
|
|
|
private LocationService locationService; |
|
|
|
|
|
|
|
@Resource |
|
|
|
private BalanceService balanceService; |
|
|
|
|
|
|
|
@Resource |
|
|
|
private LocationMapper locationMapper; |
|
|
|
|
|
|
@ -49,6 +58,14 @@ public class JobUtils { |
|
|
|
private ExpectoutMapper expectoutMapper; |
|
|
|
@Resource |
|
|
|
private RuleService ruleService; |
|
|
|
|
|
|
|
@Resource |
|
|
|
private SupplierService supplierService; |
|
|
|
|
|
|
|
@Resource |
|
|
|
private ExpectoutService expectoutService; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 解析JSON串,返回两个对象的集合 |
|
|
|
* |
|
|
@ -121,6 +138,39 @@ public class JobUtils { |
|
|
|
} |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 校验物料有效,状态正确 |
|
|
|
* |
|
|
|
* @param itemCode 物品代码 |
|
|
|
* @return 物品基本信息列表 |
|
|
|
* @author chenfang |
|
|
|
*/ |
|
|
|
public ItembasicDO itemCodeExist(String itemCode) { |
|
|
|
ItembasicDO itembasicDO = itembasicService.selectItembasic(itemCode); |
|
|
|
if (itembasicDO != null) { |
|
|
|
return itembasicDO; |
|
|
|
} else { |
|
|
|
throw exception(ITEMBASIC_CODE_NOT_EXISTS); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 校验供应商有效,状态正确 |
|
|
|
* |
|
|
|
* @param supplierCode 代码 |
|
|
|
* @return 供应商列表 |
|
|
|
* @author chenfang |
|
|
|
*/ |
|
|
|
public SupplierDO supplierExist(String supplierCode) { |
|
|
|
SupplierDO supplierDO = supplierService.selectSupplier(supplierCode); |
|
|
|
if (supplierDO != null) { |
|
|
|
return supplierDO; |
|
|
|
} else { |
|
|
|
throw exception(STDCOSTPRICE_SUPPLIER_CODE_NOT_EXISTS); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//到库位与任务库位是否一致(可配置)
|
|
|
|
public boolean jobToLocationCodeAndRecordToLocationCodeAccord(String jobToLocationCode, String recordToLocationCode, String allowModifyLocation) { |
|
|
|
if (jobToLocationCode != null || !"".equals(jobToLocationCode)) { |
|
|
@ -137,6 +187,54 @@ public class JobUtils { |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 库位验证 |
|
|
|
* 从库位号有效,状态正确,开关正确 |
|
|
|
* 到库位号有效,状态正确,开关正确 |
|
|
|
* 共用同一个方法 |
|
|
|
* |
|
|
|
* @param locationCode 库位 |
|
|
|
* @return 库位信息 |
|
|
|
* @author chenfang |
|
|
|
*/ |
|
|
|
public LocationDO selectLocationExist(String locationCode) { |
|
|
|
LocationDO locationDO = locationService.selectLocation(locationCode); |
|
|
|
return locationDO; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 获取当前库位采用的获取库位存储策略信息 |
|
|
|
* |
|
|
|
* @param warehouseCode 仓库代码 |
|
|
|
* @param areaCode 区域代码 |
|
|
|
* @param locationGroupCode 库位组code |
|
|
|
* @param plocationCode 库位 |
|
|
|
* @return 库位存储策略信息 |
|
|
|
* @author chenfang |
|
|
|
*/ |
|
|
|
//TODO 后期具体业务时需判断策略相关标签状态(还没写)
|
|
|
|
public RuleRespVO selectLocationStrategyRule(String warehouseCode, String areaCode, String locationGroupCode, String plocationCode) { |
|
|
|
RuleRespVO ruleRespVO = ruleService.warehouseStorage(warehouseCode, areaCode, locationGroupCode, plocationCode); |
|
|
|
return ruleRespVO; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 零件库位关系有效 |
|
|
|
* |
|
|
|
* @param pitemCode 物品代码 |
|
|
|
* @return 上架策略信息 |
|
|
|
* @author chenfang |
|
|
|
*/ |
|
|
|
public RuleRespVO selectLocationAndModRelation(String pitemCode) { |
|
|
|
RuleRespVO grounding = ruleService.grounding(null, null, null, null, null, null, pitemCode, null, null, null, null, null, null); |
|
|
|
if (grounding != null) { |
|
|
|
return grounding; |
|
|
|
} else { |
|
|
|
throw exception(LOCATION_ITEMCODE_AND_LOCATIONCODE_NOT_EXISTS); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//DBT---DBT2---IT 物料类型检验是否一致
|
|
|
|
public boolean ifInType(String pitemCode, BusinesstypeDO businesstypeDO) { |
|
|
|
ItembasicDO itembasicDO = itembasicService.selectItembasic(pitemCode); |
|
|
@ -155,6 +253,7 @@ public class JobUtils { |
|
|
|
throw exception(ITEMBASIC_TYPE_AND_BUSINESSTYPE_NOT_EQUALS); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//DBT---DBT2---IS 物料状态检验是否一致
|
|
|
|
public boolean ifInStatus(String pitemCode, BusinesstypeDO businesstypeDO) { |
|
|
|
ItembasicDO itembasicDO = itembasicService.selectItembasic(pitemCode); |
|
|
@ -173,9 +272,10 @@ public class JobUtils { |
|
|
|
throw exception(ITEMBASIC_STATUS_AND_BUSINESSSTATUS_NOT_EQUALS); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//DBT---DBT2---LI 校验入库库位类型是否一致
|
|
|
|
public boolean ifInFromLocationType(String plocationCode, BusinesstypeDO businesstypeDO) { |
|
|
|
LocationDO locationDO = locationService.selectLocationExist(plocationCode); |
|
|
|
LocationDO locationDO = selectLocationExist(plocationCode); |
|
|
|
boolean ifInLocationType = false; |
|
|
|
if (locationDO != null) { |
|
|
|
String[] itemInLocationTypes = businesstypeDO.getInLocationTypes().split(","); |
|
|
@ -191,9 +291,10 @@ public class JobUtils { |
|
|
|
throw exception(FROM_LOCATION_TYPE_AND_BUSINESSTYPE_INLOCATION_TYPE_NOT_EQUALS); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//DBT---DBT2---LO 校验出库库位类型是否一致
|
|
|
|
public boolean ifInToLocationType(String plocationCode, BusinesstypeDO businesstypeDO) { |
|
|
|
LocationDO locationDO = locationService.selectLocationExist(plocationCode); |
|
|
|
LocationDO locationDO = selectLocationExist(plocationCode); |
|
|
|
boolean ifOutLocationType = false; |
|
|
|
if (locationDO != null) { |
|
|
|
String[] itemOutLocationTypes = businesstypeDO.getOutLocationTypes().split(","); |
|
|
@ -220,12 +321,14 @@ public class JobUtils { |
|
|
|
ifInInventoryStatuses = true; |
|
|
|
} |
|
|
|
} |
|
|
|
}if(ifInInventoryStatuses == true){ |
|
|
|
} |
|
|
|
if (ifInInventoryStatuses == true) { |
|
|
|
return true; |
|
|
|
} else { |
|
|
|
throw exception(INVENTORY_STATUS_AND_BUSINESS_IN_INVENTORY_STATUS_NOT_EQUALS_OR_NULL); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//DBT---DBT2---ISO 校验出库状态是否一致
|
|
|
|
public boolean ifOutInventoryStatuses(String pinventoryStatus, BusinesstypeDO businesstypeDO) { |
|
|
|
boolean ifOutInventoryStatuses = false; |
|
|
@ -236,122 +339,13 @@ public class JobUtils { |
|
|
|
ifOutInventoryStatuses = true; |
|
|
|
} |
|
|
|
} |
|
|
|
}if(ifOutInventoryStatuses == true){ |
|
|
|
} |
|
|
|
if (ifOutInventoryStatuses == true) { |
|
|
|
return true; |
|
|
|
} else { |
|
|
|
throw exception(INVENTORY_STATUS_AND_BUSINESS_OUT_INVENTORY_STATUS_NOT_EQUALS_OR_NULL); |
|
|
|
} |
|
|
|
} |
|
|
|
//调用公共方法查询库位信息
|
|
|
|
public LocationDO selectLocation(String pcode) { |
|
|
|
QueryWrapper queryWrapper = new QueryWrapper(); |
|
|
|
queryWrapper.eq("code",pcode); |
|
|
|
LocationDO locationDO = locationMapper.selectOne(queryWrapper); |
|
|
|
if(locationDO != null && "TRUE".equals(locationDO.getAvailable())){ |
|
|
|
return locationDO; |
|
|
|
}else { |
|
|
|
throw exception(LOCATION_NOT_EXISTS); |
|
|
|
} |
|
|
|
} |
|
|
|
public LocationDO selectLocationExist(String locationCode) { |
|
|
|
LocationDO locationDO = selectLocation(locationCode); |
|
|
|
return locationDO; |
|
|
|
} |
|
|
|
public RuleRespVO selectLocationStrategyRule(String warehouseCode, String areaCode, String locationGroupCode, String plocationCode) { |
|
|
|
RuleRespVO ruleRespVO = ruleService.warehouseStorage(warehouseCode,areaCode,locationGroupCode,plocationCode); |
|
|
|
return ruleRespVO; |
|
|
|
} |
|
|
|
public RuleRespVO selectLocationAndModRelation(String pitemCode) { |
|
|
|
RuleRespVO grounding = ruleService.grounding(null, null, null, null, null, null, pitemCode, null, null, null, null, null, null); |
|
|
|
if(grounding != null){ |
|
|
|
return grounding; |
|
|
|
}else { |
|
|
|
throw exception(LOCATION_ITEMCODE_AND_LOCATIONCODE_NOT_EXISTS); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//跟据管理模式查詢數量
|
|
|
|
//按數量查找 TB2-BY_QUANTITY
|
|
|
|
public List<BalanceDO> selectnumber(String itemcode, String inventorystatus, String locationcode){ |
|
|
|
QueryWrapper queryWrapper = new QueryWrapper(); |
|
|
|
queryWrapper.eq("item_code",itemcode); |
|
|
|
queryWrapper.eq("inventory_status",inventorystatus); |
|
|
|
queryWrapper.eq("location_code",locationcode); |
|
|
|
List<BalanceDO> balanceDO = balanceMapper.selectList(queryWrapper); |
|
|
|
if(!balanceDO.isEmpty()){ |
|
|
|
|
|
|
|
return balanceDO; |
|
|
|
} |
|
|
|
else{ |
|
|
|
throw exception(new ErrorCode(123,"物料号" + itemcode + "庫存狀態" + inventorystatus + "在"+ locationcode +"庫位中未查找到库存记录" )); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
//按批次查找 TB2-BY_BATCH
|
|
|
|
|
|
|
|
public List<BalanceDO> selectbatch(String itemcode, String batch ,String inventorystatus,String locationcode) { |
|
|
|
QueryWrapper queryWrapper = new QueryWrapper(); |
|
|
|
queryWrapper.eq("item_code",itemcode); |
|
|
|
queryWrapper.eq("batch",batch); |
|
|
|
queryWrapper.eq("inventory_status",inventorystatus); |
|
|
|
queryWrapper.eq("location_code",locationcode); |
|
|
|
|
|
|
|
List<BalanceDO> balanceDO = balanceMapper.selectList(queryWrapper); |
|
|
|
if(!balanceDO.isEmpty()){ |
|
|
|
|
|
|
|
return balanceDO; |
|
|
|
} |
|
|
|
else{ |
|
|
|
throw exception(new ErrorCode(124,"物料号" + itemcode +"批次"+ batch + "庫存狀態" + inventorystatus + "在"+ locationcode +"庫位中未查找到库存记录" )); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//按包裝查找 TB2-BY_PACKGING
|
|
|
|
public List<BalanceDO> selectpackaging(String itemcode, String packingnumber, String batch ,String inventorystatus,String locationcode) { |
|
|
|
QueryWrapper queryWrapper = new QueryWrapper(); |
|
|
|
queryWrapper.eq("item_code",itemcode); |
|
|
|
queryWrapper.eq("packing_number",packingnumber); |
|
|
|
queryWrapper.eq("batch",batch); |
|
|
|
queryWrapper.eq("inventory_status",inventorystatus); |
|
|
|
queryWrapper.eq("location_code",locationcode); |
|
|
|
|
|
|
|
List<BalanceDO> balanceDO = balanceMapper.selectList(queryWrapper); |
|
|
|
if(!balanceDO.isEmpty()){ |
|
|
|
|
|
|
|
return balanceDO; |
|
|
|
} |
|
|
|
else{ |
|
|
|
throw exception(new ErrorCode(128,"物料号" + itemcode + "箱码" +packingnumber + "批次"+ batch + "庫存狀態" + inventorystatus + "在"+ locationcode +"庫位中未查找到库存记录" )); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
//按唯一码查找 TB2-BY_UNIQUE_ID
|
|
|
|
public List<BalanceDO> selectuniqueid(String packingnumber,String locationcode , String inventorystatus){ |
|
|
|
QueryWrapper queryWrapper = new QueryWrapper(); |
|
|
|
queryWrapper.eq("packing_number",packingnumber); |
|
|
|
queryWrapper.eq("inventory_status",inventorystatus); |
|
|
|
queryWrapper.eq("location_code",locationcode); |
|
|
|
List<BalanceDO> balanceDO = balanceMapper.selectList(queryWrapper); |
|
|
|
if(!balanceDO.isEmpty()){ |
|
|
|
|
|
|
|
return balanceDO; |
|
|
|
} |
|
|
|
else{ |
|
|
|
throw exception(new ErrorCode(129,"唯一码" + packingnumber + "庫存狀態" + inventorystatus + "在"+ locationcode +"庫位中未查找到库存记录" )); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// TB1 查询库存
|
|
|
|
public List<BalanceDO> selectlocation(String itemcode, String packingnumber, String batch, String locationcode, String status) { |
|
|
@ -359,160 +353,57 @@ public class JobUtils { |
|
|
|
null, locationcode, null, null); |
|
|
|
List<BalanceDO> balanceDO = null; |
|
|
|
if ("{\"ManagementPrecision\":\"BY_QUANTITY\"}".equals(managementtRule.getConfiguration())) { |
|
|
|
balanceDO = selectnumber(itemcode, status, locationcode ); |
|
|
|
|
|
|
|
} |
|
|
|
else if("{\"ManagementPrecision\":\"BY_BATCH\"}".equals(managementtRule.getConfiguration())){ |
|
|
|
balanceDO = selectbatch(itemcode,batch,status,locationcode); |
|
|
|
|
|
|
|
balanceDO = balanceService.selectNumber(itemcode, status, locationcode); |
|
|
|
} else if ("{\"ManagementPrecision\":\"BY_BATCH\"}".equals(managementtRule.getConfiguration())) { |
|
|
|
balanceDO = balanceService.selectBatch(itemcode, batch, status, locationcode); |
|
|
|
} else if ("{\"ManagementPrecision\":\"BY_PACKAGING\"}".equals(managementtRule.getConfiguration())) { |
|
|
|
balanceDO = balanceService.selectPackaging(itemcode, packingnumber, batch, status, locationcode); |
|
|
|
} else if ("{\"ManagementPrecision\":\"BY_UNIQUE_ID\"}".equals(managementtRule.getConfiguration())) { |
|
|
|
balanceDO = balanceService.selectUniqueId(packingnumber, locationcode, status); |
|
|
|
} |
|
|
|
|
|
|
|
else if("{\"ManagementPrecision\":\"BY_PACKAGING\"}".equals(managementtRule.getConfiguration())) { |
|
|
|
balanceDO = selectpackaging(itemcode,packingnumber, batch, status, locationcode); |
|
|
|
} |
|
|
|
|
|
|
|
else if("{\"ManagementPrecision\":\"BY_UNIQUE_ID\"}".equals(managementtRule.getConfiguration())) { |
|
|
|
balanceDO = selectuniqueid(packingnumber, locationcode,status); |
|
|
|
} |
|
|
|
|
|
|
|
return balanceDO; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//按數量查找 BY_BATCH
|
|
|
|
public List<ExpectoutDO> selectnumbernew(String itemcode, String inventorystatus, String locationcode ){ |
|
|
|
QueryWrapper queryWrapper = new QueryWrapper(); |
|
|
|
queryWrapper.eq("item_code",itemcode); |
|
|
|
queryWrapper.eq("inventory_status",inventorystatus); |
|
|
|
queryWrapper.eq("location_code",locationcode); |
|
|
|
List<ExpectoutDO> expectoutDO = expectoutMapper.selectList(queryWrapper); |
|
|
|
|
|
|
|
|
|
|
|
if(!expectoutDO.isEmpty()){ |
|
|
|
|
|
|
|
return expectoutDO; |
|
|
|
} |
|
|
|
else{ |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
//按批次查詢 BY_BATCH
|
|
|
|
public List<ExpectoutDO> selectbatchnew(String itemcode,String batch ,String inventorystatus,String locationcode ){ |
|
|
|
QueryWrapper queryWrapper = new QueryWrapper(); |
|
|
|
queryWrapper.eq("item_code",itemcode); |
|
|
|
queryWrapper.eq("batch",batch); |
|
|
|
queryWrapper.eq("inventory_status",inventorystatus); |
|
|
|
queryWrapper.eq("location_code",locationcode); |
|
|
|
List<ExpectoutDO> expectoutDO = expectoutMapper.selectList(queryWrapper); |
|
|
|
|
|
|
|
|
|
|
|
if(!expectoutDO.isEmpty()){ |
|
|
|
|
|
|
|
return expectoutDO; |
|
|
|
} |
|
|
|
else{ |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
//按包裝 BY_PACKAGING
|
|
|
|
public List<ExpectoutDO> selectpackingnew(String itemcode, String packingnumber ,String batch ,String inventorystatus,String locationcode ){ |
|
|
|
QueryWrapper queryWrapper = new QueryWrapper(); |
|
|
|
queryWrapper.eq("item_code",itemcode); |
|
|
|
queryWrapper.eq("batch",batch); |
|
|
|
queryWrapper.eq("packing_number",packingnumber); |
|
|
|
queryWrapper.eq("inventory_status",inventorystatus); |
|
|
|
queryWrapper.eq("location_code",locationcode); |
|
|
|
List<ExpectoutDO> expectoutDO = expectoutMapper.selectList(queryWrapper); |
|
|
|
|
|
|
|
|
|
|
|
if(!expectoutDO.isEmpty()){ |
|
|
|
|
|
|
|
return expectoutDO; |
|
|
|
} |
|
|
|
else{ |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
//按唯一码查詢 BY_UNIQUE_ID
|
|
|
|
public List<ExpectoutDO> selectuniqeidnew( String packingnumber ,String locationcode ,String inventorystatus ){ |
|
|
|
QueryWrapper queryWrapper = new QueryWrapper(); |
|
|
|
queryWrapper.eq("packing_number",packingnumber); |
|
|
|
queryWrapper.eq("inventory_status",inventorystatus); |
|
|
|
queryWrapper.eq("location_code",locationcode); |
|
|
|
List<ExpectoutDO> expectoutDO = expectoutMapper.selectList(queryWrapper); |
|
|
|
|
|
|
|
|
|
|
|
if(!expectoutDO.isEmpty()){ |
|
|
|
|
|
|
|
return expectoutDO; |
|
|
|
} |
|
|
|
else{ |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
//跟据管理模式查询预计库存 TEO1
|
|
|
|
public List<ExpectoutDO> selectlocationnew (String itemcode, String packingnumber, String batch, String locationcode, String status ){ |
|
|
|
public List<ExpectoutDO> selectLocatioNew(String itemcode, String packingnumber, String batch, String locationcode, String status) { |
|
|
|
RuleRespVO managementtRule = ruleService.management(null, null, null, null, null, null, itemcode, null, null, |
|
|
|
null, locationcode, null, null); |
|
|
|
List<ExpectoutDO> expectoutDO = null; |
|
|
|
if ("{\"ManagementPrecision\":\"BY_QUANTITY\"}".equals(managementtRule.getConfiguration())) { |
|
|
|
expectoutDO = selectnumbernew(itemcode, status, locationcode ); |
|
|
|
|
|
|
|
} |
|
|
|
else if("{\"ManagementPrecision\":\"BY_BATCH\"}".equals(managementtRule.getConfiguration())){ |
|
|
|
expectoutDO = selectbatchnew(itemcode,batch,status,locationcode); |
|
|
|
|
|
|
|
} |
|
|
|
expectoutDO = expectoutService.selectNumberNew(itemcode, status, locationcode); |
|
|
|
} else if ("{\"ManagementPrecision\":\"BY_BATCH\"}".equals(managementtRule.getConfiguration())) { |
|
|
|
expectoutDO = expectoutService.selectBatchNew(itemcode, batch, status, locationcode); |
|
|
|
|
|
|
|
else if("{\"ManagementPrecision\":\"BY_PACKAGING\"}".equals(managementtRule.getConfiguration())) { |
|
|
|
expectoutDO = selectpackingnew(itemcode,packingnumber, batch, status, locationcode); |
|
|
|
} else if ("{\"ManagementPrecision\":\"BY_PACKAGING\"}".equals(managementtRule.getConfiguration())) { |
|
|
|
expectoutDO = expectoutService.selectPackingNew(itemcode, packingnumber, batch, status, locationcode); |
|
|
|
} else if ("{\"ManagementPrecision\":\"BY_UNIQUE_ID\"}".equals(managementtRule.getConfiguration())) { |
|
|
|
expectoutDO = expectoutService.selectUniqeIdNew(packingnumber, locationcode, status); |
|
|
|
} |
|
|
|
|
|
|
|
else if("{\"ManagementPrecision\":\"BY_UNIQUE_ID\"}".equals(managementtRule.getConfiguration())) { |
|
|
|
expectoutDO = selectuniqeidnew(packingnumber, locationcode,status); |
|
|
|
} |
|
|
|
|
|
|
|
return expectoutDO; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//查询可用库存 TB3
|
|
|
|
|
|
|
|
public BigDecimal CountLocaltion(String itemcode, String packingnumber, String batch, String locationcode, String status) { |
|
|
|
List<ExpectoutDO> expectoutDO = selectlocationnew(itemcode,packingnumber,batch,locationcode,status); |
|
|
|
List<ExpectoutDO> expectoutDO = selectLocatioNew(itemcode, packingnumber, batch, locationcode, status); |
|
|
|
List<BalanceDO> balanceDO = selectlocation(itemcode, packingnumber, batch, locationcode, status); |
|
|
|
|
|
|
|
//double sum = expectoutDO.stream().mapToDouble(ExpectoutDO::getQty).sum();
|
|
|
|
BigDecimal esum = BigDecimal.valueOf(expectoutDO.stream().mapToDouble(expectoutDO1 -> expectoutDO1.getQty().doubleValue()).sum()); |
|
|
|
BigDecimal bsum = BigDecimal.valueOf(balanceDO.stream().mapToDouble(balanceDO1 -> balanceDO1.getQty().doubleValue()).sum()); |
|
|
|
BigDecimal sum = bsum.subtract(esum); |
|
|
|
return sum; |
|
|
|
} |
|
|
|
//有无库存效验
|
|
|
|
|
|
|
|
//有无库存效验
|
|
|
|
public String LocaltionExist(String itemcode, String packingnumber, String batch, String locationcode, String status, BigDecimal requstqty) { |
|
|
|
BigDecimal enableqty = CountLocaltion(itemcode, packingnumber, batch, locationcode, status); |
|
|
|
if (requstqty.compareTo(enableqty) > 0) { |
|
|
|
throw exception(new ErrorCode(1256, "请求数量" + requstqty + "大于库存数量" + enableqty)); |
|
|
|
} |
|
|
|
else{ |
|
|
|
} else { |
|
|
|
return "成功"; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//查询储存容量
|
|
|
|
|
|
|
|
public String selectlocationstrategy(String itemcode, String locationcode) { |
|
|
|
RuleRespVO storagecapacityrule = ruleService.storageCapacity(null, null, itemcode, null, null, null, locationcode); |
|
|
|
String[] StorageQty = storagecapacityrule.getConfiguration().split(","); |
|
|
@ -522,26 +413,21 @@ public class JobUtils { |
|
|
|
return "不可以存放"; |
|
|
|
} |
|
|
|
return "可以存放"; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//库存不应该存在
|
|
|
|
public List<BalanceDO> locationNoExist(String itemcode, String packingnumber, String locationcode, String inventorystatus) { |
|
|
|
RuleRespVO managementtRule = ruleService.management(null, null, null, null, null, null, itemcode, null, null, |
|
|
|
null, locationcode, null, null); |
|
|
|
List<BalanceDO> balanceDO = null; |
|
|
|
if ("{\"ManagementPrecision\":\"BY_UNIQUE_ID\"}".equals(managementtRule.getConfiguration())) { |
|
|
|
balanceDO = selectuniqueid(packingnumber, locationcode,inventorystatus); |
|
|
|
balanceDO = balanceService.selectUniqueId(packingnumber, locationcode, inventorystatus); |
|
|
|
return balanceDO; |
|
|
|
|
|
|
|
} |
|
|
|
else{ |
|
|
|
} else { |
|
|
|
throw exception(new ErrorCode(1256, "校验通过")); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//查询库位BQ-QL
|
|
|
|
public String selectlocation(String code) { |
|
|
|
QueryWrapper queryWrapper = new QueryWrapper(); |
|
|
@ -549,21 +435,11 @@ public class JobUtils { |
|
|
|
LocationDO locationDO = locationMapper.selectOne(queryWrapper); |
|
|
|
if (locationDO == null && "TRUE".equals(locationDO.getAvailable())) { |
|
|
|
return "TURE"; |
|
|
|
} |
|
|
|
else{ |
|
|
|
} else { |
|
|
|
return "FALSE"; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//从库位未被其他任务占用,有可用库存
|
|
|
|
public String locationExistnew(String itemcode, String packingnumber, String batch, String fromlocationcode, String status, BigDecimal requstqty) { |
|
|
|
if (fromlocationcode.isEmpty()) { |
|
|
@ -574,15 +450,8 @@ public class JobUtils { |
|
|
|
|
|
|
|
String END = LocaltionExist(itemcode, packingnumber, batch, fromlocationcode, status, requstqty); |
|
|
|
return END; |
|
|
|
} |
|
|
|
else{ |
|
|
|
} else { |
|
|
|
return "效验通过"; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|