工单和产品编号规则bug

master
Gitea 2 years ago
parent 781a7d6db3
commit 894776036e
  1. 35
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/workorder/service/impl/WorkOrderServiceImpl.java

@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.jeecg.common.api.vo.Result; import org.jeecg.common.api.vo.Result;
import org.jeecg.common.util.CommonUtils; import org.jeecg.common.util.CommonUtils;
import org.jeecg.modules.demo.base.mapper.ZyProcessMapper; import org.jeecg.modules.demo.base.mapper.ZyProcessMapper;
import org.jeecg.modules.demo.base.service.IZyClothsTypeService;
import org.jeecg.modules.demo.customermeasure.entity.CustomerMeasure; import org.jeecg.modules.demo.customermeasure.entity.CustomerMeasure;
import org.jeecg.modules.demo.customermeasure.mapper.CustomerMeasureMapper; import org.jeecg.modules.demo.customermeasure.mapper.CustomerMeasureMapper;
import org.jeecg.modules.demo.ordergoods.entity.OrderGoods; import org.jeecg.modules.demo.ordergoods.entity.OrderGoods;
@ -71,6 +72,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
/** /**
* @Description: 工单订单完工 * @Description: 工单订单完工
@ -184,6 +186,11 @@ public class WorkOrderServiceImpl extends ServiceImpl<WorkOrderMapper, WorkOrder
@Autowired @Autowired
private ZySpeechMessageMapper zySpeechMessageMapper; private ZySpeechMessageMapper zySpeechMessageMapper;
@Autowired
private IWorkOrderService workOrderService;
@Autowired
private IZyClothsTypeService zyClothsTypeService;
/** /**
* 自定义分页查询 * 自定义分页查询
@ -278,7 +285,7 @@ public class WorkOrderServiceImpl extends ServiceImpl<WorkOrderMapper, WorkOrder
{ {
ZyProduct productModel=new ZyProduct(); ZyProduct productModel=new ZyProduct();
productModel.setProductName(ogModel.getGoodsName()); productModel.setProductName(ogModel.getGoodsName());
productModel.setProductCode(CreateProductCode(workOrder.getProductCode()));// 产品编号 productModel.setProductCode(CreateProductCode(workOrder.getProductCode(),workOrder.getId()));// 产品编号
productModel.setWorkOrderId(workOrder.getId());//_ 工单id productModel.setWorkOrderId(workOrder.getId());//_ 工单id
// productModel.setProduceTime("");// 生产时间 // productModel.setProduceTime("");// 生产时间
// productModel.setTotalManualTmu("");// 合计(手工TMU) // productModel.setTotalManualTmu("");// 合计(手工TMU)
@ -608,14 +615,10 @@ public class WorkOrderServiceImpl extends ServiceImpl<WorkOrderMapper, WorkOrder
*/ */
private String CreateWorkCode(String styleCode,String modelCode) private String CreateWorkCode(String styleCode,String modelCode)
{//编号规则:款式编号(10)+型号(4)+顺序号(8) {//编号规则:款式编号(10)+型号(4)+顺序号(8)
String mrstr = "00000000"; List<WorkOrder> list = workOrderService.list();
QueryWrapper<WorkOrder> query = new QueryWrapper<WorkOrder>(); List<String> collect = list.stream().map(WorkOrder::getProductCode).collect(Collectors.toList());
int listsize = baseMapper.selectList(query).size(); String OrdersNum = String.format("%08d", zyClothsTypeService.getListMax(collect, 8));
int strsize = listsize+1; String workCode = styleCode+modelCode+OrdersNum;
String str = strsize+"";
int strlength = str.length();
String substr = mrstr.substring(0,mrstr.length()-strlength);
String workCode = styleCode+modelCode+substr+str;
return workCode; return workCode;
} }
@ -624,16 +627,14 @@ public class WorkOrderServiceImpl extends ServiceImpl<WorkOrderMapper, WorkOrder
* @param workCode 工单编号 * @param workCode 工单编号
* @return * @return
*/ */
private String CreateProductCode(String workCode) private String CreateProductCode(String workCode,String workId)
{//编号规则:工单编号(22)+顺序号(8) {//编号规则:工单编号(22)+顺序号(8)
String mrstr = "00000000";
QueryWrapper<ZyProduct> query = new QueryWrapper<ZyProduct>(); QueryWrapper<ZyProduct> query = new QueryWrapper<ZyProduct>();
int listsize = productMapper.selectList(query).size(); query.eq("work_order_id",workId);
int strsize = listsize+1; List<ZyProduct> list = productMapper.selectList(query);
String str = strsize+""; List<String> collect = list.stream().map(ZyProduct::getProductCode).collect(Collectors.toList());
int strlength = str.length(); String OrdersNum = String.format("%08d", zyClothsTypeService.getListMax(collect, 8));
String substr = mrstr.substring(0,mrstr.length()-strlength); String produceCode = workCode+OrdersNum;
String produceCode = workCode+substr+str;
return produceCode; return produceCode;
} }

Loading…
Cancel
Save