소스 검색

mes辅助优化

zhanghe 5 달 전
부모
커밋
87483681ca

+ 32 - 12
src/main/java/com/jeesite/modules/mes/service/MesProductCateService.java

@@ -1,5 +1,6 @@
 package com.jeesite.modules.mes.service;
 
+import java.util.Iterator;
 import java.util.List;
 
 import com.jeesite.common.collect.ListUtils;
@@ -66,7 +67,7 @@ public class MesProductCateService extends CrudService<MesProductCateDao, MesPro
 		List<MesTemplateItems> lists = mesTemplateItemsService.findListItems(mesProductCate2.getTemplateId());
 		return lists;
 	}
-	
+
 	/**
 	 * 查询分页数据
 	 * @param mesProductCate 查询条件
@@ -77,7 +78,7 @@ public class MesProductCateService extends CrudService<MesProductCateDao, MesPro
 	public Page<MesProductCate> findPage(MesProductCate mesProductCate) {
 		return super.findPage(mesProductCate);
 	}
-	
+
 	/**
 	 * 查询列表数据
 	 * @param mesProductCate
@@ -87,7 +88,7 @@ public class MesProductCateService extends CrudService<MesProductCateDao, MesPro
 	public List<MesProductCate> findList(MesProductCate mesProductCate) {
 		return super.findList(mesProductCate);
 	}
-	
+
 	/**
 	 * 保存数据(插入或更新)
 	 * @param mesProductCate
@@ -97,7 +98,7 @@ public class MesProductCateService extends CrudService<MesProductCateDao, MesPro
 	public void save(MesProductCate mesProductCate) {
 		super.save(mesProductCate);
 	}
-	
+
 	/**
 	 * 更新状态
 	 * @param mesProductCate
@@ -107,7 +108,7 @@ public class MesProductCateService extends CrudService<MesProductCateDao, MesPro
 	public void updateStatus(MesProductCate mesProductCate) {
 		super.updateStatus(mesProductCate);
 	}
-	
+
 	/**
 	 * 删除数据
 	 * @param mesProductCate
@@ -140,8 +141,26 @@ public class MesProductCateService extends CrudService<MesProductCateDao, MesPro
 		return false;
 	}
 
+//	// 获取工件码类型
+//	public MesProductCate getCateBySn(String sn){
+//		MesProductCate mesProductModel = new MesProductCate();
+//		mesProductModel.setStatus("0");
+//		List<MesProductCate> lists = findList(mesProductModel);
+//		if(ListUtils.isEmpty(lists)){
+//			return null;
+//		}
+//
+//		for(MesProductCate mesProductModel2 : lists){
+//			Boolean ret = CommonUitl.checkSnByModel(sn,mesProductModel2.getSpec(),mesProductModel2.getSpecStart(),mesProductModel2.getLength());
+//			if(ret){
+//				return mesProductModel2;
+//			}
+//		}
+//
+//		return null;
+//	}
 	// 获取工件码类型
-	public MesProductCate getCateBySn(String sn){
+	public List<MesProductCate> getCateBySn(String sn){
 		MesProductCate mesProductModel = new MesProductCate();
 		mesProductModel.setStatus("0");
 		List<MesProductCate> lists = findList(mesProductModel);
@@ -149,15 +168,16 @@ public class MesProductCateService extends CrudService<MesProductCateDao, MesPro
 			return null;
 		}
 
-		for(MesProductCate mesProductModel2 : lists){
+		Iterator<MesProductCate> iterator = lists.iterator();
+		while(((Iterator<?>) iterator).hasNext()){
+			MesProductCate mesProductModel2 = iterator.next();
 			Boolean ret = CommonUitl.checkSnByModel(sn,mesProductModel2.getSpec(),mesProductModel2.getSpecStart(),mesProductModel2.getLength());
-			if(ret){
-				return mesProductModel2;
+			if(!ret){
+				iterator.remove();
 			}
 		}
 
-		return null;
+		return lists.isEmpty() ? null : lists;
 	}
 
-
-}
+}

+ 10 - 10
src/main/java/com/jeesite/modules/mes/service/MesProductRecordService.java

@@ -195,7 +195,7 @@ public class MesProductRecordService extends CrudService<MesProductRecordDao, Me
 		mesProductRecord.setLineSn(cate);
 		return mesProductRecordDao.findInfo(mesProductRecord);
 	}
-	
+
 	/**
 	 * 查询分页数据
 	 * @param mesProductRecord 查询条件
@@ -295,7 +295,7 @@ public class MesProductRecordService extends CrudService<MesProductRecordDao, Me
 			mesProductService.save(mesProduct);
 		}
 	}
-	
+
 	/**
 	 * 保存数据(插入或更新) 生产订单,仅生成模板
 	 * @param mesProductRecord
@@ -322,14 +322,14 @@ public class MesProductRecordService extends CrudService<MesProductRecordDao, Me
 				MesProductRecord mpr1 = new MesProductRecord();
 				mpr1.setSn(mesProductRecord.getSn());
 				mpr1.setPid("0");
-				mpr1.setCateSn(cateSn);
-				mpr1.setLineSn(mesProductRecord.getLineSn());
-				mpr1.setCraft(mesTemplateItems.getCraft());
-				mpr1.setOprno(mesTemplateItems.getOprno());
+				mpr1.setCateSn(cateSn);//工件类型
+				mpr1.setLineSn(mesProductRecord.getLineSn());//产线编号
+				mpr1.setCraft(mesTemplateItems.getCraft());//工艺号
+				mpr1.setOprno(mesTemplateItems.getOprno());//
 				mpr1.setSerial(i);
 				mpr1.setTid(mesTemplateItems.getId());
 				mpr1.setTreeLevel(0);
-				mpr1.setCdate(cdate);
+				mpr1.setCdate(cdate);//排序字段
 				mpr1.setContent("UDF");
 				if(mesTemplateItems.getOprno().equals(oprno)){
 					mpr1.setOprno(mesProductRecord.getOprno());
@@ -1050,7 +1050,7 @@ public class MesProductRecordService extends CrudService<MesProductRecordDao, Me
 
 
 	}
-	
+
 	/**
 	 * 更新状态
 	 * @param mesProductRecord
@@ -1060,7 +1060,7 @@ public class MesProductRecordService extends CrudService<MesProductRecordDao, Me
 	public void updateStatus(MesProductRecord mesProductRecord) {
 		super.updateStatus(mesProductRecord);
 	}
-	
+
 	/**
 	 * 删除数据
 	 * @param mesProductRecord
@@ -1252,4 +1252,4 @@ public class MesProductRecordService extends CrudService<MesProductRecordDao, Me
 		query.getSqlMap().getWhere().and("oprno", QueryType.LIKE, fOprno);
 		return findList(query);
 	}
-}
+}