瀏覽代碼

子绑定优化

zhanghe 1 周之前
父節點
當前提交
0032390fbd
共有 1 個文件被更改,包括 48 次插入4 次删除
  1. 48 4
      src/main/java/com/jeesite/modules/mes/web/MesElectricTorqueController.java

+ 48 - 4
src/main/java/com/jeesite/modules/mes/web/MesElectricTorqueController.java

@@ -9,13 +9,16 @@ import javax.servlet.http.HttpServletResponse;
 import com.jeesite.common.lang.StringUtils;
 import com.jeesite.modules.mes.entity.*;
 import com.jeesite.modules.mes.resp.BindMaterialResp;
+import com.jeesite.modules.mes.resp.ParamsResp;
 import com.jeesite.modules.mes.service.*;
+import com.jeesite.modules.mes.util.CommonUitl;
 import com.jeesite.modules.utils.DateLocalUtils;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.ui.Model;
+import org.springframework.util.ObjectUtils;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
@@ -53,6 +56,9 @@ public class MesElectricTorqueController extends BaseController {
 	@Autowired
 	private MesToolLifeService mesToolLifeService;
 
+	@Autowired
+	private MesProductOprnoService mesProductOprnoService;
+
 
 
 	/**
@@ -62,7 +68,7 @@ public class MesElectricTorqueController extends BaseController {
 	public MesElectricTorque get(String id, boolean isNewRecord) {
 		return mesElectricTorqueService.get(id, isNewRecord);
 	}
-	
+
 	/**
 	 * 查询列表
 	 */
@@ -76,7 +82,7 @@ public class MesElectricTorqueController extends BaseController {
 //		model.addAttribute("mlInfo", mlInfo);
 		return "modules/mes/mesElectricTorqueList";
 	}
-	
+
 	/**
 	 * 查询列表数据
 	 */
@@ -145,7 +151,7 @@ public class MesElectricTorqueController extends BaseController {
 			return renderResult(Global.FALSE, "posfull:"+ex.getMessage());
 		}
 	}
-	
+
 	/**
 	 * 删除数据
 	 */
@@ -236,6 +242,44 @@ public class MesElectricTorqueController extends BaseController {
 				}
 			}
 		}
+		String newOprno = CommonUitl.formatOprno(mesElectricTorque.getOprno());
+		// 如果其他电批枪的结果都不为UDF,则更新总结果
+		if("OP310".equals(newOprno)) {
+			List<ParamsResp> params = new ArrayList<>();
+			ParamsResp paramsResp1 = new ParamsResp();
+			paramsResp1.setCraft("400001");
+			paramsResp1.setResult("OK");
+			paramsResp1.setVal("");
+			params.add(paramsResp1);
+
+			MesProductOprno mesProductOprno = new MesProductOprno();
+			mesProductOprno.setSn(mesElectricTorque.getSn());
+			mesProductOprno.setOprno(newOprno);
+			mesProductOprno.setLineSn("XT");
+			MesProductOprno mesProductOprno1 = mesProductOprnoService.findInfo(mesProductOprno);
+			System.out.println(mesProductOprno1);
+			if(ObjectUtils.isEmpty(mesProductOprno1)){
+				//添加子工位表
+				mesProductOprnoService.save(mesProductOprno);
+				mesProductOprno1 = mesProductOprnoService.findInfo(mesProductOprno);
+			}
+
+				mesProductOprno1.setResult2("OK");
+
+			mesProductOprnoService.save(mesProductOprno1);
+
+			// 全有结果
+			if(mesProductOprno1.getResult1()!=null && !StringUtils.isEmpty(mesProductOprno1.getResult1()) && mesProductOprno1.getResult2()!=null && !StringUtils.isEmpty(mesProductOprno1.getResult2())) {
+				String lastRet = "NG";
+				if (mesProductOprno1.getResult1().equals("OK") && mesProductOprno1.getResult2().equals("OK")) {
+					lastRet = "OK";
+				}
+				// 2.判断物料批次是否符合绑定
+				List<BindMaterialResp> bmlists = mesLineProcessMaterialService.getBindMaterial(mesElectricTorque.getOprno(), "XT");
+				// 总结果产线要求写死“OK”
+				mesProductRecordService.updateRecordResult(mesElectricTorque.getSn(), "OP310", "100000", "", lastRet, "System", params, "XT", true, bmlists);
+			}
+		}
 
 		return renderResult(Global.TRUE, text("操作成功!"));
 	}
@@ -258,4 +302,4 @@ public class MesElectricTorqueController extends BaseController {
 	}
 
 
-}
+}