工单和产品编号规则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.util.CommonUtils;
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.mapper.CustomerMeasureMapper;
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.List;
import java.util.stream.Collectors;
/**
* @Description: 工单订单完工
@ -184,6 +186,11 @@ public class WorkOrderServiceImpl extends ServiceImpl<WorkOrderMapper, WorkOrder
@Autowired
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();
productModel.setProductName(ogModel.getGoodsName());
productModel.setProductCode(CreateProductCode(workOrder.getProductCode()));// 产品编号
productModel.setProductCode(CreateProductCode(workOrder.getProductCode(),workOrder.getId()));// 产品编号
productModel.setWorkOrderId(workOrder.getId());//_ 工单id
// productModel.setProduceTime("");// 生产时间
// productModel.setTotalManualTmu("");// 合计(手工TMU)
@ -608,14 +615,10 @@ public class WorkOrderServiceImpl extends ServiceImpl<WorkOrderMapper, WorkOrder
*/
private String CreateWorkCode(String styleCode,String modelCode)
{//编号规则:款式编号(10)+型号(4)+顺序号(8)
String mrstr = "00000000";
QueryWrapper<WorkOrder> query = new QueryWrapper<WorkOrder>();
int listsize = baseMapper.selectList(query).size();
int strsize = listsize+1;
String str = strsize+"";
int strlength = str.length();
String substr = mrstr.substring(0,mrstr.length()-strlength);
String workCode = styleCode+modelCode+substr+str;
List<WorkOrder> list = workOrderService.list();
List<String> collect = list.stream().map(WorkOrder::getProductCode).collect(Collectors.toList());
String OrdersNum = String.format("%08d", zyClothsTypeService.getListMax(collect, 8));
String workCode = styleCode+modelCode+OrdersNum;
return workCode;
}
@ -624,16 +627,14 @@ public class WorkOrderServiceImpl extends ServiceImpl<WorkOrderMapper, WorkOrder
* @param workCode 工单编号
* @return
*/
private String CreateProductCode(String workCode)
private String CreateProductCode(String workCode,String workId)
{//编号规则:工单编号(22)+顺序号(8)
String mrstr = "00000000";
QueryWrapper<ZyProduct> query = new QueryWrapper<ZyProduct>();
int listsize = productMapper.selectList(query).size();
int strsize = listsize+1;
String str = strsize+"";
int strlength = str.length();
String substr = mrstr.substring(0,mrstr.length()-strlength);
String produceCode = workCode+substr+str;
query.eq("work_order_id",workId);
List<ZyProduct> list = productMapper.selectList(query);
List<String> collect = list.stream().map(ZyProduct::getProductCode).collect(Collectors.toList());
String OrdersNum = String.format("%08d", zyClothsTypeService.getListMax(collect, 8));
String produceCode = workCode+OrdersNum;
return produceCode;
}

Loading…
Cancel
Save