|
|
|
@ -416,6 +416,99 @@ public class ProOrderServiceImpl implements IProOrderService {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**辅助排产结果查看**/
|
|
|
|
|
@Override
|
|
|
|
|
@DS("#header.poolName")
|
|
|
|
|
public AjaxResult getWorkOrderListCG(String id) {
|
|
|
|
|
// 通过订单id查询所有母工单信息list
|
|
|
|
|
List<ProOrderWorkorder> proOrderWorkorderList = proOrderWorkorderMapper.selectFirWorkOrderCG(id);
|
|
|
|
|
|
|
|
|
|
for (ProOrderWorkorder proOrderWorkorder : proOrderWorkorderList) {
|
|
|
|
|
formatProOrderWorkorderCG(proOrderWorkorder);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return success(proOrderWorkorderList);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@DS("#header.poolName")
|
|
|
|
|
public R autoSplitOrderCancel(ProOrder proOrder) {
|
|
|
|
|
ProOrder order = proOrder;
|
|
|
|
|
/**pro_order_workorder_batch**/
|
|
|
|
|
int n = proOrderMapper.deleteAutoSplitWorkBatch(proOrder.getOrderCode());
|
|
|
|
|
logger.info("n:"+n);
|
|
|
|
|
|
|
|
|
|
/**pro_order_workorder**/
|
|
|
|
|
int m = proOrderMapper.deleteAutoSplitWork(proOrder.getOrderCode());
|
|
|
|
|
logger.info("m:"+m);
|
|
|
|
|
|
|
|
|
|
return R.ok();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@DS("#header.poolName")
|
|
|
|
|
public R autoSplitOrderOk(ProOrder proOrder) {
|
|
|
|
|
ProOrder order = proOrder;
|
|
|
|
|
/**pro_order_workorder_batch**/
|
|
|
|
|
int n = proOrderMapper.updateAutoSplitWorkBatch(proOrder.getOrderCode());
|
|
|
|
|
logger.info("n:"+n);
|
|
|
|
|
|
|
|
|
|
/**pro_order_workorder**/
|
|
|
|
|
int m = proOrderMapper.updateAutoSplitWork(proOrder.getOrderCode());
|
|
|
|
|
logger.info("m:"+m);
|
|
|
|
|
|
|
|
|
|
/**pro_order**/
|
|
|
|
|
int s = proOrderMapper.updateAutoSplitOrder(proOrder.getOrderCode());
|
|
|
|
|
logger.info("s:"+s);
|
|
|
|
|
return R.ok();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 格式化工单信息(递归处理)
|
|
|
|
|
*
|
|
|
|
|
* @param proOrderWorkorder
|
|
|
|
|
*/
|
|
|
|
|
private void formatProOrderWorkorderCG(ProOrderWorkorder proOrderWorkorder) {
|
|
|
|
|
|
|
|
|
|
StringBuilder prodLineName = new StringBuilder("");
|
|
|
|
|
StringBuilder equipCods = new StringBuilder("'");
|
|
|
|
|
JSONArray codeArray = JSONArray.parseArray(proOrderWorkorder.getProdLineCode());
|
|
|
|
|
for(int c=0;c<codeArray.size();c++){
|
|
|
|
|
equipCods.append(codeArray.getJSONArray(c).getString(1));
|
|
|
|
|
equipCods.append("','");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Map<String,CascaderDTO> equipMap = proOrderMapper.getEquipInfoByCodes(equipCods.substring(1));//设备字典
|
|
|
|
|
for (int c = 0; c < codeArray.size(); c++) {
|
|
|
|
|
String equipCode = codeArray.getJSONArray(c).getString(1);
|
|
|
|
|
prodLineName.append(equipMap.get(equipCode).getLabel() + ",");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
proOrderWorkorder.setProdLineCode(prodLineName.toString());
|
|
|
|
|
|
|
|
|
|
// 通过工单id查询批次号
|
|
|
|
|
List<ProOrderWorkorderBatch> batchCodeList = proOrderMapper.selectBatchCodesByIdCG(proOrderWorkorder.getWorkorderId());
|
|
|
|
|
List<StringBuilder> batchCodes = new ArrayList<>();
|
|
|
|
|
List<StringBuilder> batchNums = new ArrayList<>();
|
|
|
|
|
// 格式化数据
|
|
|
|
|
for (ProOrderWorkorderBatch batchCode : batchCodeList) {
|
|
|
|
|
batchCodes.add(new StringBuilder(batchCode.getBatchCode()).append(";"));
|
|
|
|
|
batchNums.add(new StringBuilder(batchCode.getBatchQuantity()+"").append(";"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
proOrderWorkorder.setBatchCodeList(batchCodes);
|
|
|
|
|
proOrderWorkorder.setBatchNumList(batchNums);
|
|
|
|
|
|
|
|
|
|
// 通过母工单workorder_id查询子工单
|
|
|
|
|
List<ProOrderWorkorder> childWorkorders = proOrderWorkorderMapper.selectChildWorkOrderCG(proOrderWorkorder.getWorkorderCode());
|
|
|
|
|
if (!childWorkorders.isEmpty()) {
|
|
|
|
|
for (ProOrderWorkorder childWorkorder : childWorkorders) {
|
|
|
|
|
formatProOrderWorkorderCG(childWorkorder); // 递归处理子工单
|
|
|
|
|
}
|
|
|
|
|
proOrderWorkorder.setChildren(childWorkorders); // 设置子工单列表
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取当前订单信息列表
|
|
|
|
|
*
|
|
|
|
@ -1235,98 +1328,135 @@ public class ProOrderServiceImpl implements IProOrderService {
|
|
|
|
|
@DS("#header.poolName")
|
|
|
|
|
public R autoSplitOrder(ProOrder proOrder) {
|
|
|
|
|
|
|
|
|
|
// Date nowTime = DateUtils.getNowDate();//公共时间
|
|
|
|
|
// HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
|
|
|
|
|
// String key = "#header.poolName";
|
|
|
|
|
// proOrder.setFactoryCode(request.getHeader(key.substring(8)).replace("ds_",""));
|
|
|
|
|
// proOrder.setCreateTime(nowTime);
|
|
|
|
|
// //订单总量
|
|
|
|
|
// Long orderQua = proOrder.getQuantity();
|
|
|
|
|
// //有几个设备就有几个工单
|
|
|
|
|
// for(int i=0;i<proOrder.getLineCodes().length;i++){
|
|
|
|
|
//
|
|
|
|
|
// List<ProOrderWorkorder> workorders = new ArrayList<>();
|
|
|
|
|
// List<ProOrderWorkorderBatch> workorderBatches = new ArrayList<>();
|
|
|
|
|
//
|
|
|
|
|
// proOrder.setLineCode(proOrder.getLineCodes()[i]);
|
|
|
|
|
// Long efficiency = proOrderWorkorderMapper.getLineProductInfo(proOrder);//线体产能
|
|
|
|
|
// if(efficiency==null){
|
|
|
|
|
// break;
|
|
|
|
|
// logger.error("线体"+proOrder.getLineCodes()[i]+"产能"+efficiency+"无法生产");
|
|
|
|
|
// }
|
|
|
|
|
// if(efficiency < orderQua){
|
|
|
|
|
// proOrder.setQuantitySplit(efficiency);
|
|
|
|
|
// }else{
|
|
|
|
|
// proOrder.setQuantitySplit(orderQua);
|
|
|
|
|
// }
|
|
|
|
|
// orderQua = orderQua - efficiency;//消耗订单总数量
|
|
|
|
|
// List<ProOrder> sonOrders = (List<ProOrder>)proOrder.getChildren();
|
|
|
|
|
// if(CollectionUtils.isEmpty(sonOrders)){//1层订单
|
|
|
|
|
// proOrder.setEndFlag(1);
|
|
|
|
|
// }
|
|
|
|
|
// int endCode = getEndCode(proOrder.getId());
|
|
|
|
|
// String belongWorkOrder = proOrder.getOrderCode()+"-"+endCode;
|
|
|
|
|
// proOrder.setBelongWorkOrder(belongWorkOrder);
|
|
|
|
|
// proOrder.setWorkerOrder(belongWorkOrder);
|
|
|
|
|
// proOrder.setParentOrder("0");
|
|
|
|
|
// ProOrderWorkorder pworkOrder = getWorkOrderByOrder(proOrder);//TODO;
|
|
|
|
|
// //父级
|
|
|
|
|
// workorders.add(pworkOrder);
|
|
|
|
|
//
|
|
|
|
|
// /**pro_order_workorder_batch**/
|
|
|
|
|
// String parentWorkOrder = belongWorkOrder;
|
|
|
|
|
// while(!CollectionUtils.isEmpty(sonOrders)){
|
|
|
|
|
// ProOrder sonOrder = sonOrders.get(0);
|
|
|
|
|
// sonOrder.setBelongWorkOrder(belongWorkOrder);
|
|
|
|
|
// endCode = getEndCode(proOrder.getId());
|
|
|
|
|
// String sworkOrderCode = sonOrder.getOrderCode()+"-"+endCode;
|
|
|
|
|
// sonOrder.setBelongWorkOrder(belongWorkOrder);
|
|
|
|
|
// sonOrder.setWorkerOrder(sworkOrderCode);
|
|
|
|
|
// sonOrder.setParentOrder(parentWorkOrder);
|
|
|
|
|
// sonOrders = (List<ProOrder>)sonOrder.getChildren();
|
|
|
|
|
// if(CollectionUtils.isEmpty(sonOrders)){//1层订单
|
|
|
|
|
// sonOrder.setEndFlag(1);
|
|
|
|
|
// }
|
|
|
|
|
// ProOrderWorkorder sworkOrder = getWorkOrderByOrder(sonOrder);//TODO;
|
|
|
|
|
// workorders.add(sworkOrder);
|
|
|
|
|
// parentWorkOrder = sworkOrderCode;
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// /**pro_order_workorder**/
|
|
|
|
|
// if(!CollectionUtils.isEmpty(workorders)){
|
|
|
|
|
// int pm = proOrderWorkorderMapper.insertWorkorders(workorders);
|
|
|
|
|
// System.out.println("pm:"+pm);
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// //拆批次
|
|
|
|
|
// Long pworkOrderQua = proOrder.getQuantitySplit();//工单数量
|
|
|
|
|
// ProOrderWorkorderBatch workBatch = null;
|
|
|
|
|
// int batchNum = 1;
|
|
|
|
|
// while(pworkOrderQua>0){
|
|
|
|
|
// workBatch = new ProOrderWorkorderBatch();
|
|
|
|
|
// workBatch.setBatchQuantity(0L);
|
|
|
|
|
// List<String> batchCode = StringUtils.batchAutoCreate(proOrder.getFactoryCode(),
|
|
|
|
|
// proOrder.getLineCode(),
|
|
|
|
|
// DateUtils.dateTime("yyyy-MM-dd",proOrder.getProductDate()),
|
|
|
|
|
// proOrder.getAtrr2().substring(proOrder.getAtrr2().length()-1),
|
|
|
|
|
// "0",batchNum++);
|
|
|
|
|
// workBatch.setBatchCode(batchCode);
|
|
|
|
|
// workorderBatches.add(workBatch);
|
|
|
|
|
// }
|
|
|
|
|
// /**pro_order_workorder_batch**/
|
|
|
|
|
// if(!CollectionUtils.isEmpty(workorderBatches)) {
|
|
|
|
|
// int pn = proOrderWorkorderBatchMapper.insertWorkorderBatchs(workBatch);
|
|
|
|
|
// System.out.println("pn:"+pn);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
Date nowTime = DateUtils.getNowDate();//公共时间
|
|
|
|
|
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
|
|
|
|
|
String key = "#header.poolName";
|
|
|
|
|
proOrder.setFactoryCode(request.getHeader(key.substring(8)).replace("ds_",""));
|
|
|
|
|
proOrder.setCreateTime(nowTime);
|
|
|
|
|
//订单总量
|
|
|
|
|
proOrder.setQuantitySplit(proOrder.getQuantitySplit()==null?0L:proOrder.getQuantitySplit());
|
|
|
|
|
Long orderQua = proOrder.getQuantity()-proOrder.getQuantitySplit();
|
|
|
|
|
//有几个设备就有几个工单
|
|
|
|
|
for(int i=0;i<proOrder.getLineCodes().length;i++){
|
|
|
|
|
if(orderQua == 0L){
|
|
|
|
|
logger.info("线体产能满足生产");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
List<ProOrderWorkorder> workorders = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
proOrder.setLineCode(proOrder.getLineCodes()[i]);
|
|
|
|
|
ProLine plineInfo = proOrderWorkorderMapper.getLineProductInfo(proOrder);//线体母单产品产能和线体代码
|
|
|
|
|
if(plineInfo==null){
|
|
|
|
|
logger.error("线体"+proOrder.getLineCodes()[i]+"产能"+plineInfo.getEfficiency()+"无法生产");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
Long efficiency = plineInfo.getEfficiency();
|
|
|
|
|
if(efficiency < orderQua){
|
|
|
|
|
proOrder.setQuantitySplit(efficiency);
|
|
|
|
|
}else{
|
|
|
|
|
proOrder.setQuantitySplit(orderQua);
|
|
|
|
|
}
|
|
|
|
|
orderQua = orderQua - proOrder.getQuantitySplit();//消耗订单总数量
|
|
|
|
|
if(CollectionUtils.isEmpty(proOrder.getChildren())){//1层订单
|
|
|
|
|
proOrder.setEndFlag(1);
|
|
|
|
|
}
|
|
|
|
|
int endCode = getEndCode(proOrder.getId());
|
|
|
|
|
String belongWorkOrder = proOrder.getOrderCode()+"-"+endCode;
|
|
|
|
|
proOrder.setBelongWorkOrder(belongWorkOrder);
|
|
|
|
|
proOrder.setWorkerOrder(belongWorkOrder);
|
|
|
|
|
proOrder.setParentOrder("0");
|
|
|
|
|
ProOrderWorkorder pworkOrder = getWorkOrderByOrder(proOrder,proOrder);//TODO;
|
|
|
|
|
//父级
|
|
|
|
|
workorders.add(pworkOrder);
|
|
|
|
|
|
|
|
|
|
/**pro_order_workorder_batch**/
|
|
|
|
|
String parentWorkOrder = belongWorkOrder;
|
|
|
|
|
|
|
|
|
|
ProOrder order = proOrder;
|
|
|
|
|
while(!CollectionUtils.isEmpty(order.getChildren())){
|
|
|
|
|
// 解决方案就是将list再次转为json串,然后由json串再转为list
|
|
|
|
|
String s = JSON.toJSONString(order.getChildren());
|
|
|
|
|
List<ProOrder> oragainzation = JSON.parseArray(s, ProOrder.class);
|
|
|
|
|
ProOrder sonOrder = oragainzation.get(0);
|
|
|
|
|
sonOrder.setBelongWorkOrder(belongWorkOrder);
|
|
|
|
|
String sworkOrderCode = sonOrder.getOrderCode()+"-"+(++endCode);
|
|
|
|
|
sonOrder.setBelongWorkOrder(belongWorkOrder);
|
|
|
|
|
sonOrder.setWorkerOrder(sworkOrderCode);
|
|
|
|
|
sonOrder.setParentOrder(parentWorkOrder);
|
|
|
|
|
sonOrder.setQuantitySplit(sonOrder.getQuantity());
|
|
|
|
|
if(CollectionUtils.isEmpty(sonOrder.getChildren())){
|
|
|
|
|
sonOrder.setEndFlag(1);
|
|
|
|
|
}
|
|
|
|
|
ProOrderWorkorder sworkOrder = getWorkOrderByOrder(sonOrder,proOrder);//TODO;
|
|
|
|
|
workorders.add(sworkOrder);
|
|
|
|
|
order = sonOrder;
|
|
|
|
|
parentWorkOrder = sworkOrderCode;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**pro_order_workorder**/
|
|
|
|
|
if(!CollectionUtils.isEmpty(workorders)){
|
|
|
|
|
//计算子单拆分数量
|
|
|
|
|
for(int wm=0;wm<workorders.size();wm++){
|
|
|
|
|
BigDecimal wquaRatio = null;
|
|
|
|
|
if(wm != 0){//子单需要折算数量
|
|
|
|
|
wquaRatio = new BigDecimal(workorders.get(wm).getQuantitySplit())
|
|
|
|
|
.divide(new BigDecimal(workorders.get(0).getQuantitySplit()),2,BigDecimal.ROUND_UP);//proOrderWorkorderMapper.getQuaRatio(workorders.get(m-1).getProductCode());
|
|
|
|
|
workorders.get(wm).setQuantitySplit(wquaRatio.multiply(new BigDecimal(workorders.get(0).getQuantitySplit()))
|
|
|
|
|
.longValue());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int pm = proOrderWorkorderMapper.insertWorkorders(workorders);
|
|
|
|
|
System.out.println("pm:"+pm);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**拆批次**/
|
|
|
|
|
proOrder.setProdSpc(plineInfo.getDh());//借用字段
|
|
|
|
|
List<ProOrderWorkorderBatch> workorderBatches0 = getBatchList(proOrder);//TODO;
|
|
|
|
|
List<ProOrderWorkorderBatch> workBatchs = new ArrayList<>();
|
|
|
|
|
for(int m=0;m<workorders.size();m++){
|
|
|
|
|
ProOrderWorkorder work = workorders.get(m);
|
|
|
|
|
ProOrderWorkorderBatch wBatch = null;
|
|
|
|
|
BigDecimal quaRatio = null;
|
|
|
|
|
if(m != 0){//子单需要折算数量
|
|
|
|
|
quaRatio = new BigDecimal(workorders.get(m).getQuantitySplit())
|
|
|
|
|
.divide(new BigDecimal(workorders.get(0).getQuantitySplit()),2,BigDecimal.ROUND_UP);//proOrderWorkorderMapper.getQuaRatio(workorders.get(m-1).getProductCode());
|
|
|
|
|
}
|
|
|
|
|
for(ProOrderWorkorderBatch workBatch:workorderBatches0){
|
|
|
|
|
wBatch = new ProOrderWorkorderBatch();
|
|
|
|
|
wBatch.setBatchId(IdUtils.fastSimpleUUID());
|
|
|
|
|
wBatch.setCreateBy(SecurityUtils.getUsername());
|
|
|
|
|
wBatch.setCreateTime(proOrder.getCreateTime());
|
|
|
|
|
if(m != 0 && quaRatio!=null){//母单的数量已有
|
|
|
|
|
wBatch.setBatchQuantity(quaRatio.multiply(new BigDecimal(workBatch.getBatchQuantity())).longValue());
|
|
|
|
|
}else{
|
|
|
|
|
wBatch.setBatchQuantity(workBatch.getBatchQuantity());
|
|
|
|
|
}
|
|
|
|
|
wBatch.setWorkorderId(work.getWorkorderId());
|
|
|
|
|
wBatch.setBatchCode(workBatch.getBatchCode());
|
|
|
|
|
workBatchs.add(wBatch);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**pro_order_workorder_batch**/
|
|
|
|
|
if(!CollectionUtils.isEmpty(workBatchs)) {
|
|
|
|
|
int pn = proOrderWorkorderBatchMapper.insertWorkorderBatchs(workBatchs);
|
|
|
|
|
System.out.println("pn:"+pn);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return R.ok();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected ProOrderWorkorder getWorkOrderByOrder(ProOrder proOrder){
|
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
* @param proOrder 当前订单
|
|
|
|
|
* @param pOrder 母单
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
protected ProOrderWorkorder getWorkOrderByOrder(ProOrder proOrder,ProOrder pOrder){
|
|
|
|
|
ProOrderWorkorder workOrder = new ProOrderWorkorder();
|
|
|
|
|
workOrder.setWorkorderId(IdUtils.fastSimpleUUID());
|
|
|
|
|
int endCode = getEndCode(proOrder.getId());
|
|
|
|
|
workOrder.setWorkorderCode(proOrder.getWorkerOrder());
|
|
|
|
|
workOrder.setBelongWorkOrder(proOrder.getBelongWorkOrder());
|
|
|
|
|
workOrder.setOrderId(proOrder.getId());
|
|
|
|
@ -1335,23 +1465,56 @@ public class ProOrderServiceImpl implements IProOrderService {
|
|
|
|
|
workOrder.setProductName(proOrder.getProdDesc());
|
|
|
|
|
workOrder.setUnit(proOrder.getUnit());
|
|
|
|
|
workOrder.setQuantitySplit(proOrder.getQuantitySplit());
|
|
|
|
|
workOrder.setRouteCode(proOrder.getRouteCode());
|
|
|
|
|
workOrder.setRouteCode(pOrder.getRouteCode());
|
|
|
|
|
String gxCode = "CP";//proOrderWorkorderMapper.getProcessCode(proOrder.getRouteCode());
|
|
|
|
|
String[][] lineCodeArray = {{gxCode,proOrder.getLineCode()}};
|
|
|
|
|
workOrder.setProdLineCodeArray(lineCodeArray);
|
|
|
|
|
workOrder.setProductDate(DateUtils.dateTime("yyyy-MM-dd",proOrder.getProductDate()));
|
|
|
|
|
String[][] lineCodeArray = {{gxCode,pOrder.getLineCode()}};
|
|
|
|
|
workOrder.setProdLineCode(JSONArray.toJSONString(lineCodeArray));
|
|
|
|
|
workOrder.setProductDate(DateUtils.dateTime("yyyy-MM-dd",pOrder.getProductDate()));
|
|
|
|
|
//workOrder.setShiftId();
|
|
|
|
|
workOrder.setParentOrder(proOrder.getParentOrder());
|
|
|
|
|
workOrder.setStatus("w0");
|
|
|
|
|
workOrder.setCreateBy(SecurityUtils.getUsername());
|
|
|
|
|
workOrder.setCreateTime(proOrder.getCreateTime());
|
|
|
|
|
workOrder.setCreateTime(pOrder.getCreateTime());
|
|
|
|
|
workOrder.setProdType(proOrder.getOrderType());
|
|
|
|
|
workOrder.setFactoryCode(proOrder.getFactoryCode());
|
|
|
|
|
workOrder.setFactoryCode(pOrder.getFactoryCode());
|
|
|
|
|
workOrder.setEndFlag(proOrder.getEndFlag());
|
|
|
|
|
workOrder.setSortNo(proOrder.getSortNo());
|
|
|
|
|
workOrder.setSortNo(pOrder.getSortNo());
|
|
|
|
|
return workOrder;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//靠母单先生成批次模板
|
|
|
|
|
protected List<ProOrderWorkorderBatch> getBatchList(ProOrder proOrder){
|
|
|
|
|
List<ProOrderWorkorderBatch> workorderBatches = new ArrayList<>();
|
|
|
|
|
Long pworkOrderQua = proOrder.getQuantitySplit();//母工单数量
|
|
|
|
|
BaseProduct batchQua0 = proOrderWorkorderMapper.getProductInfo(proOrder);//母单标准批次产能和几合一
|
|
|
|
|
ProOrderWorkorderBatch workBatch = null;
|
|
|
|
|
while(pworkOrderQua>0){
|
|
|
|
|
workBatch = new ProOrderWorkorderBatch();
|
|
|
|
|
workBatch.setCreateBy(SecurityUtils.getUsername());
|
|
|
|
|
workBatch.setCreateTime(proOrder.getCreateTime());
|
|
|
|
|
if(batchQua0.getBatchQuaStandar().longValue()<= pworkOrderQua){
|
|
|
|
|
workBatch.setBatchQuantity(batchQua0.getBatchQuaStandar().longValue());
|
|
|
|
|
}else{
|
|
|
|
|
workBatch.setBatchQuantity(pworkOrderQua);
|
|
|
|
|
}
|
|
|
|
|
workorderBatches.add(workBatch);
|
|
|
|
|
pworkOrderQua = pworkOrderQua - batchQua0.getBatchQuaStandar().longValue();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//获取批次号集合
|
|
|
|
|
List<String> batchCodes = StringUtils.batchAutoCreate(proOrder.getFactoryCode(),
|
|
|
|
|
proOrder.getProdSpc(),
|
|
|
|
|
DateUtils.dateTime("yyyy-MM-dd",proOrder.getProductDate()),
|
|
|
|
|
proOrder.getAtrr2().substring(proOrder.getAtrr2().length()-1),
|
|
|
|
|
"0",workorderBatches.size());
|
|
|
|
|
|
|
|
|
|
for(int n=0;n<workorderBatches.size();n++){
|
|
|
|
|
workorderBatches.get(n).setBatchCode(batchCodes.get(n));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return workorderBatches;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 每个线体维护可生产的产品及其对应的每天的标准产能和标准用人。
|
|
|
|
|
* 1、标准用人最少的线体。
|
|
|
|
@ -1362,7 +1525,8 @@ public class ProOrderServiceImpl implements IProOrderService {
|
|
|
|
|
List<String> lines = new ArrayList<>();
|
|
|
|
|
List<ProOrder> proLines = proOrderMapper.getSelectLineLevel1(proOrder);
|
|
|
|
|
//订单总量
|
|
|
|
|
BigDecimal orderQuality = new BigDecimal(proOrder.getQuantity());
|
|
|
|
|
proOrder.setQuantitySplit(proOrder.getQuantitySplit()==null?0L:proOrder.getQuantitySplit());
|
|
|
|
|
BigDecimal orderQuality = new BigDecimal(proOrder.getQuantity()).subtract(new BigDecimal(proOrder.getQuantitySplit()));
|
|
|
|
|
BigDecimal consumeQuality = BigDecimal.ZERO;
|
|
|
|
|
for(ProOrder pline:proLines){
|
|
|
|
|
lines.add(pline.getLineCode());
|
|
|
|
@ -1382,8 +1546,13 @@ public class ProOrderServiceImpl implements IProOrderService {
|
|
|
|
|
// for(int c=0;c<jsonArray.size();c++){
|
|
|
|
|
// System.out.println(jsonArray.getJSONArray(c).getString(1));
|
|
|
|
|
// }
|
|
|
|
|
BigDecimal a = new BigDecimal("100");
|
|
|
|
|
BigDecimal b = new BigDecimal("100");
|
|
|
|
|
System.out.println(a.compareTo(b));
|
|
|
|
|
// BigDecimal a = new BigDecimal("100");
|
|
|
|
|
// BigDecimal b = new BigDecimal("100");
|
|
|
|
|
// System.out.println(a.compareTo(b));
|
|
|
|
|
int m=1;
|
|
|
|
|
while(m<3){
|
|
|
|
|
++m;
|
|
|
|
|
}
|
|
|
|
|
System.out.println(m);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|