|
|
@@ -431,7 +431,7 @@ public class MesProductRecordController extends BaseController {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 保存数据
|
|
|
+ * 保存数据 创建生产订单,都可以创建----
|
|
|
*/
|
|
|
// @RequiresPermissions("mes:mesProductRecord:edit")
|
|
|
@PostMapping(value = "save")
|
|
|
@@ -450,7 +450,8 @@ public class MesProductRecordController extends BaseController {
|
|
|
if(ObjectUtils.isEmpty(mesLine)){
|
|
|
return renderResult(Global.FALSE, text("产线编号不正确!"));
|
|
|
}
|
|
|
- MesProductRecord mpr = mesProductRecordService.findBySnCate(mesProductRecord.getSn());
|
|
|
+ String cateSn = mesLine.getProductCate();
|
|
|
+ MesProductRecord mpr = mesProductRecordService.findBySnCate(mesProductRecord.getSn(),cateSn);
|
|
|
if(!ObjectUtils.isEmpty(mpr)){
|
|
|
return renderResult(Global.FALSE, text("产品编号重复!"));
|
|
|
}
|
|
|
@@ -470,7 +471,7 @@ public class MesProductRecordController extends BaseController {
|
|
|
|
|
|
mesProductRecord.setOprno(mesLineProcess1.getOprno());
|
|
|
mesProductRecord.setLineSn(mesLineProcess1.getLineSn());
|
|
|
- mesProductRecord.setCateSn(mesLine.getProductCate());
|
|
|
+ mesProductRecord.setCateSn(cateSn);
|
|
|
|
|
|
mesProductRecordService.add(mesProductRecord,params,null);
|
|
|
}catch (Exception e){
|
|
|
@@ -2820,7 +2821,7 @@ public class MesProductRecordController extends BaseController {
|
|
|
return "modules/mes/mesProductRecordWinfo";
|
|
|
}
|
|
|
|
|
|
- // OP040查询工件是否创建订单
|
|
|
+ // OP010查询工件是否创建订单
|
|
|
@PostMapping(value = "queryProduct")
|
|
|
@ResponseBody
|
|
|
public CommonResp queryProduct(HttpServletRequest request) {
|
|
|
@@ -2842,12 +2843,13 @@ public class MesProductRecordController extends BaseController {
|
|
|
return resp;
|
|
|
}
|
|
|
|
|
|
- // OP040 手动创建订单
|
|
|
+ // OP010 手动创建订单
|
|
|
@PostMapping(value = "createProduct")
|
|
|
@ResponseBody
|
|
|
public CommonResp createProduct(HttpServletRequest request) {
|
|
|
CommonResp<String> resp = new CommonResp<>();
|
|
|
- String sn = request.getParameter("sn");
|
|
|
+// String mesProductCatesn = request.getParameter("mesProductCatesn");//产线编号
|
|
|
+ String sn = request.getParameter("sn");//工件码
|
|
|
if(StringUtils.isEmpty(sn)){
|
|
|
resp.setResult(Global.FALSE);
|
|
|
resp.setMessage("参数错误");
|
|
|
@@ -2861,60 +2863,63 @@ public class MesProductRecordController extends BaseController {
|
|
|
return resp;
|
|
|
}
|
|
|
|
|
|
- MesProductCate mesProductCate = mesProductCateService.getCateBySn(sn);
|
|
|
- String cate = mesProductCate.getSn();
|
|
|
+ List<MesProductCate> mesProductCateLists = mesProductCateService.getCateBySn(sn);
|
|
|
+ for(MesProductCate mesProductModel : mesProductCateLists){
|
|
|
+ String cate = mesProductModel.getSn();
|
|
|
|
|
|
- MesLine mesLine = new MesLine();
|
|
|
- mesLine.setProductCate(cate);
|
|
|
- MesLine mesLine1 = mesLineService.findInfo(mesLine);
|
|
|
- if(ObjectUtils.isEmpty(mesLine1)){
|
|
|
- resp.setResult(Global.FALSE);
|
|
|
- resp.setMessage("产线未配置");
|
|
|
- return resp;
|
|
|
- }
|
|
|
+ MesLine mesLine = new MesLine();
|
|
|
+ mesLine.setProductCate(cate);
|
|
|
+ MesLine mesLine1 = mesLineService.findInfo(mesLine);
|
|
|
+ if(ObjectUtils.isEmpty(mesLine1)){
|
|
|
+ resp.setResult(Global.FALSE);
|
|
|
+ resp.setMessage("产线未配置");
|
|
|
+ return resp;
|
|
|
+ }
|
|
|
|
|
|
- MesProductRecord mesProductRecord2 = mesProductRecordService.findBySnCate(sn,cate);
|
|
|
- if(!ObjectUtils.isEmpty(mesProductRecord2)){
|
|
|
- resp.setResult(Global.FALSE);
|
|
|
- resp.setMessage("该工件已创建订单,勿重复操作");
|
|
|
- return resp;
|
|
|
- }
|
|
|
+ MesProductRecord mesProductRecord2 = mesProductRecordService.findBySnCate(sn,cate);
|
|
|
+ if(!ObjectUtils.isEmpty(mesProductRecord2)){
|
|
|
+ resp.setResult(Global.FALSE);
|
|
|
+ resp.setMessage("该工件已创建订单,勿重复操作");
|
|
|
+ return resp;
|
|
|
+ }
|
|
|
|
|
|
- // 获取上线工位
|
|
|
- MesLineProcess mesLineProcess = new MesLineProcess();
|
|
|
- mesLineProcess.setLineId(mesLine.getId());
|
|
|
- mesLineProcess.setType("4");
|
|
|
- MesLineProcess mesLineProcess1 = mesLineProcessService.findInfo(mesLineProcess);
|
|
|
- if(ObjectUtils.isEmpty(mesLineProcess1)){
|
|
|
- resp.setResult(Global.FALSE);
|
|
|
- resp.setMessage("未配置上线工位");
|
|
|
- return resp;
|
|
|
- }
|
|
|
+ // 获取上线工位
|
|
|
+ MesLineProcess mesLineProcess = new MesLineProcess();
|
|
|
+ mesLineProcess.setLineId(mesLine.getId());
|
|
|
+ mesLineProcess.setType("4");
|
|
|
+ MesLineProcess mesLineProcess1 = mesLineProcessService.findInfo(mesLineProcess);
|
|
|
+ if(ObjectUtils.isEmpty(mesLineProcess1)){
|
|
|
+ resp.setResult(Global.FALSE);
|
|
|
+ resp.setMessage("未配置上线工位");
|
|
|
+ return resp;
|
|
|
+ }
|
|
|
|
|
|
- MesProductRecord mesProductRecord = new MesProductRecord();
|
|
|
- mesProductRecord.setSn(sn);
|
|
|
- mesProductRecord.setOprno(mesLineProcess1.getOprno());
|
|
|
- mesProductRecord.setLineSn(mesLineProcess1.getLineSn());
|
|
|
- mesProductRecord.setContent("UDF");
|
|
|
- mesProductRecord.setCateSn(cate);
|
|
|
+ MesProductRecord mesProductRecord = new MesProductRecord();
|
|
|
+ mesProductRecord.setSn(sn);
|
|
|
+ mesProductRecord.setOprno(mesLineProcess1.getOprno());
|
|
|
+ mesProductRecord.setLineSn(mesLineProcess1.getLineSn());
|
|
|
+ mesProductRecord.setContent("UDF");
|
|
|
+ mesProductRecord.setCateSn(cate);
|
|
|
+
|
|
|
+ // 质量上传,解析参数
|
|
|
+ String ret = "RSNS";
|
|
|
+ try{
|
|
|
+ List<ParamsResp> params = new ArrayList<>();
|
|
|
+ List<BindMaterialResp> bmlists = new ArrayList<>();
|
|
|
+ ret = mesProductRecordService.add(mesProductRecord,params,bmlists);
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ ret = "RSNS";
|
|
|
+ }
|
|
|
|
|
|
- // 质量上传,解析参数
|
|
|
- String ret = "RSNS";
|
|
|
- try{
|
|
|
- List<ParamsResp> params = new ArrayList<>();
|
|
|
- List<BindMaterialResp> bmlists = new ArrayList<>();
|
|
|
- ret = mesProductRecordService.add(mesProductRecord,params,bmlists);
|
|
|
- }catch (Exception e){
|
|
|
- e.printStackTrace();
|
|
|
- ret = "RSNS";
|
|
|
+ if(ret.equals("RSOK")){
|
|
|
+ resp.setResult(Global.TRUE);
|
|
|
+ }else{
|
|
|
+ resp.setResult(Global.FALSE);
|
|
|
+ resp.setMessage("该工件创建订单失败");
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- if(ret.equals("RSOK")){
|
|
|
- resp.setResult(Global.TRUE);
|
|
|
- }else{
|
|
|
- resp.setResult(Global.FALSE);
|
|
|
- resp.setMessage("该工件创建订单失败");
|
|
|
- }
|
|
|
return resp;
|
|
|
}
|
|
|
|
|
|
@@ -3136,7 +3141,7 @@ public class MesProductRecordController extends BaseController {
|
|
|
return resp;
|
|
|
}
|
|
|
|
|
|
- MesProductCate mesProductCate = mesProductCateService.getCateBySn(sn);
|
|
|
+ List<MesProductCate> mesProductCate = mesProductCateService.getCateBySn(sn);
|
|
|
if(ObjectUtils.isEmpty(mesProductCate)){
|
|
|
resp.setResult(Global.FALSE);
|
|
|
resp.setMessage("工件码格式错误");
|