diff --git a/op-modules/op-plan/src/main/java/com/op/plan/domain/ProOrderWorkorder.java b/op-modules/op-plan/src/main/java/com/op/plan/domain/ProOrderWorkorder.java index f3f03736..7590c4cc 100644 --- a/op-modules/op-plan/src/main/java/com/op/plan/domain/ProOrderWorkorder.java +++ b/op-modules/op-plan/src/main/java/com/op/plan/domain/ProOrderWorkorder.java @@ -117,7 +117,7 @@ public class ProOrderWorkorder extends TreeEntity { /** 单据状态 */ @Excel(name = "工单状态",readConverterExp = "w0=未派发,w1=排队,w2=活动,w3=报工") private String status; - + private String statusArray; /** 预留字段1 */ private String attr1; @@ -401,6 +401,14 @@ public class ProOrderWorkorder extends TreeEntity { this.ancestors = ancestors; } + public String getStatusArray() { + return statusArray; + } + + public void setStatusArray(String statusArray) { + this.statusArray = statusArray; + } + public String getAncestors() { return ancestors; } diff --git a/op-modules/op-plan/src/main/java/com/op/plan/mapper/ProOrderMapper.java b/op-modules/op-plan/src/main/java/com/op/plan/mapper/ProOrderMapper.java index 15ec6c88..1beef56b 100644 --- a/op-modules/op-plan/src/main/java/com/op/plan/mapper/ProOrderMapper.java +++ b/op-modules/op-plan/src/main/java/com/op/plan/mapper/ProOrderMapper.java @@ -191,4 +191,6 @@ public interface ProOrderMapper { List getRouteProcessEquips(@Param("list") List level); @MapKey("value") Map getEquipInfoByCodes(String equipCodes); + + ProOrder getMaxPlanDate(); } diff --git a/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProOrderServiceImpl.java b/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProOrderServiceImpl.java index f19bdd3c..b6e16482 100644 --- a/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProOrderServiceImpl.java +++ b/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProOrderServiceImpl.java @@ -325,13 +325,14 @@ public class ProOrderServiceImpl implements IProOrderService { @DS("#header.poolName") public AjaxResult syncSAP() { SapProOrder sapqo = new SapProOrder(); - sapqo.setCreateTime(DateUtils.getNowDate()); + sapqo.setCreateTime(DateUtils.addDays(DateUtils.getNowDate(),-4)); //获取当前所选工厂 HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); String key = "#header.poolName"; sapqo.setFactoryCode(request.getHeader(key.substring(8)).replace("ds_","")); - R> rSapProOrder = remoteSapService.shopOrderSync(sapqo); + R> rSapProOrder = remoteSapService.shopOrderSync(sapqo);//sap只能同步指定日期的数据 + List newOrders = rSapProOrder.getData(); if(CollectionUtils.isEmpty(newOrders)){ return AjaxResult.error("无"+sapqo.getCreateTime()+"之后的最新订单"); @@ -357,12 +358,12 @@ public class ProOrderServiceImpl implements IProOrderService { //proOrder.setCreateTime(nowDate); proOrder.setCreateBy(SecurityUtils.getUsername()); proOrderMapper.insertProOrder(proOrder); - } else {//存在,如果没下发,更新,否则不允许更新,关闭订单 + } else {//存在,如果没活动更新,否则不允许更新,关闭订单 proOrder.setId(orderExit.getId()); proOrder.setQuantitySplit(0L); ProOrderWorkorder owork = new ProOrderWorkorder(); owork.setOrderCode(proOrder.getOrderCode()); - owork.setStatus("w1"); + owork.setStatusArray("'w2','w3','w4'");//已派发w1未派w0活动w2报工w3暂停w4 List workOrders = proOrderWorkorderMapper.selectProOrderWorkorderList(owork); if (CollectionUtils.isEmpty(workOrders)) {//更新 proOrder.setUpdateTime(nowDate); @@ -378,9 +379,10 @@ public class ProOrderServiceImpl implements IProOrderService { //删除工单pro_order_workorder proOrderWorkorderMapper.deleteProOrderWorkorderByWorkorderIds(ids); } - } else {//关闭订单 - remoteSapService.sapCloseOrder(proOrder.getOrderCode()); } +// else {//关闭订单 +// remoteSapService.sapCloseOrder(proOrder.getOrderCode()); +// } } } } diff --git a/op-modules/op-plan/src/main/resources/mapper/plan/ProOrderMapper.xml b/op-modules/op-plan/src/main/resources/mapper/plan/ProOrderMapper.xml index b9ced4b7..9561ede1 100644 --- a/op-modules/op-plan/src/main/resources/mapper/plan/ProOrderMapper.xml +++ b/op-modules/op-plan/src/main/resources/mapper/plan/ProOrderMapper.xml @@ -170,8 +170,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select equipment_code value,equipment_name label from base_equipment where equipment_code in ('${equipCodes}') + - + insert into pro_order id, @@ -199,6 +203,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" prod_type, prod_spc, car_num, + sync_time, #{id}, @@ -226,6 +231,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{prodType}, #{prodSpc}, #{carNum}, + sync_time = GETDATE(), diff --git a/op-modules/op-plan/src/main/resources/mapper/plan/ProOrderWorkorderMapper.xml b/op-modules/op-plan/src/main/resources/mapper/plan/ProOrderWorkorderMapper.xml index c13a63b8..659d48f2 100644 --- a/op-modules/op-plan/src/main/resources/mapper/plan/ProOrderWorkorderMapper.xml +++ b/op-modules/op-plan/src/main/resources/mapper/plan/ProOrderWorkorderMapper.xml @@ -68,6 +68,7 @@ and parent_order = #{parentOrder} and ancestors = #{ancestors} and status = #{status} + and status in (${statusArray}) and attr1 = #{attr1} and attr2 = #{attr2} and attr3 = #{attr3}