Explorar o código

优化PDA销售订单列表显示

sunxianglong hai 2 semanas
pai
achega
2c64192b22

+ 16 - 3
src/main/java/com/jeesite/modules/mes/web/MesProductSaleController.java

@@ -17,6 +17,7 @@ import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.ResponseBody;
 import org.springframework.web.bind.annotation.ResponseBody;
 
 
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
 import com.jeesite.common.config.Global;
 import com.jeesite.common.config.Global;
 import com.jeesite.common.entity.Page;
 import com.jeesite.common.entity.Page;
@@ -168,6 +169,7 @@ public class MesProductSaleController extends BaseController {
 	public String listByShState() {
 	public String listByShState() {
 		MesProductSale query = new MesProductSale();
 		MesProductSale query = new MesProductSale();
 		query.setShState("1");
 		query.setShState("1");
+		query.setMesState("1");
 		List<MesProductSale> list = mesProductSaleService.findList(query);
 		List<MesProductSale> list = mesProductSaleService.findList(query);
 		return renderResult(Global.TRUE, text("查询成功!"), list);
 		return renderResult(Global.TRUE, text("查询成功!"), list);
 	}
 	}
@@ -175,7 +177,8 @@ public class MesProductSaleController extends BaseController {
 	/**
 	/**
 	 * 回写ERP销售出货行(UpdateShipLine)
 	 * 回写ERP销售出货行(UpdateShipLine)
 	 * 入参示例:
 	 * 入参示例:
-	 * {"OtherID":"","ID":0,"DocNo":"100SM2607310002","DocLineNo":"10","PrivateDescSeg1":"mes已完成扫码出库"}
+	 * {"OtherID":"","ID":0,"DocNo":"100SM2607310002","DocLineNo":"10","PrivateDescSeg":"mes已完成扫码出库"}
+	 * 入参 PrivateDescSeg 会转换为 ERP 字段 PrivateDescSeg1
 	 * 同时支持 application/json 与 application/x-www-form-urlencoded
 	 * 同时支持 application/json 与 application/x-www-form-urlencoded
 	 */
 	 */
 	@PostMapping(value = "updateShipLine")
 	@PostMapping(value = "updateShipLine")
@@ -194,15 +197,24 @@ public class MesProductSaleController extends BaseController {
 			return renderResult(Global.FALSE, text("行号不能为空!"));
 			return renderResult(Global.FALSE, text("行号不能为空!"));
 		}
 		}
 
 
+		// 入参 PrivateDescSeg 转为 ERP 字段 PrivateDescSeg1
+		String privateDescSeg = body.getString("PrivateDescSeg");
+		if (StringUtils.isBlank(privateDescSeg)) {
+			privateDescSeg = body.getString("PrivateDescSeg1");
+		}
+
 		JSONObject requestJson = new JSONObject(true);
 		JSONObject requestJson = new JSONObject(true);
 		requestJson.put("OtherID", StringUtils.defaultString(body.getString("OtherID")));
 		requestJson.put("OtherID", StringUtils.defaultString(body.getString("OtherID")));
 		Integer id = body.getInteger("ID");
 		Integer id = body.getInteger("ID");
 		requestJson.put("ID", id == null ? 0 : id);
 		requestJson.put("ID", id == null ? 0 : id);
 		requestJson.put("DocNo", docNo);
 		requestJson.put("DocNo", docNo);
 		requestJson.put("DocLineNo", docLineNo);
 		requestJson.put("DocLineNo", docLineNo);
-		requestJson.put("PrivateDescSeg1", StringUtils.defaultString(body.getString("PrivateDescSeg1")));
+		requestJson.put("PrivateDescSeg1", StringUtils.defaultString(privateDescSeg));
 
 
-		JSONObject response = U9cAuthUtil.updateShipLine(requestJson.toJSONString());
+		// ERP 接口要求请求体为数组:[{...}]
+		JSONArray requestArray = new JSONArray();
+		requestArray.add(requestJson);
+		JSONObject response = U9cAuthUtil.updateShipLine(requestArray.toJSONString());
 		if (response == null) {
 		if (response == null) {
 			return renderResult(Global.FALSE, text("同步ERP失败!"));
 			return renderResult(Global.FALSE, text("同步ERP失败!"));
 		}
 		}
@@ -244,6 +256,7 @@ public class MesProductSaleController extends BaseController {
 		body.put("ID", request.getParameter("ID"));
 		body.put("ID", request.getParameter("ID"));
 		body.put("DocNo", request.getParameter("DocNo"));
 		body.put("DocNo", request.getParameter("DocNo"));
 		body.put("DocLineNo", request.getParameter("DocLineNo"));
 		body.put("DocLineNo", request.getParameter("DocLineNo"));
+		body.put("PrivateDescSeg", request.getParameter("PrivateDescSeg"));
 		body.put("PrivateDescSeg1", request.getParameter("PrivateDescSeg1"));
 		body.put("PrivateDescSeg1", request.getParameter("PrivateDescSeg1"));
 		if (StringUtils.isBlank(body.getString("DocNo")) && StringUtils.isBlank(body.getString("DocLineNo"))) {
 		if (StringUtils.isBlank(body.getString("DocNo")) && StringUtils.isBlank(body.getString("DocLineNo"))) {
 			return null;
 			return null;

+ 1 - 0
src/main/java/com/jeesite/modules/mes/web/MesSaleSnController.java

@@ -157,6 +157,7 @@ public class MesSaleSnController extends BaseController {
 	public String findSaleList() {
 	public String findSaleList() {
 		MesProductSale query = new MesProductSale();
 		MesProductSale query = new MesProductSale();
 		query.setShState("1");
 		query.setShState("1");
+		query.setMesState("1");
 		List<MesProductSale> list = mesProductSaleService.findList(query);
 		List<MesProductSale> list = mesProductSaleService.findList(query);
 		if (list != null) {
 		if (list != null) {
 			for (MesProductSale sale : list) {
 			for (MesProductSale sale : list) {