|
@@ -13,8 +13,12 @@ import com.jeesite.modules.erp.entity.MesProductOrder;
|
|
|
import com.jeesite.modules.erp.service.MesProductOrderService;
|
|
import com.jeesite.modules.erp.service.MesProductOrderService;
|
|
|
import com.jeesite.modules.mes.entity.MesLine;
|
|
import com.jeesite.modules.mes.entity.MesLine;
|
|
|
import com.jeesite.modules.mes.entity.MesProduct;
|
|
import com.jeesite.modules.mes.entity.MesProduct;
|
|
|
|
|
+import com.jeesite.modules.mes.resp.BindMaterialResp;
|
|
|
import com.jeesite.modules.mes.resp.CommonResp;
|
|
import com.jeesite.modules.mes.resp.CommonResp;
|
|
|
|
|
+import com.jeesite.modules.mes.resp.ParamsResp;
|
|
|
|
|
+import com.jeesite.modules.mes.service.MesLineProcessMaterialService;
|
|
|
import com.jeesite.modules.mes.service.MesLineService;
|
|
import com.jeesite.modules.mes.service.MesLineService;
|
|
|
|
|
+import com.jeesite.modules.mes.service.MesProductRecordService;
|
|
|
import com.jeesite.modules.mes.service.MesProductService;
|
|
import com.jeesite.modules.mes.service.MesProductService;
|
|
|
import com.jeesite.modules.sys.entity.User;
|
|
import com.jeesite.modules.sys.entity.User;
|
|
|
import com.jeesite.modules.sys.utils.UserUtils;
|
|
import com.jeesite.modules.sys.utils.UserUtils;
|
|
@@ -23,6 +27,8 @@ import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.context.annotation.Lazy;
|
|
import org.springframework.context.annotation.Lazy;
|
|
|
import org.springframework.stereotype.Controller;
|
|
import org.springframework.stereotype.Controller;
|
|
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
+import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
|
|
import org.springframework.ui.Model;
|
|
import org.springframework.ui.Model;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.ModelAttribute;
|
|
import org.springframework.web.bind.annotation.ModelAttribute;
|
|
@@ -53,6 +59,10 @@ public class MesOrderSnController extends BaseController {
|
|
|
private MesProductService mesProductService;
|
|
private MesProductService mesProductService;
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private MesLineService mesLineService;
|
|
private MesLineService mesLineService;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private MesProductRecordService mesProductRecordService;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private MesLineProcessMaterialService mesLineProcessMaterialService;
|
|
|
@Lazy
|
|
@Lazy
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private MesProductRecordController mesProductRecordController;
|
|
private MesProductRecordController mesProductRecordController;
|
|
@@ -120,12 +130,13 @@ public class MesOrderSnController extends BaseController {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * 生产订单绑定工件码(OP100 工位质量校验通过后方可绑定)
|
|
|
|
|
|
|
+ * 生产订单绑定工件码(OP110 工位质量校验通过后方可绑定;绑定成功后提交 OP100 工位结果为 OK)
|
|
|
* @param mesOrderSn
|
|
* @param mesOrderSn
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|
|
|
@RequestMapping(value = "bandSn")
|
|
@RequestMapping(value = "bandSn")
|
|
|
@ResponseBody
|
|
@ResponseBody
|
|
|
|
|
+ @Transactional
|
|
|
public String bandSn(MesOrderSn mesOrderSn) {
|
|
public String bandSn(MesOrderSn mesOrderSn) {
|
|
|
if (mesOrderSn == null || StringUtils.isBlank(mesOrderSn.getOrderId())) {
|
|
if (mesOrderSn == null || StringUtils.isBlank(mesOrderSn.getOrderId())) {
|
|
|
return renderResult(Global.FALSE, text("订单编码不能为空!"));
|
|
return renderResult(Global.FALSE, text("订单编码不能为空!"));
|
|
@@ -152,15 +163,15 @@ public class MesOrderSnController extends BaseController {
|
|
|
}
|
|
}
|
|
|
String lineSn = lineInfo.getSn();
|
|
String lineSn = lineInfo.getSn();
|
|
|
|
|
|
|
|
- // OP100 质量校验(按子工位 OP100A)
|
|
|
|
|
|
|
+ // OP110 质量校验(按子工位 OP110A);允许本工位已加工(OK/NG)时仍可绑定订单
|
|
|
String userCode = "";
|
|
String userCode = "";
|
|
|
User user = UserUtils.getUser();
|
|
User user = UserUtils.getUser();
|
|
|
if (user != null && StringUtils.isNotEmpty(user.getUserCode())) {
|
|
if (user != null && StringUtils.isNotEmpty(user.getUserCode())) {
|
|
|
userCode = user.getUserCode();
|
|
userCode = user.getUserCode();
|
|
|
}
|
|
}
|
|
|
- String ret = mesProductRecordController.checkQualityCommon("OP100A", sn, lineSn, userCode);
|
|
|
|
|
|
|
+ String ret = mesProductRecordController.checkQualityCommon("OP110A", sn, lineSn, userCode);
|
|
|
String checkret = ret.substring(3, 5);
|
|
String checkret = ret.substring(3, 5);
|
|
|
- if (!"UD".equals(checkret)) {
|
|
|
|
|
|
|
+ if (!"UD".equals(checkret) && !"OK".equalsIgnoreCase(checkret) && !"NG".equalsIgnoreCase(checkret)) {
|
|
|
String lx = ret.substring(0, 3);
|
|
String lx = ret.substring(0, 3);
|
|
|
return renderResult(Global.FALSE, text(ErrorMsg.getErrorMsg(checkret, lx)));
|
|
return renderResult(Global.FALSE, text(ErrorMsg.getErrorMsg(checkret, lx)));
|
|
|
}
|
|
}
|
|
@@ -171,11 +182,41 @@ public class MesOrderSnController extends BaseController {
|
|
|
if(!list.isEmpty()){
|
|
if(!list.isEmpty()){
|
|
|
return renderResult(Global.FALSE, text("该工件已和生产订单绑定!"));
|
|
return renderResult(Global.FALSE, text("该工件已和生产订单绑定!"));
|
|
|
}
|
|
}
|
|
|
- mesOrderSnService.save(mesOrderSn);
|
|
|
|
|
|
|
+
|
|
|
|
|
+ try {
|
|
|
|
|
+ mesOrderSnService.save(mesOrderSn);
|
|
|
|
|
+ // 绑定成功后,将 OP100 工位结果提交为 OK
|
|
|
|
|
+ List<ParamsResp> params = new ArrayList<>();
|
|
|
|
|
+ List<BindMaterialResp> bmlists = mesLineProcessMaterialService.getBindMaterial("OP100A", lineSn);
|
|
|
|
|
+ mesProductRecordService.updateRecordResult(sn, "OP100A", "100000", mesOrderSn.getOrderId(), "OK",
|
|
|
|
|
+ userCode, params, lineSn, true, bmlists, null);
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
|
|
+ return renderResult(Global.FALSE, text(StringUtils.isNotEmpty(e.getMessage()) ? e.getMessage() : "操作失败!"));
|
|
|
|
|
+ }
|
|
|
return renderResult(Global.TRUE, text("保存成功!"));
|
|
return renderResult(Global.TRUE, text("保存成功!"));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
|
|
+ * 根据工件码判断是否已在生产订单工件表中存在
|
|
|
|
|
+ * @param sn 工件码
|
|
|
|
|
+ * @return result=true 表示已存在,false 表示不存在
|
|
|
|
|
+ */
|
|
|
|
|
+ @RequestMapping(value = "existBySn")
|
|
|
|
|
+ @ResponseBody
|
|
|
|
|
+ public String existBySn(String sn) {
|
|
|
|
|
+ if (StringUtils.isBlank(sn)) {
|
|
|
|
|
+ return renderResult(Global.FALSE, text("工件码不能为空!"));
|
|
|
|
|
+ }
|
|
|
|
|
+ MesOrderSn query = new MesOrderSn();
|
|
|
|
|
+ query.setSn(sn);
|
|
|
|
|
+ if (mesOrderSnService.findCount(query) > 0) {
|
|
|
|
|
+ return renderResult(Global.TRUE, text("该工件码已存在!"));
|
|
|
|
|
+ }
|
|
|
|
|
+ return renderResult(Global.FALSE, text("该工件码不存在!"));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
* 生产订单列表
|
|
* 生产订单列表
|
|
|
* @param mesProductOrder
|
|
* @param mesProductOrder
|
|
|
* @return
|
|
* @return
|