|
|
|
@ -131,7 +131,7 @@ public class ProOrderServiceImpl implements IProOrderService {
|
|
|
|
|
// 如果不重复
|
|
|
|
|
if (checkout) {
|
|
|
|
|
|
|
|
|
|
// 如果是白坯订单
|
|
|
|
|
/****白坯订单*****/
|
|
|
|
|
if (splitOrderDTO.getProduct().getProdType().equals("white")){
|
|
|
|
|
|
|
|
|
|
boolean flag = false;
|
|
|
|
@ -181,7 +181,11 @@ public class ProOrderServiceImpl implements IProOrderService {
|
|
|
|
|
proOrderMapper.updateWhiteOrder(proOrder);
|
|
|
|
|
|
|
|
|
|
// 设置工单通用属性
|
|
|
|
|
ProOrderWorkorder proOrderWorkorder = setCommonWorkAttribute(proOrder, splitOrderDTO.getProductDate(), splitOrderDTO.getProdLineCode(), splitOrderDTO.getShiftId(), splitOrderDTO.getRouteCode());
|
|
|
|
|
ProOrderWorkorder proOrderWorkorder = setCommonWorkAttribute(
|
|
|
|
|
proOrder, splitOrderDTO.getProductDate(),
|
|
|
|
|
splitOrderDTO.getProdLineCode(), splitOrderDTO.getShiftId(),
|
|
|
|
|
splitOrderDTO.getRouteCode(),splitOrderDTO.getSortNo()
|
|
|
|
|
);
|
|
|
|
|
// 设置批次表通用信息
|
|
|
|
|
ProOrderWorkorderBatch proOrderWorkorderBatch = setCommonBatchAttribute();
|
|
|
|
|
// 设置工单
|
|
|
|
@ -198,7 +202,7 @@ public class ProOrderServiceImpl implements IProOrderService {
|
|
|
|
|
proOrderWorkorder.setEndFlag(1);
|
|
|
|
|
proOrderWorkorder.setCarNum(splitOrderDTO.getCarNum());
|
|
|
|
|
|
|
|
|
|
// 插入工单
|
|
|
|
|
// 插入工单/**pro_order_workorder**/
|
|
|
|
|
proOrderWorkorderMapper.insertProOrderWorkorder(proOrderWorkorder);
|
|
|
|
|
|
|
|
|
|
setBatch(proOrderWorkorderBatch,splitOrderDTO.getFormFields(),proOrderWorkorder.getWorkorderId(),1L);
|
|
|
|
@ -235,12 +239,16 @@ public class ProOrderServiceImpl implements IProOrderService {
|
|
|
|
|
|
|
|
|
|
return success();
|
|
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
}else {/****成品订单*****/
|
|
|
|
|
// 创建订单对象,并将信息copy进去
|
|
|
|
|
ProOrder proOrder = new ProOrder();
|
|
|
|
|
BeanUtils.copyProperties(splitOrderDTO.getProduct(), proOrder);
|
|
|
|
|
// 设置工单通用属性
|
|
|
|
|
ProOrderWorkorder proOrderWorkorder = setCommonWorkAttribute(proOrder, splitOrderDTO.getProductDate(), splitOrderDTO.getProdLineCode(), splitOrderDTO.getShiftId(), splitOrderDTO.getRouteCode());
|
|
|
|
|
ProOrderWorkorder proOrderWorkorder = setCommonWorkAttribute(
|
|
|
|
|
proOrder, splitOrderDTO.getProductDate(),
|
|
|
|
|
splitOrderDTO.getProdLineCode(), splitOrderDTO.getShiftId(),
|
|
|
|
|
splitOrderDTO.getRouteCode(),splitOrderDTO.getSortNo()
|
|
|
|
|
);
|
|
|
|
|
// 创建批次表通用对象
|
|
|
|
|
ProOrderWorkorderBatch workBatch = setCommonBatchAttribute();
|
|
|
|
|
// code
|
|
|
|
@ -263,12 +271,9 @@ public class ProOrderServiceImpl implements IProOrderService {
|
|
|
|
|
workOrder.setWorkorderCode(proOrder.getOrderCode() + "-" + endCode);
|
|
|
|
|
// 3.设置父工单
|
|
|
|
|
workOrder.setParentOrder(parentOrder.toString());
|
|
|
|
|
// 工单对应车数-白坯订单操作
|
|
|
|
|
// if (proOrder.getProdType().equals("white")) {
|
|
|
|
|
// int everyNum = (int) Math.ceil(proOrder.getQuantity() / proOrder.getCarNum());
|
|
|
|
|
// int carNum = (int) Math.ceil(splitOrderDTO.getSplitNum() / everyNum);
|
|
|
|
|
// workOrder.setCarNum(carNum);
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
workOrder.setSortNo(splitOrderDTO.getSortNo());
|
|
|
|
|
|
|
|
|
|
// 将工单信息更新至数据库
|
|
|
|
|
proOrderWorkorderMapper.insertProOrderWorkorder(workOrder);
|
|
|
|
|
// 生成批次表信息并更新至数据库
|
|
|
|
@ -296,34 +301,6 @@ public class ProOrderServiceImpl implements IProOrderService {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 关闭订单,判断是否拆分完成
|
|
|
|
|
// ProOrder order = proOrderMapper.selectProOrderById(splitOrderDTO.getProduct().getId());
|
|
|
|
|
// Long quantitySplit = order.getQuantitySplit();
|
|
|
|
|
// Long quantity1 = order.getQuantity();
|
|
|
|
|
// if (quantity1.equals(quantitySplit)) {
|
|
|
|
|
// // 需要关闭订单的codeList
|
|
|
|
|
// List<String> orderCodes = new ArrayList<>();
|
|
|
|
|
// // 临时存放code
|
|
|
|
|
// StringBuilder orderCode = new StringBuilder();
|
|
|
|
|
// orderCode.append(order.getOrderCode());
|
|
|
|
|
// while(true) {
|
|
|
|
|
// orderCodes.add(orderCode.toString());
|
|
|
|
|
// String selectOrderCode = proOrderMapper.selectChildProOrderCodeByCode(orderCode.toString());
|
|
|
|
|
// if (selectOrderCode == null) {
|
|
|
|
|
// break;
|
|
|
|
|
// }
|
|
|
|
|
// orderCode.setLength(0);
|
|
|
|
|
// orderCode.append(selectOrderCode);
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// // 关闭订单
|
|
|
|
|
// for (String code : orderCodes) {
|
|
|
|
|
// remoteSapService.sapCloseOrder(code);
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
return success();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -695,6 +672,12 @@ public class ProOrderServiceImpl implements IProOrderService {
|
|
|
|
|
return success(proOrderVO);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@DS("#header.poolName")
|
|
|
|
|
public int getProSortNo(ProOrder proOrder) {
|
|
|
|
|
return proOrderWorkorderMapper.getProSortNo(proOrder);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void getSAPOrderByFactory(String poolName) {
|
|
|
|
|
DynamicDataSourceContextHolder.push(poolName);// 这是数据源的key
|
|
|
|
|
// SapProOrder sapqo = new SapProOrder();//proOrderMapper.getMaxCreatetime();
|
|
|
|
@ -845,7 +828,7 @@ public class ProOrderServiceImpl implements IProOrderService {
|
|
|
|
|
* @param proOrder
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
private ProOrderWorkorder setCommonWorkAttribute(ProOrder proOrder, Date date, String proLineCode, String shiftId, String routeCode) {
|
|
|
|
|
private ProOrderWorkorder setCommonWorkAttribute(ProOrder proOrder, Date date, String proLineCode, String shiftId, String routeCode, Integer orderNum) {
|
|
|
|
|
ProOrderWorkorder proOrderWorkorder = new ProOrderWorkorder();
|
|
|
|
|
// 更新者
|
|
|
|
|
proOrderWorkorder.setUpdateBy(SecurityContextHolder.getUserName());
|
|
|
|
@ -865,6 +848,8 @@ public class ProOrderServiceImpl implements IProOrderService {
|
|
|
|
|
proOrderWorkorder.setProductSpc(proOrder.getProdSpc());
|
|
|
|
|
// 产线
|
|
|
|
|
proOrderWorkorder.setProdLineCode(proLineCode);
|
|
|
|
|
// 产线
|
|
|
|
|
proOrderWorkorder.setOrderNum(orderNum);
|
|
|
|
|
// 班次
|
|
|
|
|
proOrderWorkorder.setShiftId(shiftId);
|
|
|
|
|
// TODO 产品类型(pro_type)
|
|
|
|
@ -915,6 +900,7 @@ public class ProOrderServiceImpl implements IProOrderService {
|
|
|
|
|
proOrderWorkorder.setQuantitySplit(Long.valueOf(proOrder.getAtrr1()));
|
|
|
|
|
// 设置工单产品类型
|
|
|
|
|
proOrderWorkorder.setProdType(proOrder.getOrderType());
|
|
|
|
|
|
|
|
|
|
return proOrderWorkorder;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|