|
@@ -13,7 +13,11 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
import com.jeesite.common.lang.DateUtils;
|
|
import com.jeesite.common.lang.DateUtils;
|
|
|
import com.jeesite.common.lang.StringUtils;
|
|
import com.jeesite.common.lang.StringUtils;
|
|
|
import com.jeesite.modules.mes.entity.MesMaterial;
|
|
import com.jeesite.modules.mes.entity.MesMaterial;
|
|
|
|
|
+import com.jeesite.modules.mes.entity.MesMaterialCheckRecord;
|
|
|
|
|
+import com.jeesite.modules.mes.entity.MesMaterialReport;
|
|
|
import com.jeesite.modules.mes.resp.CommonResp;
|
|
import com.jeesite.modules.mes.resp.CommonResp;
|
|
|
|
|
+import com.jeesite.modules.mes.service.MesMaterialCheckRecordService;
|
|
|
|
|
+import com.jeesite.modules.mes.service.MesMaterialReportService;
|
|
|
import com.jeesite.modules.mes.service.MesMaterialService;
|
|
import com.jeesite.modules.mes.service.MesMaterialService;
|
|
|
import com.jeesite.modules.mes.util.U9cAuthUtil;
|
|
import com.jeesite.modules.mes.util.U9cAuthUtil;
|
|
|
import com.jeesite.modules.sys.utils.EmpUtils;
|
|
import com.jeesite.modules.sys.utils.EmpUtils;
|
|
@@ -30,6 +34,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
|
|
|
|
|
import com.jeesite.common.config.Global;
|
|
import com.jeesite.common.config.Global;
|
|
|
|
|
+import com.jeesite.common.entity.DataEntity;
|
|
|
import com.jeesite.common.entity.Page;
|
|
import com.jeesite.common.entity.Page;
|
|
|
import com.jeesite.common.web.BaseController;
|
|
import com.jeesite.common.web.BaseController;
|
|
|
import com.jeesite.modules.mes.entity.MesMaterialRk;
|
|
import com.jeesite.modules.mes.entity.MesMaterialRk;
|
|
@@ -50,6 +55,12 @@ public class MesMaterialRkController extends BaseController {
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private MesMaterialService mesMaterialService;
|
|
private MesMaterialService mesMaterialService;
|
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private MesMaterialCheckRecordService mesMaterialCheckRecordService;
|
|
|
|
|
+
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private MesMaterialReportService mesMaterialReportService;
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 获取数据
|
|
* 获取数据
|
|
|
*/
|
|
*/
|
|
@@ -148,6 +159,8 @@ public class MesMaterialRkController extends BaseController {
|
|
|
String materialCode = req.getParameter("materialCode");
|
|
String materialCode = req.getParameter("materialCode");
|
|
|
CommonResp<Map<String, Object>> resp = new CommonResp<>();
|
|
CommonResp<Map<String, Object>> resp = new CommonResp<>();
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
if (StringUtils.isBlank(materialCode)) {
|
|
if (StringUtils.isBlank(materialCode)) {
|
|
|
resp.setResult(Global.FALSE);
|
|
resp.setResult(Global.FALSE);
|
|
|
resp.setMessage("来料码不能为空!");
|
|
resp.setMessage("来料码不能为空!");
|
|
@@ -214,6 +227,27 @@ public class MesMaterialRkController extends BaseController {
|
|
|
return resp;
|
|
return resp;
|
|
|
}
|
|
}
|
|
|
String unit=list.get(0).getUnit();
|
|
String unit=list.get(0).getUnit();
|
|
|
|
|
+
|
|
|
|
|
+ // 入库前校验:必须已报检且已来料检查,否则不允许入库
|
|
|
|
|
+ MesMaterialReport reportQuery = new MesMaterialReport();
|
|
|
|
|
+ reportQuery.setSn(materialCode.trim());
|
|
|
|
|
+ reportQuery.setStatus(DataEntity.STATUS_NORMAL);
|
|
|
|
|
+ MesMaterialReport report = mesMaterialReportService.findInfo(reportQuery);
|
|
|
|
|
+ if (report == null) {
|
|
|
|
|
+ resp.setResult(Global.FALSE);
|
|
|
|
|
+ resp.setMessage("该来料码未报检,无法入库!");
|
|
|
|
|
+ return resp;
|
|
|
|
|
+ }
|
|
|
|
|
+ MesMaterialCheckRecord checkQuery = new MesMaterialCheckRecord();
|
|
|
|
|
+ checkQuery.setSn(materialCode.trim());
|
|
|
|
|
+ checkQuery.setStatus(DataEntity.STATUS_NORMAL);
|
|
|
|
|
+ MesMaterialCheckRecord checkRecord = mesMaterialCheckRecordService.findInfo(checkQuery);
|
|
|
|
|
+ if (checkRecord == null) {
|
|
|
|
|
+ resp.setResult(Global.FALSE);
|
|
|
|
|
+ resp.setMessage("该来料码未检查,无法入库!");
|
|
|
|
|
+ return resp;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
HashMap<String, Object> data = new HashMap<>();
|
|
HashMap<String, Object> data = new HashMap<>();
|
|
|
// data.put("materialCode", materialCode); // 来料码
|
|
// data.put("materialCode", materialCode); // 来料码
|
|
|
data.put("docTypeCode", docTypeCode); // ERP代码/单据类型编码
|
|
data.put("docTypeCode", docTypeCode); // ERP代码/单据类型编码
|
|
@@ -226,6 +260,12 @@ public class MesMaterialRkController extends BaseController {
|
|
|
data.put("pcQty", pcQty); // 批次数量
|
|
data.put("pcQty", pcQty); // 批次数量
|
|
|
data.put("unit", unit); // 单位
|
|
data.put("unit", unit); // 单位
|
|
|
|
|
|
|
|
|
|
+ // 按来料码关联来料检查记录,带回合格/不合格数量,仅供 PDA 入库页初始显示(不覆盖手填,不参与 mesToErp)
|
|
|
|
|
+ String hgQty = StringUtils.defaultIfBlank(checkRecord.getHgQty(), "");
|
|
|
|
|
+ String bhgQty = StringUtils.defaultIfBlank(checkRecord.getBhgQty(), "");
|
|
|
|
|
+ data.put("hgQty", hgQty); // 合格数量(来自检查记录)
|
|
|
|
|
+ data.put("bhgQty", bhgQty); // 不合格数量(来自检查记录)
|
|
|
|
|
+
|
|
|
resp.setData(data);
|
|
resp.setData(data);
|
|
|
resp.setResult(Global.TRUE);
|
|
resp.setResult(Global.TRUE);
|
|
|
resp.setMessage("解析成功");
|
|
resp.setMessage("解析成功");
|