|
|
@ -325,13 +325,14 @@ public class ProOrderServiceImpl implements IProOrderService {
|
|
|
|
@DS("#header.poolName")
|
|
|
|
@DS("#header.poolName")
|
|
|
|
public AjaxResult syncSAP() {
|
|
|
|
public AjaxResult syncSAP() {
|
|
|
|
SapProOrder sapqo = new SapProOrder();
|
|
|
|
SapProOrder sapqo = new SapProOrder();
|
|
|
|
sapqo.setCreateTime(DateUtils.getNowDate());
|
|
|
|
sapqo.setCreateTime(DateUtils.addDays(DateUtils.getNowDate(),-4));
|
|
|
|
//获取当前所选工厂
|
|
|
|
//获取当前所选工厂
|
|
|
|
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
|
|
|
|
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
|
|
|
|
String key = "#header.poolName";
|
|
|
|
String key = "#header.poolName";
|
|
|
|
sapqo.setFactoryCode(request.getHeader(key.substring(8)).replace("ds_",""));
|
|
|
|
sapqo.setFactoryCode(request.getHeader(key.substring(8)).replace("ds_",""));
|
|
|
|
|
|
|
|
|
|
|
|
R<List<SapProOrder>> rSapProOrder = remoteSapService.shopOrderSync(sapqo);
|
|
|
|
R<List<SapProOrder>> rSapProOrder = remoteSapService.shopOrderSync(sapqo);//sap只能同步指定日期的数据
|
|
|
|
|
|
|
|
|
|
|
|
List<SapProOrder> newOrders = rSapProOrder.getData();
|
|
|
|
List<SapProOrder> newOrders = rSapProOrder.getData();
|
|
|
|
if(CollectionUtils.isEmpty(newOrders)){
|
|
|
|
if(CollectionUtils.isEmpty(newOrders)){
|
|
|
|
return AjaxResult.error("无"+sapqo.getCreateTime()+"之后的最新订单");
|
|
|
|
return AjaxResult.error("无"+sapqo.getCreateTime()+"之后的最新订单");
|
|
|
@ -357,12 +358,12 @@ public class ProOrderServiceImpl implements IProOrderService {
|
|
|
|
//proOrder.setCreateTime(nowDate);
|
|
|
|
//proOrder.setCreateTime(nowDate);
|
|
|
|
proOrder.setCreateBy(SecurityUtils.getUsername());
|
|
|
|
proOrder.setCreateBy(SecurityUtils.getUsername());
|
|
|
|
proOrderMapper.insertProOrder(proOrder);
|
|
|
|
proOrderMapper.insertProOrder(proOrder);
|
|
|
|
} else {//存在,如果没下发,更新,否则不允许更新,关闭订单
|
|
|
|
} else {//存在,如果没活动更新,否则不允许更新,关闭订单
|
|
|
|
proOrder.setId(orderExit.getId());
|
|
|
|
proOrder.setId(orderExit.getId());
|
|
|
|
proOrder.setQuantitySplit(0L);
|
|
|
|
proOrder.setQuantitySplit(0L);
|
|
|
|
ProOrderWorkorder owork = new ProOrderWorkorder();
|
|
|
|
ProOrderWorkorder owork = new ProOrderWorkorder();
|
|
|
|
owork.setOrderCode(proOrder.getOrderCode());
|
|
|
|
owork.setOrderCode(proOrder.getOrderCode());
|
|
|
|
owork.setStatus("w1");
|
|
|
|
owork.setStatusArray("'w2','w3','w4'");//已派发w1未派w0活动w2报工w3暂停w4
|
|
|
|
List<ProOrderWorkorder> workOrders = proOrderWorkorderMapper.selectProOrderWorkorderList(owork);
|
|
|
|
List<ProOrderWorkorder> workOrders = proOrderWorkorderMapper.selectProOrderWorkorderList(owork);
|
|
|
|
if (CollectionUtils.isEmpty(workOrders)) {//更新
|
|
|
|
if (CollectionUtils.isEmpty(workOrders)) {//更新
|
|
|
|
proOrder.setUpdateTime(nowDate);
|
|
|
|
proOrder.setUpdateTime(nowDate);
|
|
|
@ -378,9 +379,10 @@ public class ProOrderServiceImpl implements IProOrderService {
|
|
|
|
//删除工单pro_order_workorder
|
|
|
|
//删除工单pro_order_workorder
|
|
|
|
proOrderWorkorderMapper.deleteProOrderWorkorderByWorkorderIds(ids);
|
|
|
|
proOrderWorkorderMapper.deleteProOrderWorkorderByWorkorderIds(ids);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {//关闭订单
|
|
|
|
|
|
|
|
remoteSapService.sapCloseOrder(proOrder.getOrderCode());
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// else {//关闭订单
|
|
|
|
|
|
|
|
// remoteSapService.sapCloseOrder(proOrder.getOrderCode());
|
|
|
|
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|