|
|
@ -3,18 +3,52 @@ package com.win.module.wms.until.job; |
|
|
|
import cn.hutool.core.exceptions.UtilException; |
|
|
|
import cn.hutool.json.JSONObject; |
|
|
|
import cn.hutool.json.JSONUtil; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.win.framework.common.exception.ErrorCode; |
|
|
|
import com.win.module.wms.controller.rule.vo.RuleRespVO; |
|
|
|
import com.win.module.wms.dal.dataobject.balance.BalanceDO; |
|
|
|
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.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.itembasic.ItembasicService; |
|
|
|
import com.win.module.wms.service.location.LocationService; |
|
|
|
import com.win.module.wms.service.rule.RuleService; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.commons.lang.StringUtils; |
|
|
|
import org.springframework.stereotype.Component; |
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.List; |
|
|
|
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 { |
|
|
|
|
|
|
|
@Resource |
|
|
|
private ItembasicService itembasicService; |
|
|
|
|
|
|
|
@Resource |
|
|
|
private LocationService locationService; |
|
|
|
|
|
|
|
@Resource |
|
|
|
private LocationMapper locationMapper; |
|
|
|
|
|
|
|
@Resource |
|
|
|
private BalanceMapper balanceMapper; |
|
|
|
|
|
|
|
@Resource |
|
|
|
private ExpectoutMapper expectoutMapper ; |
|
|
|
@Resource |
|
|
|
private RuleService ruleService; |
|
|
|
/** |
|
|
|
* 解析JSON串,返回两个对象的集合 |
|
|
|
* |
|
|
@ -87,5 +121,468 @@ public class JobUtils { |
|
|
|
} |
|
|
|
return result; |
|
|
|
} |
|
|
|
//到库位与任务库位是否一致(可配置)
|
|
|
|
public boolean jobToLocationCodeAndRecordToLocationCodeAccord(String jobToLocationCode, String recordToLocationCode, String allowModifyLocation){ |
|
|
|
if(jobToLocationCode != null || !"".equals(jobToLocationCode)){ |
|
|
|
if(!jobToLocationCode.equals(recordToLocationCode)){ |
|
|
|
if("TRUE".equals(allowModifyLocation)){ |
|
|
|
return true; |
|
|
|
}else { |
|
|
|
throw exception(LOCATION_HANDLE_TOLOCATIONCODE_AND_RECOMMEND_TOLOCATIONCODECODE_INCONFORMITY); |
|
|
|
} |
|
|
|
}else { |
|
|
|
return true; |
|
|
|
} |
|
|
|
}else { |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
//DBT---DBT2---IT 物料类型检验是否一致
|
|
|
|
public boolean ifInType(String pitemCode, BusinesstypeDO businesstypeDO){ |
|
|
|
ItembasicDO itembasicDO = itembasicService.selectItembasic(pitemCode); |
|
|
|
boolean ifInType = false; |
|
|
|
if(itembasicDO != null){ |
|
|
|
String[] itemType = businesstypeDO.getItemTypes().split(","); |
|
|
|
for (int i = 0; i < itemType.length; i++) { |
|
|
|
if(itembasicDO.getType().equals(itemType[i])){ |
|
|
|
ifInType = true; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if(ifInType == true){ |
|
|
|
return true; |
|
|
|
}else{ |
|
|
|
throw exception(ITEMBASIC_TYPE_AND_BUSINESSTYPE_NOT_EQUALS); |
|
|
|
} |
|
|
|
} |
|
|
|
//DBT---DBT2---IS 物料状态检验是否一致
|
|
|
|
public boolean ifInStatus(String pitemCode, BusinesstypeDO businesstypeDO){ |
|
|
|
ItembasicDO itembasicDO = itembasicService.selectItembasic(pitemCode); |
|
|
|
boolean ifInStatus = false; |
|
|
|
if(itembasicDO != null){ |
|
|
|
String[] itemStatus = businesstypeDO.getItemStatuses().split(","); |
|
|
|
for (int i = 0; i < itemStatus.length; i++) { |
|
|
|
if(itembasicDO.getStatus().equals(itemStatus[i])){ |
|
|
|
ifInStatus = true; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if(ifInStatus == true){ |
|
|
|
return true; |
|
|
|
}else { |
|
|
|
throw exception(ITEMBASIC_STATUS_AND_BUSINESSSTATUS_NOT_EQUALS); |
|
|
|
} |
|
|
|
} |
|
|
|
//DBT---DBT2---LI 校验入库库位类型是否一致
|
|
|
|
public boolean ifInFromLocationType(String plocationCode, BusinesstypeDO businesstypeDO){ |
|
|
|
LocationDO locationDO = locationService.selectLocationExist(plocationCode); |
|
|
|
boolean ifInLocationType = false; |
|
|
|
if(locationDO != null){ |
|
|
|
String[] itemInLocationTypes = businesstypeDO.getInLocationTypes().split(","); |
|
|
|
for (int i = 0; i < itemInLocationTypes.length; i++) { |
|
|
|
if(locationDO.getType().equals(itemInLocationTypes[i])){ |
|
|
|
ifInLocationType = true; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if(ifInLocationType == true){ |
|
|
|
return true; |
|
|
|
}else { |
|
|
|
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); |
|
|
|
boolean ifOutLocationType = false; |
|
|
|
if(locationDO != null){ |
|
|
|
String[] itemOutLocationTypes = businesstypeDO.getOutLocationTypes().split(","); |
|
|
|
for (int i = 0; i < itemOutLocationTypes.length; i++) { |
|
|
|
if(locationDO.getType().equals(itemOutLocationTypes[i])){ |
|
|
|
ifOutLocationType = true; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if(ifOutLocationType ==true){ |
|
|
|
return true; |
|
|
|
}else { |
|
|
|
throw exception(TO_LOCATION_TYPE_AND_BUSINESSTYPE_OUTLOCATION_TYPE_NOT_EQUALS); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//DBT---DBT2---ISI 校验入库状态是否一致
|
|
|
|
public boolean ifInInventoryStatuses(String pinventoryStatus, BusinesstypeDO businesstypeDO){ |
|
|
|
boolean ifInInventoryStatuses = false; |
|
|
|
if(pinventoryStatus != null){ |
|
|
|
String[] inventoryStatuses = businesstypeDO.getInInventoryStatuses().split(","); |
|
|
|
for (int i = 0; i < inventoryStatuses.length; i++) { |
|
|
|
if(pinventoryStatus.equals(inventoryStatuses[i])){ |
|
|
|
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; |
|
|
|
if(pinventoryStatus != null){ |
|
|
|
String[] inventoryStatuses = businesstypeDO.getOutInventoryStatuses().split(","); |
|
|
|
for (int i = 0; i < inventoryStatuses.length; i++) { |
|
|
|
if(pinventoryStatus.equals(inventoryStatuses[i])){ |
|
|
|
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 ){ |
|
|
|
RuleRespVO managementtRule = ruleService.management( null, null,null,null,null, null,itemcode,null,null, |
|
|
|
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); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
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 ){ |
|
|
|
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); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else if("{\"ManagementPrecision\":\"BY_PACKAGING\"}".equals(managementtRule.getConfiguration())) { |
|
|
|
expectoutDO = selectpackingnew(itemcode,packingnumber, batch, status, locationcode); |
|
|
|
} |
|
|
|
|
|
|
|
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<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{ |
|
|
|
return "成功"; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//查询储存容量
|
|
|
|
|
|
|
|
public String selectlocationstrategy(String itemcode, String locationcode){ |
|
|
|
RuleRespVO storagecapacityrule = ruleService.storageCapacity(null,null,itemcode,null,null,null,locationcode); |
|
|
|
String[] StorageQty = storagecapacityrule.getConfiguration().split(","); |
|
|
|
String[] StorageQty1 = StorageQty[1].split(":"); |
|
|
|
String StorageQty2 = StorageQty1[1]; |
|
|
|
if("-1".equals(StorageQty2)){ |
|
|
|
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); |
|
|
|
return balanceDO; |
|
|
|
|
|
|
|
} |
|
|
|
else{ |
|
|
|
throw exception(new ErrorCode(1256,"校验通过" )); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
//查询库位BQ-QL
|
|
|
|
public String selectlocation(String code){ |
|
|
|
QueryWrapper queryWrapper = new QueryWrapper(); |
|
|
|
queryWrapper.eq("code",code); |
|
|
|
LocationDO locationDO = locationMapper.selectOne(queryWrapper); |
|
|
|
if(locationDO==null&&"TRUE".equals(locationDO.getAvailable())){ |
|
|
|
return "TURE"; |
|
|
|
} |
|
|
|
else{ |
|
|
|
return "FALSE"; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//从库位未被其他任务占用,有可用库存
|
|
|
|
public String locationExistnew(String itemcode, String packingnumber,String batch,String fromlocationcode,String status,BigDecimal requstqty ){ |
|
|
|
if(fromlocationcode.isEmpty()){ |
|
|
|
return "不需要其他校验"; |
|
|
|
} |
|
|
|
String Yesorno = selectlocation(fromlocationcode); |
|
|
|
if("TURE".equals(Yesorno)){ |
|
|
|
|
|
|
|
String END = LocaltionExist(itemcode,packingnumber,batch,fromlocationcode,status,requstqty); |
|
|
|
return END; |
|
|
|
} |
|
|
|
else{ |
|
|
|
return "效验通过"; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|