Kaynağa Gözat

Merge remote-tracking branch 'origin/master'

dkk 3 ay önce
ebeveyn
işleme
dc258ef03e

+ 1 - 0
src/main/java/com/jeesite/modules/mes/service/MesMaterialLlService.java

@@ -113,6 +113,7 @@ public class MesMaterialLlService extends CrudService<MesMaterialLlDao, MesMater
 		}
 		MesMaterialBl query = new MesMaterialBl();
 		query.setOrderId(entity.getMoDocNo());
+		query.setErpSn(entity.getItemCode());
 		List<MesMaterialBl> blList = mesMaterialBlService.findList(query);
 		if (ListUtils.isEmpty(blList)) {
 			throw new ServiceException(text("未找到对应备料信息!"));

+ 25 - 6
src/main/java/com/jeesite/modules/mes/web/MesProductReportController.java

@@ -114,8 +114,9 @@ public class MesProductReportController extends BaseController {
 	@RequiresPermissions("mes:mesProductReport:edit")
 	@RequestMapping(value = "mesToErp", method = {RequestMethod.GET, RequestMethod.POST})
 	@ResponseBody
-	public String mesToErp(@RequestBody(required = false) String body, HttpServletRequest request) {
-		MesProductReport mesProductReport = resolveMesProductReport(body, request.getParameter("id"));
+	public String mesToErp(@RequestBody(required = false) String body, MesProductReport mesProductReport, HttpServletRequest request) {
+		MesProductReport resolvedReport = resolveMesProductReport(body, mesProductReport, request.getParameter("id"));
+		mesProductReport = resolvedReport;
 		if (mesProductReport == null) {
 			return renderResult(Global.FALSE, text("参数错误!"));
 		}
@@ -197,8 +198,8 @@ public class MesProductReportController extends BaseController {
 		return DateUtils.formatDate(date, "yyyy-MM-dd");
 	}
 
-	private MesProductReport resolveMesProductReport(String body, String idParam) {
-		if (StringUtils.isNotBlank(body)) {
+	private MesProductReport resolveMesProductReport(String body, MesProductReport formReport, String idParam) {
+		if (isJsonBody(body)) {
 			try {
 				return parseMesProductReportBody(body);
 			} catch (Exception e) {
@@ -206,8 +207,12 @@ public class MesProductReportController extends BaseController {
 				return null;
 			}
 		}
-		if (StringUtils.isNotBlank(idParam)) {
-			MesProductReport exist = mesProductReportService.get(new MesProductReport(idParam));
+		if (formReport != null && hasReportFormData(formReport)) {
+			return formReport;
+		}
+		String id = StringUtils.defaultIfBlank(idParam, formReport != null ? formReport.getId() : null);
+		if (StringUtils.isNotBlank(id)) {
+			MesProductReport exist = mesProductReportService.get(new MesProductReport(id));
 			if (exist != null && !exist.getIsNewRecord()) {
 				return exist;
 			}
@@ -215,6 +220,20 @@ public class MesProductReportController extends BaseController {
 		return null;
 	}
 
+	private boolean isJsonBody(String body) {
+		if (StringUtils.isBlank(body)) {
+			return false;
+		}
+		String trimmed = body.trim();
+		return trimmed.startsWith("{") || trimmed.startsWith("[");
+	}
+
+	private boolean hasReportFormData(MesProductReport report) {
+		return StringUtils.isNotBlank(report.getMoDocNo())
+				|| StringUtils.isNotBlank(report.getDocTypeCode())
+				|| StringUtils.isNotBlank(report.getCompleteQty());
+	}
+
 	private MesProductReport parseMesProductReportBody(String body) throws ParseException {
 		String json = body.trim();
 		if (json.startsWith("\"") && json.endsWith("\"") && json.length() >= 2) {

+ 20 - 0
src/main/resources/views/modules/mes/mesMaterialCheckRecordForm.html

@@ -63,6 +63,20 @@
 					<input type="hidden" name="nums" :value="faNums">
 					<div class="col-xs-12">
 						<div class="form-group">
+							<label class="control-label col-sm-2" title="">
+								<span class="required ">*</span> ${text('合格数量')}:<i class="fa icon-question hide"></i></label>
+							<div class="col-sm-4">
+								<input type="number" min="0" class="form-control" name="hgQty" v-model="hgQty">
+							</div>
+							<label class="control-label col-sm-2" title="">
+								<span class="required ">*</span> ${text('不合格数量')}:<i class="fa icon-question hide"></i></label>
+							<div class="col-sm-4">
+								<input type="number" min="0" class="form-control" name="bhgQty" v-model="bhgQty">
+							</div>
+						</div>
+					</div>
+					<div class="col-xs-12">
+						<div class="form-group">
 <!--							<label class="control-label col-sm-2" title="">-->
 <!--								<span class="required ">*</span> ${text('检查内容')}:<i class="fa icon-question hide"></i></label>-->
 							<div class="col-sm-12">
@@ -222,6 +236,8 @@ var vm = new Vue({
 		materialId:"",
 		faDate:"",
 		faNums:0,
+		hgQty:"",
+		bhgQty:"",
 		state:"1",
 		options:[]
 	},
@@ -387,6 +403,8 @@ var vm = new Vue({
 					that.materialId="";
 					that.faDate="";
 					that.faNums=0;
+					that.hgQty="";
+					that.bhgQty="";
 					that.options=[];
 					that.formatData();
 				}else {
@@ -435,6 +453,8 @@ var vm = new Vue({
 								 that.materialId="";
 								 that.faDate="";
 								 that.faNums=0;
+								 that.hgQty="";
+								 that.bhgQty="";
 								 that.options=[];
 								 that.formatData();
 							 }else {

+ 18 - 0
src/main/resources/views/modules/mes/mesMaterialCheckRecordFormEdit.html

@@ -63,6 +63,24 @@
                 <div class="col-xs-6">
                     <div class="form-group">
                         <label class="control-label col-sm-4" title="">
+                            <span class="required hide">*</span> ${text('合格数量')}:<i class="fa icon-question hide"></i></label>
+                        <div class="col-sm-8">
+                            <#form:input path="hgQty" maxlength="20" class="form-control digits"/>
+                        </div>
+                    </div>
+                </div>
+                <div class="col-xs-6">
+                    <div class="form-group">
+                        <label class="control-label col-sm-4" title="">
+                            <span class="required hide">*</span> ${text('不合格数量')}:<i class="fa icon-question hide"></i></label>
+                        <div class="col-sm-8">
+                            <#form:input path="bhgQty" maxlength="20" class="form-control digits"/>
+                        </div>
+                    </div>
+                </div>
+                <div class="col-xs-6">
+                    <div class="form-group">
+                        <label class="control-label col-sm-4" title="">
                             <span class="required ">*</span> ${text('结果')}:<i class="fa icon-question hide"></i></label>
                         <div class="col-sm-8">
                             <#form:select path="state" dictType="mes_material_check_record_state" readonly="true" class="form-control required" />

+ 8 - 0
src/main/resources/views/modules/mes/mesMaterialCheckRecordInfo.html

@@ -33,6 +33,14 @@
 				<td>${mesMaterialCheckRecord.nums}</td>
 			</tr>
 				<tr>
+					<th class="mpc-header">合格数量</th>
+					<td>${mesMaterialCheckRecord.hgQty}</td>
+				</tr>
+				<tr>
+					<th class="mpc-header">不合格数量</th>
+					<td>${mesMaterialCheckRecord.bhgQty}</td>
+				</tr>
+				<tr>
 					<th class="mpc-header">结果</th>
 					<td>${@DictUtils.getDictLabel("mes_material_check_record_state",mesMaterialCheckRecord.state,"未知")}</td>
 				</tr>