|
@@ -31,11 +31,14 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
+import java.text.ParseException;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
import java.time.ZoneId;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
import static com.rongwei.bscommon.sys.service.impl.ApsProductionOrderServiceImpl.ERROR_MSG;
|
|
|
+import static com.rongwei.safecommon.utils.SaveConstans.DatePattern.DATE_PATTERN_YMDHMS;
|
|
|
import static com.rongwei.safecommon.utils.SaveConstans.JobStatus.JOBSTATUS_TO_BE_START;
|
|
|
import static com.rongwei.safecommon.utils.SaveConstans.LockmarkType.LOCKMARK_N;
|
|
|
import static com.rongwei.safecommon.utils.SaveConstans.LockmarkType.LOCKMARK_Y;
|
|
@@ -245,6 +248,41 @@ public class ApsBlankOrderServiceImpl extends ServiceImpl<ApsBlankOrderDao, ApsB
|
|
|
return R.ok();
|
|
|
}
|
|
|
|
|
|
+ /*
|
|
|
+ 插单
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public R insertOrder(Map<String, Object> params) throws Exception {
|
|
|
+ String productionOrderId = params.get("PRODUCTIONORDERID").toString();
|
|
|
+ String blankOrderId = params.get("BLANKORDERID").toString();
|
|
|
+ String deliveryDateStr = params.get("DELIVERYDATE").toString();
|
|
|
+ SimpleDateFormat formatter = new SimpleDateFormat(DATE_PATTERN_YMDHMS);
|
|
|
+ Date deliveryDate = formatter.parse(deliveryDateStr);
|
|
|
+
|
|
|
+ //更新订单期望交货期
|
|
|
+ ApsProductionOrderDo productionOrderDo = apsProductionOrderService.getById(productionOrderId);
|
|
|
+ productionOrderDo.setDeliverydate(deliveryDate);
|
|
|
+ boolean bool1 = apsProductionOrderService.updateById(productionOrderDo);
|
|
|
+
|
|
|
+ // 更新坯料计划的生产状态为已发布
|
|
|
+ boolean bool2 = this.update(new LambdaUpdateWrapper<ApsBlankOrderDo>().eq(ApsBlankOrderDo::getId, blankOrderId)
|
|
|
+ .set(ApsBlankOrderDo::getLockmark, LOCKMARK_N));
|
|
|
+
|
|
|
+ // 解锁订单所有作业状态=待开工的作业明细(是否锁定=否)
|
|
|
+ boolean bool3 = apsProcessOperationService.update(new LambdaUpdateWrapper<ApsProcessOperationDo>()
|
|
|
+ .eq(ApsProcessOperationDo::getBlankid, blankOrderId)
|
|
|
+ .eq(ApsProcessOperationDo::getWorkstatus, JOBSTATUS_TO_BE_START)
|
|
|
+ .set(ApsProcessOperationDo::getLockmark, LOCKMARK_N));
|
|
|
+
|
|
|
+ if (bool1 && bool2 && bool3) {
|
|
|
+ //重新排程
|
|
|
+// this.apsReScheduling();
|
|
|
+ return R.ok();
|
|
|
+ } else {
|
|
|
+ return R.error();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 获取锁定和解锁的 搜索事件
|
|
|
*
|