|
@ -9,6 +9,8 @@ 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.balance.BalanceDO; |
|
|
import com.win.module.wms.dal.dataobject.bom.BomDO; |
|
|
import com.win.module.wms.dal.dataobject.bom.BomDO; |
|
|
import com.win.module.wms.dal.dataobject.businesstype.BusinesstypeDO; |
|
|
import com.win.module.wms.dal.dataobject.businesstype.BusinesstypeDO; |
|
|
|
|
|
import com.win.module.wms.dal.dataobject.deliverPlan.DeliverPlanDetailDO; |
|
|
|
|
|
import com.win.module.wms.dal.dataobject.deliverPlan.DeliverPlanMainDO; |
|
|
import com.win.module.wms.dal.dataobject.documentsetting.DocumentsettingDO; |
|
|
import com.win.module.wms.dal.dataobject.documentsetting.DocumentsettingDO; |
|
|
import com.win.module.wms.dal.dataobject.expectout.ExpectoutDO; |
|
|
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.itembasic.ItembasicDO; |
|
@ -16,6 +18,8 @@ import com.win.module.wms.dal.dataobject.location.LocationDO; |
|
|
import com.win.module.wms.dal.dataobject.supplier.SupplierDO; |
|
|
import com.win.module.wms.dal.dataobject.supplier.SupplierDO; |
|
|
import com.win.module.wms.dal.dataobject.transactiontype.TransactiontypeDO; |
|
|
import com.win.module.wms.dal.dataobject.transactiontype.TransactiontypeDO; |
|
|
import com.win.module.wms.dal.mysql.balance.BalanceMapper; |
|
|
import com.win.module.wms.dal.mysql.balance.BalanceMapper; |
|
|
|
|
|
import com.win.module.wms.dal.mysql.deliverPlan.DeliverPlanDetailMapper; |
|
|
|
|
|
import com.win.module.wms.dal.mysql.deliverPlan.DeliverPlanMainMapper; |
|
|
import com.win.module.wms.dal.mysql.expectout.ExpectoutMapper; |
|
|
import com.win.module.wms.dal.mysql.expectout.ExpectoutMapper; |
|
|
import com.win.module.wms.dal.mysql.location.LocationMapper; |
|
|
import com.win.module.wms.dal.mysql.location.LocationMapper; |
|
|
import com.win.module.wms.service.balance.BalanceService; |
|
|
import com.win.module.wms.service.balance.BalanceService; |
|
@ -80,7 +84,11 @@ public class JobUtils { |
|
|
@Resource |
|
|
@Resource |
|
|
private TransactiontypeService transactiontypeService; |
|
|
private TransactiontypeService transactiontypeService; |
|
|
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
|
private DeliverPlanMainMapper deliverPlanMainMapper; |
|
|
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
|
private DeliverPlanDetailMapper deliverPlanDetailMapper; |
|
|
/** |
|
|
/** |
|
|
* 解析JSON串,返回两个对象的集合 |
|
|
* 解析JSON串,返回两个对象的集合 |
|
|
* |
|
|
* |
|
@ -182,6 +190,67 @@ public class JobUtils { |
|
|
return result; |
|
|
return result; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 更新发货计划的已发货数量 |
|
|
|
|
|
* |
|
|
|
|
|
* @param pnumber |
|
|
|
|
|
* @param pitemCode |
|
|
|
|
|
* @param pshippedQty |
|
|
|
|
|
*/ |
|
|
|
|
|
public void updatePlanDeliveShippedQty(String pnumber, String pitemCode, BigDecimal pshippedQty) { |
|
|
|
|
|
QueryWrapper<DeliverPlanMainDO> mainDOQueryWrapper = new QueryWrapper<>(); |
|
|
|
|
|
DeliverPlanDetailDO deliverPlanDetailDO; |
|
|
|
|
|
mainDOQueryWrapper.eq("number", pnumber); |
|
|
|
|
|
mainDOQueryWrapper.eq("status", "6"); |
|
|
|
|
|
DeliverPlanMainDO deliverPlanMainDO = deliverPlanMainMapper.selectOne(mainDOQueryWrapper); |
|
|
|
|
|
if (deliverPlanMainDO != null) { |
|
|
|
|
|
QueryWrapper<DeliverPlanDetailDO> detailDOQueryWrapper = new QueryWrapper<>(); |
|
|
|
|
|
detailDOQueryWrapper.eq("number", pnumber); |
|
|
|
|
|
detailDOQueryWrapper.eq("item_code", pitemCode); |
|
|
|
|
|
detailDOQueryWrapper.eq("available", "TRUE"); |
|
|
|
|
|
deliverPlanDetailDO = deliverPlanDetailMapper.selectOne(detailDOQueryWrapper); |
|
|
|
|
|
BigDecimal shippedQty = deliverPlanDetailDO.getShippedQty(); |
|
|
|
|
|
// 如果已发货数量=计划数量,更新计划明细状态为(开放 => 关闭)
|
|
|
|
|
|
deliverPlanDetailDO.setShippedQty(shippedQty.add(pshippedQty)); |
|
|
|
|
|
if (deliverPlanDetailDO.getPlanQty() == deliverPlanDetailDO.getShippedQty()) { |
|
|
|
|
|
deliverPlanDetailDO.setAvailable("FALSE"); |
|
|
|
|
|
} |
|
|
|
|
|
// 如果全部明细状态为(关闭),更新计划状态为(已接受 => 完成)
|
|
|
|
|
|
QueryWrapper<DeliverPlanDetailDO> queryWrapper = new QueryWrapper<>(); |
|
|
|
|
|
queryWrapper.eq("master_id", deliverPlanMainDO.getId()); |
|
|
|
|
|
List<DeliverPlanDetailDO> deliverPlanDetailDOS = deliverPlanDetailMapper.selectList(queryWrapper); |
|
|
|
|
|
int size = deliverPlanDetailDOS.size(); |
|
|
|
|
|
int count = 0; |
|
|
|
|
|
for (DeliverPlanDetailDO planDetailDO : deliverPlanDetailDOS) { |
|
|
|
|
|
if ("FALSE".equals(planDetailDO.getAvailable())) { |
|
|
|
|
|
count++; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
if (count == size) { |
|
|
|
|
|
deliverPlanMainDO.setStatus("7"); |
|
|
|
|
|
deliverPlanMainMapper.updateById(deliverPlanMainDO); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
ifDetailAllFinish(deliverPlanMainDO); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//判断如果主表下子表状态全为FALSE 则修改计划状态为完成
|
|
|
|
|
|
private void ifDetailAllFinish(DeliverPlanMainDO deliverPlanMainDO) { |
|
|
|
|
|
QueryWrapper<DeliverPlanDetailDO> detailDOQueryWrapper = new QueryWrapper<>(); |
|
|
|
|
|
detailDOQueryWrapper.eq("master_id", deliverPlanMainDO.getId()); |
|
|
|
|
|
List<DeliverPlanDetailDO> deliverPlanDetailDOS = deliverPlanDetailMapper.selectList(detailDOQueryWrapper); |
|
|
|
|
|
Integer count = 0; |
|
|
|
|
|
for (DeliverPlanDetailDO deliverPlanDetailDO : deliverPlanDetailDOS) { |
|
|
|
|
|
if ("TRUE".equals(deliverPlanDetailDO.getAvailable())) { |
|
|
|
|
|
count++; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
if (count <= 0) { |
|
|
|
|
|
deliverPlanMainDO.setStatus("7"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 校验物料有效,状态正确 |
|
|
* 校验物料有效,状态正确 |
|
|
* |
|
|
* |
|
@ -788,15 +857,15 @@ public class JobUtils { |
|
|
} |
|
|
} |
|
|
// 根据下架策略 作为查询库存余额分组
|
|
|
// 根据下架策略 作为查询库存余额分组
|
|
|
// 发料包装类型——按 包装
|
|
|
// 发料包装类型——按 包装
|
|
|
if (jsonObjectOffShelf.get("IssueStorageType") != null && jsonObjectOffShelf.get("IssueStorageType").equals("1")) { |
|
|
if (jsonObjectOffShelf.get("IssueStorageType") != null && jsonObjectOffShelf.get("IssueStorageType").equals("PACKAGE")) { |
|
|
queryWrapper.groupBy("packing_number"); |
|
|
queryWrapper.groupBy("packing_number"); |
|
|
} |
|
|
} |
|
|
// 发料包装类型——按 容器
|
|
|
// 发料包装类型——按 容器
|
|
|
if (jsonObjectOffShelf.get("IssueStorageType") != null && jsonObjectOffShelf.get("IssueStorageType").equals("2")) { |
|
|
if (jsonObjectOffShelf.get("IssueStorageType") != null && jsonObjectOffShelf.get("IssueStorageType").equals("CONTAINER")) { |
|
|
queryWrapper.groupBy("container_number"); |
|
|
queryWrapper.groupBy("container_number"); |
|
|
} |
|
|
} |
|
|
// 发料包装类型——按 单件
|
|
|
// 发料包装类型——按 单件
|
|
|
if (jsonObjectOffShelf.get("IssueStorageType") != null && jsonObjectOffShelf.get("IssueStorageType").equals("3")) { |
|
|
if (jsonObjectOffShelf.get("IssueStorageType") != null && jsonObjectOffShelf.get("IssueStorageType").equals("SINGLE")) { |
|
|
queryWrapper.groupBy("item_code", "batch", "qty","inventory_status", "warehouse_code", "area_code", "location_group_code", "location_code", "expire_date", "produce_date", "arrive_date"); |
|
|
queryWrapper.groupBy("item_code", "batch", "qty","inventory_status", "warehouse_code", "area_code", "location_group_code", "location_code", "expire_date", "produce_date", "arrive_date"); |
|
|
} |
|
|
} |
|
|
// 根据批次策略 作为查询库存余额排序
|
|
|
// 根据批次策略 作为查询库存余额排序
|
|
|