计划管理模块(日期范围查询、计划工厂字段添加)、湿料计划管理模块(状态查询)、整体代码优化

highway
wws 1 year ago
parent 907774948b
commit 5809d73f28

@ -130,6 +130,7 @@ public class ProOrderController extends BaseController {
public AjaxResult add(@RequestBody ProOrder proOrder) {
return toAjax(proOrderService.insertProOrder(proOrder));
}
/**
*
*/
@ -137,14 +138,14 @@ public class ProOrderController extends BaseController {
@PostMapping("/sapAddOrder")
public R<Boolean> sapAddOrder(@RequestBody ProOrder proOrder) {
try {
if (proOrder!=null){
if (proOrder != null) {
proOrderService.insertSapProOrder(proOrder);
}
}catch (Exception e){
} catch (Exception e) {
return R.fail(e.getMessage());
}
return R.ok();
return R.ok();
}

@ -82,13 +82,13 @@ public class ProOrderServiceImpl implements IProOrderService {
ProOrder product = new ProOrder();
BeanUtils.copyProperties(splitOrderDTO.getProduct(), product);
// 设置通用属性
ProOrderWorkorder proOrderWorkorder = setCommonWorkAttribute(product, splitOrderDTO.getProductDate(), splitOrderDTO.getProdLineCode(), splitOrderDTO.getShiftId(),splitOrderDTO.getRouteCode());
ProOrderWorkorder proOrderWorkorder = setCommonWorkAttribute(product, splitOrderDTO.getProductDate(), splitOrderDTO.getProdLineCode(), splitOrderDTO.getShiftId(), splitOrderDTO.getRouteCode());
// 生成对应工单表
// 一级
ProOrderWorkorder firWorkOrder = setWorkOrder(proOrderWorkorder, product);
// code
int endCode = getEndCode(product.getId());
firWorkOrder.setWorkorderCode(product.getOrderCode()+"-"+endCode);
firWorkOrder.setWorkorderCode(product.getOrderCode() + "-" + endCode);
// 更新到数据库
proOrderWorkorderMapper.insertProOrderWorkorder(firWorkOrder);
@ -108,7 +108,7 @@ public class ProOrderServiceImpl implements IProOrderService {
proOrderWorkorder.setParentOrder(firWorkOrder.getWorkorderCode());
ProOrderWorkorder secWorkOrder = setWorkOrder(proOrderWorkorder, product);
// code
secWorkOrder.setWorkorderCode(product.getOrderCode()+"-"+(endCode+1));
secWorkOrder.setWorkorderCode(product.getOrderCode() + "-" + (endCode + 1));
// 更新到数据库
proOrderWorkorderMapper.insertProOrderWorkorder(secWorkOrder);
// 生成批次表并更新到数据库
@ -127,7 +127,7 @@ public class ProOrderServiceImpl implements IProOrderService {
// 设置为底层节点
thiWorkOrder.setIsEnd(1);
// code
thiWorkOrder.setWorkorderCode(product.getOrderCode()+"-"+(endCode+2));
thiWorkOrder.setWorkorderCode(product.getOrderCode() + "-" + (endCode + 2));
// 更新到数据库
proOrderWorkorderMapper.insertProOrderWorkorder(thiWorkOrder);
// 生成批次表并更新到数据库
@ -135,7 +135,7 @@ public class ProOrderServiceImpl implements IProOrderService {
}
// 设置为底层节点
if (checkEnd == 1){
if (checkEnd == 1) {
updateWorker.setWorkorderId(secWorkOrder.getWorkorderId());
updateWorker.setIsEnd(1);
proOrderWorkorderMapper.updateProOrderWorkorder(updateWorker);
@ -144,7 +144,7 @@ public class ProOrderServiceImpl implements IProOrderService {
}
// 设置为底层节点
if (checkEnd == 1){
if (checkEnd == 1) {
updateWorker.setWorkorderId(firWorkOrder.getWorkorderId());
updateWorker.setIsEnd(1);
proOrderWorkorderMapper.updateProOrderWorkorder(updateWorker);
@ -250,11 +250,11 @@ public class ProOrderServiceImpl implements IProOrderService {
@Override
@DS("#header.poolName")
public LineAndShiftVo getProdLineShift(String type) {
if (type.equals("white")){
LineAndShiftVo lineAndShiftVo = new LineAndShiftVo(proOrderMapper.selectProdLine(), proOrderMapper.selectProShift(),proRouteMapper.selectAllRoute());
if (type.equals("white")) {
LineAndShiftVo lineAndShiftVo = new LineAndShiftVo(proOrderMapper.selectProdLine(), proOrderMapper.selectProShift(), proRouteMapper.selectAllRoute());
return lineAndShiftVo;
}
LineAndShiftVo lineAndShiftVo = new LineAndShiftVo(proOrderMapper.selectPackageLine(), proOrderMapper.selectProShift(),proRouteMapper.selectAllRoute());
LineAndShiftVo lineAndShiftVo = new LineAndShiftVo(proOrderMapper.selectPackageLine(), proOrderMapper.selectProShift(), proRouteMapper.selectAllRoute());
return lineAndShiftVo;
}
@ -297,7 +297,7 @@ public class ProOrderServiceImpl implements IProOrderService {
proOrder.setParentOrder("0");
proOrder.setStatus("o0");
proOrder.setOrderType(proOrder.getProdType());
proOrder.setOrderCode("DD"+ DateUtils.parseDateToStr(DateUtils.YYYYMMDDHHMMSSsss, date));
proOrder.setOrderCode("DD" + DateUtils.parseDateToStr(DateUtils.YYYYMMDDHHMMSSsss, date));
proOrder.setCreateBy(SecurityContextHolder.getUserName());
proOrder.setCreateTime(date);
proOrder.setUpdateBy(SecurityContextHolder.getUserName());
@ -353,7 +353,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) {
ProOrderWorkorder proOrderWorkorder = new ProOrderWorkorder();
// 更新者
proOrderWorkorder.setUpdateBy(SecurityContextHolder.getUserName());
@ -462,12 +462,13 @@ public class ProOrderServiceImpl implements IProOrderService {
/**
* code
*
* @param id
* @return
*/
private int getEndCode(String id){
private int getEndCode(String id) {
String workOrderCode = proOrderWorkorderMapper.selectEndWorkOrder(id);
if (workOrderCode == null || workOrderCode.equals("")){
if (workOrderCode == null || workOrderCode.equals("")) {
return 1;
}
@ -477,7 +478,7 @@ public class ProOrderServiceImpl implements IProOrderService {
String substring = workOrderCode.substring(hyphenIndex + 1); // 从 '-' 的下一位开始截取到字符串的末尾
// 将截取到的字符串转换为整数
int endCode = Integer.parseInt(substring);
return endCode+1;
return endCode + 1;
} else {
return 1;
}

@ -113,6 +113,28 @@ public class ProOrder extends TreeEntity {
@Excel(name = "物料名称")
private String prodSpc;
// 计划生产日期开始
private String planDateStart;
// 计划生产日期结束
private String planDateEnd;
public String getPlanDateStart() {
return planDateStart;
}
public void setPlanDateStart(String planDateStart) {
this.planDateStart = planDateStart;
}
public String getPlanDateEnd() {
return planDateEnd;
}
public void setPlanDateEnd(String planDateEnd) {
this.planDateEnd = planDateEnd;
}
public String getProdSpc() {
return prodSpc;
}
@ -267,6 +289,8 @@ public class ProOrder extends TreeEntity {
.append("updateTime", getUpdateTime())
.append("prodType", getProdType())
.append("prodSpc", getProdSpc())
.append("planDateStart",getPlanDateStart())
.append("planDateEnd",getPlanDateEnd())
.toString();
}
}

@ -78,7 +78,11 @@ public class ProOrderWorkorder extends TreeEntity {
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "工单生产日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date productDate;
// 工单生产日期开始
private String productDateStart;
// 工单生产日期结束
private String productDateEnd;
/** 班次 */
@Excel(name = "班次")

@ -61,8 +61,45 @@ public class ProOrderDTO {
/** 物料型号 */
private String ProdSpc;
private String planFactoryCode;
public String getPlanFactoryCode() {
return planFactoryCode;
}
public void setPlanFactoryCode(String planFactoryCode) {
this.planFactoryCode = planFactoryCode;
}
private List<ProOrderDTO> children;
@Override
public String toString() {
return "ProOrderDTO{" +
"id='" + id + '\'' +
", factoryCode='" + factoryCode + '\'' +
", orderType='" + orderType + '\'' +
", orderCode='" + orderCode + '\'' +
", prodCode='" + prodCode + '\'' +
", prodDesc='" + prodDesc + '\'' +
", quantity=" + quantity +
", quantitySplit=" + quantitySplit +
", unit='" + unit + '\'' +
", workerOrder='" + workerOrder + '\'' +
", planProDate=" + planProDate +
", planComplete=" + planComplete +
", atrr1='" + atrr1 + '\'' +
", atrr2='" + atrr2 + '\'' +
", atrr3='" + atrr3 + '\'' +
", status='" + status + '\'' +
", parentOrder='" + parentOrder + '\'' +
", prodType='" + prodType + '\'' +
", ProdSpc='" + ProdSpc + '\'' +
", planFactoryCode='" + planFactoryCode + '\'' +
", children=" + children +
'}';
}
public String getId() {
return id;
}
@ -223,32 +260,6 @@ public class ProOrderDTO {
this.children = children;
}
@Override
public String toString() {
return "ProOrderDTO{" +
"id='" + id + '\'' +
", factoryCode='" + factoryCode + '\'' +
", orderType='" + orderType + '\'' +
", orderCode='" + orderCode + '\'' +
", prodCode='" + prodCode + '\'' +
", prodDesc='" + prodDesc + '\'' +
", quantity=" + quantity +
", quantitySplit=" + quantitySplit +
", unit='" + unit + '\'' +
", workerOrder='" + workerOrder + '\'' +
", planProDate=" + planProDate +
", planComplete=" + planComplete +
", atrr1='" + atrr1 + '\'' +
", atrr2='" + atrr2 + '\'' +
", atrr3='" + atrr3 + '\'' +
", status='" + status + '\'' +
", parentOrder='" + parentOrder + '\'' +
", prodType='" + prodType + '\'' +
", ProdSpc='" + ProdSpc + '\'' +
", children=" + children +
'}';
}
public ProOrderDTO() {
}
}

@ -64,15 +64,6 @@ public interface ProWetMaterialPlanMapper {
*/
public int deleteProWetMaterialPlanByIds(String[] ids);
/**
*
*
* @param startTime
* @param endTime
* @return
*/
List<ProWetMaterialPlan> selectProWetMaterialPlanListByTime(@Param("startTime") Date startTime, @Param("endTime") Date endTime);
/**
* id
*

@ -75,90 +75,52 @@ public class ProOrderServiceImpl implements IProOrderService {
// 如果不重复
if (checkout) {
// 判断是否为底层节点
int checkEnd = 0;
// 创建ProOrderWorkorder对象用于数据更新减少io
ProOrderWorkorder updateWorker = new ProOrderWorkorder();
ProOrder product = new ProOrder();
BeanUtils.copyProperties(splitOrderDTO.getProduct(), product);
// 设置通用属性
ProOrderWorkorder proOrderWorkorder = setCommonWorkAttribute(product, splitOrderDTO.getProductDate(), splitOrderDTO.getProdLineCode(), splitOrderDTO.getShiftId(),splitOrderDTO.getRouteCode());
// 生成对应工单表
// 一级
ProOrderWorkorder firWorkOrder = setWorkOrder(proOrderWorkorder, product);
// code
int endCode = getEndCode(product.getId());
firWorkOrder.setWorkorderCode(product.getOrderCode()+"-"+endCode);
// 更新到数据库
proOrderWorkorderMapper.insertProOrderWorkorder(firWorkOrder);
// 创建通用批次表对象
// 创建订单对象并将信息copy进去
ProOrder proOrder = new ProOrder();
BeanUtils.copyProperties(splitOrderDTO.getProduct(), proOrder);
// 设置工单通用属性
ProOrderWorkorder proOrderWorkorder = setCommonWorkAttribute(proOrder, splitOrderDTO.getProductDate(), splitOrderDTO.getProdLineCode(), splitOrderDTO.getShiftId(), splitOrderDTO.getRouteCode());
// 创建批次表通用对象
ProOrderWorkorderBatch workBatch = setCommonBatchAttribute();
// 生成批次表并更新到数据库
setBatch(workBatch, splitOrderDTO.getFormFields(), firWorkOrder.getWorkorderId());
// 二级
if (splitOrderDTO.getProduct().getChildren() != null) {
// 判断加1
checkEnd += 1;
List<ProOrderDTO> secProOrderList = splitOrderDTO.getProduct().getChildren();
BeanUtils.copyProperties(secProOrderList.get(0), product);
// 设置父工单
proOrderWorkorder.setParentOrder(firWorkOrder.getWorkorderCode());
ProOrderWorkorder secWorkOrder = setWorkOrder(proOrderWorkorder, product);
// code
secWorkOrder.setWorkorderCode(product.getOrderCode()+"-"+(endCode+1));
// 更新到数据库
proOrderWorkorderMapper.insertProOrderWorkorder(secWorkOrder);
// 生成批次表并更新到数据库
setBatch(workBatch, splitOrderDTO.getFormFields(), secWorkOrder.getWorkorderId());
// 三级
if (secProOrderList.get(0).getChildren() != null) {
// 判断加1
checkEnd += 1;
List<ProOrderDTO> thiProOrderList = secProOrderList.get(0).getChildren();
BeanUtils.copyProperties(thiProOrderList.get(0), product);
// 设置父工单
proOrderWorkorder.setParentOrder(secWorkOrder.getWorkorderCode());
ProOrderWorkorder thiWorkOrder = setWorkOrder(proOrderWorkorder, product);
// 设置为底层节点
thiWorkOrder.setIsEnd(1);
// code
thiWorkOrder.setWorkorderCode(product.getOrderCode()+"-"+(endCode+2));
// 更新到数据库
proOrderWorkorderMapper.insertProOrderWorkorder(thiWorkOrder);
// 生成批次表并更新到数据库
setBatch(workBatch, splitOrderDTO.getFormFields(), thiWorkOrder.getWorkorderId());
}
// 设置为底层节点
if (checkEnd == 1){
updateWorker.setWorkorderId(secWorkOrder.getWorkorderId());
updateWorker.setIsEnd(1);
proOrderWorkorderMapper.updateProOrderWorkorder(updateWorker);
// code
int endCode = getEndCode(proOrder.getId());
// 父工单code
StringBuilder parentOrder = new StringBuilder("0");
boolean run = true;
while (run) {
// 先进行当前订单拆分操作
// 1.设置工单信息,并更新订单信息至数据库
ProOrderWorkorder workOrder = setWorkOrder(proOrderWorkorder, proOrder);
// 2.设置工单编码
workOrder.setWorkorderCode(proOrder.getOrderCode() + "-" + endCode);
// 3.设置父工单
workOrder.setParentOrder(parentOrder.toString());
// 将工单信息更新至数据库
proOrderWorkorderMapper.insertProOrderWorkorder(workOrder);
// 生成批次表信息并更新至数据库
setBatch(workBatch, splitOrderDTO.getFormFields(), workOrder.getWorkorderId());
// 如果存在子节点
if (proOrder.getChildren() != null) {
ProOrderDTO newProOrder = (ProOrderDTO) proOrder.getChildren().get(0);
// 将child信息重新赋值给proOrder
BeanUtils.copyProperties(newProOrder, proOrder);
// 存放父工单code
parentOrder.delete(0, parentOrder.length());
parentOrder.append(workOrder.getWorkorderCode());
// code自增
endCode++;
} else {
// 设置子节点is_end字段信息
workOrder.setIsEnd(1);
// 更新数据库记录信息
proOrderWorkorderMapper.updateProOrderWorkorder(workOrder);
// 结束循环
run = false;
}
}
// 设置为底层节点
if (checkEnd == 1){
updateWorker.setWorkorderId(firWorkOrder.getWorkorderId());
updateWorker.setIsEnd(1);
proOrderWorkorderMapper.updateProOrderWorkorder(updateWorker);
}
// 母工单设置底层节点(只有母工单的情况下)
if (checkEnd == 0) {
firWorkOrder.setIsEnd(1);
// 更新到数据库
proOrderWorkorderMapper.updateProOrderWorkorder(firWorkOrder);
}
return success();
}
return error(500, "批次号不能重复");
@ -175,45 +137,46 @@ public class ProOrderServiceImpl implements IProOrderService {
public AjaxResult getWorkOrderList(String id) {
// 通过订单id查询所有工单信息list
List<ProOrderWorkorder> proOrderWorkorderList = proOrderWorkorderMapper.selectFirWorkOrder(id);
// 母工单循环遍历
for (int i = 0; i < proOrderWorkorderList.size(); i++) {
// 通过班次id查询班次名称
String shiftDesc = proOrderMapper.selectShiftNameById(proOrderWorkorderList.get(i).getShiftId());
// 通过设备code查询出机型名称
String prodLineName = proOrderMapper.selectProdLineName(proOrderWorkorderList.get(i).getProdLineCode());
// 通过工单id查询批次号
List<String> batchCodeList = proOrderMapper.selectBatchCodesById(proOrderWorkorderList.get(i).getWorkorderId());
List<StringBuilder> batchCodes = new ArrayList<>();
// 格式化数据
for (int j = 0; j < batchCodeList.size(); j++) {
batchCodes.add(new StringBuilder(batchCodeList.get(j)).append(";").append("\n"));
}
// 通过母工单workorder_id查询子工单
// 二级
List<ProOrderWorkorder> secProOrderWorkorder = proOrderWorkorderMapper.selectChildWorkOrder(proOrderWorkorderList.get(i).getWorkorderCode());
if (secProOrderWorkorder.size() > 0 && secProOrderWorkorder != null) {
// 三级
List<ProOrderWorkorder> thiProOrderWorkorders = proOrderWorkorderMapper.selectChildWorkOrder(secProOrderWorkorder.get(0).getWorkorderCode());
if (thiProOrderWorkorders.size() > 0 && thiProOrderWorkorders != null) {
// 将三级放入二级child
thiProOrderWorkorders.get(0).setShiftDesc(shiftDesc);
thiProOrderWorkorders.get(0).setProdLineCode(prodLineName);
thiProOrderWorkorders.get(0).setBatchCodeList(batchCodes);
secProOrderWorkorder.get(0).setChildren(thiProOrderWorkorders);
}
// 将二级放入到母工单child
secProOrderWorkorder.get(0).setShiftDesc(shiftDesc);
secProOrderWorkorder.get(0).setProdLineCode(prodLineName);
secProOrderWorkorder.get(0).setBatchCodeList(batchCodes);
proOrderWorkorderList.get(i).setChildren(secProOrderWorkorder);
}
proOrderWorkorderList.get(i).setShiftDesc(shiftDesc);
proOrderWorkorderList.get(i).setProdLineCode(prodLineName);
proOrderWorkorderList.get(i).setBatchCodeList(batchCodes);
for (ProOrderWorkorder proOrderWorkorder : proOrderWorkorderList) {
formatProOrderWorkorder(proOrderWorkorder);
}
return success(proOrderWorkorderList);
}
/**
*
*
* @param proOrderWorkorder
*/
private void formatProOrderWorkorder(ProOrderWorkorder proOrderWorkorder) {
// 通过班次id查询班次名称
String shiftDesc = proOrderMapper.selectShiftNameById(proOrderWorkorder.getShiftId());
// 通过设备code查询出机型名称
String prodLineName = proOrderMapper.selectProdLineName(proOrderWorkorder.getProdLineCode());
// 通过工单id查询批次号
List<String> batchCodeList = proOrderMapper.selectBatchCodesById(proOrderWorkorder.getWorkorderId());
List<StringBuilder> batchCodes = new ArrayList<>();
// 格式化数据
for (String batchCode : batchCodeList) {
batchCodes.add(new StringBuilder(batchCode).append(";").append("\n"));
}
// 将查询结果设置到当前工单对象
proOrderWorkorder.setShiftDesc(shiftDesc);
proOrderWorkorder.setProdLineCode(prodLineName);
proOrderWorkorder.setBatchCodeList(batchCodes);
// 通过母工单workorder_id查询子工单
List<ProOrderWorkorder> childWorkorders = proOrderWorkorderMapper.selectChildWorkOrder(proOrderWorkorder.getWorkorderCode());
if (!childWorkorders.isEmpty()) {
for (ProOrderWorkorder childWorkorder : childWorkorders) {
formatProOrderWorkorder(childWorkorder); // 递归处理子工单
}
proOrderWorkorder.setChildren(childWorkorders); // 设置子工单列表
}
}
/**
*
*
@ -223,25 +186,32 @@ public class ProOrderServiceImpl implements IProOrderService {
@Override
@DS("#header.poolName")
public AjaxResult getOrderList(String id) {
// 注意判空不为空则放入 (避免空指针)
// 通过母工单id查询母订单详情
ProOrder proOrder = proOrderMapper.selectProOrderById(id);
// 查询二级
List<ProOrder> secProOrderList = proOrderMapper.selectChildProOrderByCode(proOrder.getOrderCode());
if (secProOrderList != null || secProOrderList.size() > 0) {
// 查询三级
List<ProOrder> thiProOrderList = proOrderMapper.selectChildProOrderByCode(secProOrderList.get(0).getOrderCode());
if (thiProOrderList != null || thiProOrderList.size() > 0) {
// 将三级Order放入二级
secProOrderList.get(0).setChildren(thiProOrderList);
}
}
// 将二级Order放入母订单
proOrder.setChildren(secProOrderList);
// 递归查询子订单
recursiveQueryChildOrder(proOrder);
return success(proOrder);
}
/**
*
*
* @param proOrder
*/
private void recursiveQueryChildOrder(ProOrder proOrder) {
// 查询子订单列表
List<ProOrder> childOrders = proOrderMapper.selectChildProOrderByCode(proOrder.getOrderCode());
if (!childOrders.isEmpty()) {
// 递归处理子订单
for (ProOrder childOrder : childOrders) {
recursiveQueryChildOrder(childOrder);
}
// 将子订单列表设置到当前订单对象
proOrder.setChildren(childOrders);
}
}
/**
*
*
@ -250,13 +220,13 @@ public class ProOrderServiceImpl implements IProOrderService {
@Override
@DS("#header.poolName")
public LineAndShiftVo getProdLineShift(String type) {
if (type.equals("white")){
if (type.equals("white")) {
LineAndShiftVo lineAndShiftVo = new LineAndShiftVo(proOrderMapper.selectProdLine(),
proOrderMapper.selectProShift(),proRouteMapper.selectAllRoute());
proOrderMapper.selectProShift(), proRouteMapper.selectAllRoute());
return lineAndShiftVo;
}
LineAndShiftVo lineAndShiftVo = new LineAndShiftVo(proOrderMapper.selectPackageLine(),
proOrderMapper.selectProShift(),proRouteMapper.selectAllRoute());
proOrderMapper.selectProShift(), proRouteMapper.selectAllRoute());
return lineAndShiftVo;
}
@ -299,7 +269,7 @@ public class ProOrderServiceImpl implements IProOrderService {
proOrder.setParentOrder("0");
proOrder.setStatus("o0");
proOrder.setOrderType(proOrder.getProdType());
proOrder.setOrderCode("DD"+ DateUtils.parseDateToStr(DateUtils.YYYYMMDDHHMMSSsss, date));
proOrder.setOrderCode("DD" + DateUtils.parseDateToStr(DateUtils.YYYYMMDDHHMMSSsss, date));
proOrder.setCreateBy(SecurityContextHolder.getUserName());
proOrder.setCreateTime(date);
proOrder.setUpdateBy(SecurityContextHolder.getUserName());
@ -355,7 +325,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) {
ProOrderWorkorder proOrderWorkorder = new ProOrderWorkorder();
// 更新者
proOrderWorkorder.setUpdateBy(SecurityContextHolder.getUserName());
@ -382,6 +352,8 @@ public class ProOrderServiceImpl implements IProOrderService {
proOrderWorkorder.setStatus("w0");
// 工艺编码
proOrderWorkorder.setRouteCode(routeCode);
// 工厂编码
proOrderWorkorder.setFactoryCode(proOrder.getPlanFactoryCode());
return proOrderWorkorder;
}
@ -448,11 +420,11 @@ public class ProOrderServiceImpl implements IProOrderService {
private void setBatch(ProOrderWorkorderBatch workBatch, List<Batch> batchList, String workOrderId) {
// 工单id
workBatch.setWorkorderId(workOrderId);
// 产品类型
for (int i = 0; i < batchList.size(); i++) {
for (Batch batch : batchList) {
// 生成批次id
workBatch.setBatchId(IdUtils.fastSimpleUUID());
Batch batch = batchList.get(i);
// 获取批次号
workBatch.setBatchCode(batch.getBatchCode());
// 获取批次数量
@ -460,16 +432,30 @@ public class ProOrderServiceImpl implements IProOrderService {
// 更新至数据库
proOrderWorkorderBatchMapper.insertProOrderWorkorderBatch(workBatch);
}
// // 产品类型
// for (int i = 0; i < batchList.size(); i++) {
// // 生成批次id
// workBatch.setBatchId(IdUtils.fastSimpleUUID());
// Batch batch = batchList.get(i);
// // 获取批次号
// workBatch.setBatchCode(batch.getBatchCode());
// // 获取批次数量
// workBatch.setBatchQuantity(batch.getBatchQuantity());
// // 更新至数据库
// proOrderWorkorderBatchMapper.insertProOrderWorkorderBatch(workBatch);
// }
}
/**
* code
*
* @param id
* @return
*/
private int getEndCode(String id){
private int getEndCode(String id) {
String workOrderCode = proOrderWorkorderMapper.selectEndWorkOrder(id);
if (workOrderCode == null || workOrderCode.equals("")){
if (workOrderCode == null || workOrderCode.equals("")) {
return 1;
}
@ -479,7 +465,7 @@ public class ProOrderServiceImpl implements IProOrderService {
String substring = workOrderCode.substring(hyphenIndex + 1); // 从 '-' 的下一位开始截取到字符串的末尾
// 将截取到的字符串转换为整数
int endCode = Integer.parseInt(substring);
return endCode+1;
return endCode + 1;
} else {
return 1;
}

@ -61,9 +61,6 @@ public class ProWetMaterialPlanServiceImpl implements IProWetMaterialPlanService
@Override
@DS("#header.poolName")
public List<ProWetMaterialPlan> selectProWetMaterialPlanList(ProWetMaterialPlan proWetMaterialPlan) {
if (proWetMaterialPlan.getStartTime() != null && proWetMaterialPlan.getEndTime() != null) {
return proWetMaterialPlanMapper.selectProWetMaterialPlanListByTime(proWetMaterialPlan.getStartTime(), proWetMaterialPlan.getEndTime());
}
return proWetMaterialPlanMapper.selectProWetMaterialPlanList(proWetMaterialPlan);
}
@ -132,9 +129,9 @@ public class ProWetMaterialPlanServiceImpl implements IProWetMaterialPlanService
}
List<ProOrderWorkorder> workorderList = proOrderWorkorderMapper.selectWorkOrderByTime(productDate);
// 循环遍历
for (int i = 0; i < workorderList.size(); i++) {
for (ProOrderWorkorder proOrderWorkorder : workorderList) {
// 通过班次id获取班次名称
workorderList.get(i).setShiftDesc(proWetMaterialPlanMapper.selectShiftById(workorderList.get(i).getShiftId()));
proOrderWorkorder.setShiftDesc(proWetMaterialPlanMapper.selectShiftById(proOrderWorkorder.getShiftId()));
}
return success(workorderList);
}
@ -195,15 +192,15 @@ public class ProWetMaterialPlanServiceImpl implements IProWetMaterialPlanService
// 将主计划更新至数据库
proWetMaterialPlanMapper.insertProWetMaterialPlan(proWetMaterialPlan);
// 循环创建湿料计划详情
for (int i = 0; i < proOrderWorkorderList.size(); i++) {
for (ProOrderWorkorder proOrderWorkorder : proOrderWorkorderList) {
// 将湿料计划详情更新至数据库
proWetMaterialPlanDetailMapper.insertProWetMaterialPlanDetail(createProWetMaterialPlanDetail(proOrderWorkorderList.get(i), proWetMaterialPlan.getId()));
proWetMaterialPlanDetailMapper.insertProWetMaterialPlanDetail(createProWetMaterialPlanDetail(proOrderWorkorder, proWetMaterialPlan.getId()));
}
} else {
// 循环创建湿料计划详情
for (int i = 0; i < proOrderWorkorderList.size(); i++) {
for (ProOrderWorkorder proOrderWorkorder : proOrderWorkorderList) {
// 将湿料计划详情更新至数据库
proWetMaterialPlanDetailMapper.insertProWetMaterialPlanDetail(createProWetMaterialPlanDetail(proOrderWorkorderList.get(i), planId));
proWetMaterialPlanDetailMapper.insertProWetMaterialPlanDetail(createProWetMaterialPlanDetail(proOrderWorkorder, planId));
}
}
return success();
@ -220,9 +217,9 @@ public class ProWetMaterialPlanServiceImpl implements IProWetMaterialPlanService
public AjaxResult getWetMaterialPlanDetailListById(String id) {
List<ProWetMaterialPlanDetail> detailList = proWetMaterialPlanDetailMapper.selectProWetMaterialPlanDetailListById(id);
// 获取班次名称和料罐名称
for (int i = 0; i < detailList.size(); i++) {
detailList.get(i).setShiftDesc(proWetMaterialPlanMapper.selectShiftById(String.valueOf(detailList.get(i).getShiftId())));
detailList.get(i).setBucketName(proWetMaterialPlanMapper.selectBucketNameById(detailList.get(i).getBucketId()));
for (ProWetMaterialPlanDetail detail : detailList) {
detail.setShiftDesc(proWetMaterialPlanMapper.selectShiftById(String.valueOf(detail.getShiftId())));
detail.setBucketName(proWetMaterialPlanMapper.selectBucketNameById(detail.getBucketId()));
}
return success(detailList);
}
@ -248,8 +245,8 @@ public class ProWetMaterialPlanServiceImpl implements IProWetMaterialPlanService
proWetMaterialPlanMapper.updateProWetMaterialPlan(proWetMaterialPlan);
// 循环将详情信息更新至数据库
for (int i = 0; i < detailList.size(); i++) {
proWetMaterialPlanDetailMapper.updateProWetMaterialPlanDetail(detailList.get(i));
for (ProWetMaterialPlanDetail detail : detailList) {
proWetMaterialPlanDetailMapper.updateProWetMaterialPlanDetail(detail);
}
return success();
}
@ -275,7 +272,7 @@ public class ProWetMaterialPlanServiceImpl implements IProWetMaterialPlanService
// TODO 订单类型
//proWetMaterialPlan.setOrderType();
// TODO 计划工厂编码
//proWetMaterialPlan.setFactoryCode();
//proWetMaterialPlan.setFactoryCode(proOrderWorkorder.getFactoryCode());
// 计划日期
proWetMaterialPlan.setPlanTime(proOrderWorkorder.getPlanTime());
// 同步状态(1已同步0未同步)
@ -300,8 +297,8 @@ public class ProWetMaterialPlanServiceImpl implements IProWetMaterialPlanService
detail.setId(IdUtils.fastSimpleUUID());
// 产品名称
detail.setProductName(workorder.getProductName());
// TODO 计划工厂编码
//detail.setFactoryCode();
// 计划工厂编码(获得的是工单的计划工厂)
detail.setFactoryCode(workorder.getFactoryCode());
// 主计划id
detail.setWetMaterialPlanId(id);
// 工单id

@ -60,6 +60,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="parentOrder != null and parentOrder != ''"> and parent_order = #{parentOrder}</if>
<if test="prodType != null and prodType != ''"> and prod_type = #{prodType}</if>
<if test="prodSpc != null and prodSpc != ''"> and prod_spc = #{prodSpc}</if>
<if test="planDateStart != null "> and CONVERT(varchar(10),plan_pro_date, 120) >= '${planDateStart}'</if>
<if test="planDateEnd != null "> and '${planDateEnd}%' >= CONVERT(varchar(10),plan_pro_date, 120)</if>
</where>
ORDER BY plan_pro_date DESC
</select>

@ -36,7 +36,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectProWetMaterialPlanList" parameterType="ProWetMaterialPlan" resultMap="ProWetMaterialPlanResult">
<include refid="selectProWetMaterialPlanVo"/>
<where>
<if test="syncFlag != null and syncFlag != ''"> and sync_flag = #{syncFlag}</if>
<if test="syncFlag != null and syncFlag != ''"> and sync_flag = #{syncFlag} </if>
<if test="startTime != null ">and CONVERT(date, plan_time) >= #{startTime} </if>
<if test="endTime != null "> and #{endTime} >= CONVERT(date, plan_time)</if>
</where>
</select>
@ -44,11 +46,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectProWetMaterialPlanVo"/>
where id = #{id}
</select>
<select id="selectProWetMaterialPlanListByTime" parameterType="ProWetMaterialPlan" resultMap="ProWetMaterialPlanResult">
<include refid="selectProWetMaterialPlanVo"/>
WHERE CONVERT(date, plan_time) BETWEEN #{startTime} AND #{endTime}
ORDER BY CONVERT(date, plan_time) DESC , sync_flag
</select>
<select id="selectBMSList" resultType="com.op.plan.domain.BMS">
SELECT bucket_id AS 'bucketId', material_id AS 'materialId',shift_id AS 'shiftId'
FROM pro_wet_material_plan_detail

Loading…
Cancel
Save