|
|
@@ -17,6 +17,7 @@ import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.jeesite.common.config.Global;
|
|
|
import com.jeesite.common.entity.Page;
|
|
|
@@ -168,6 +169,7 @@ public class MesProductSaleController extends BaseController {
|
|
|
public String listByShState() {
|
|
|
MesProductSale query = new MesProductSale();
|
|
|
query.setShState("1");
|
|
|
+ query.setMesState("1");
|
|
|
List<MesProductSale> list = mesProductSaleService.findList(query);
|
|
|
return renderResult(Global.TRUE, text("查询成功!"), list);
|
|
|
}
|
|
|
@@ -175,7 +177,8 @@ public class MesProductSaleController extends BaseController {
|
|
|
/**
|
|
|
* 回写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
|
|
|
*/
|
|
|
@PostMapping(value = "updateShipLine")
|
|
|
@@ -194,15 +197,24 @@ public class MesProductSaleController extends BaseController {
|
|
|
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);
|
|
|
requestJson.put("OtherID", StringUtils.defaultString(body.getString("OtherID")));
|
|
|
Integer id = body.getInteger("ID");
|
|
|
requestJson.put("ID", id == null ? 0 : id);
|
|
|
requestJson.put("DocNo", docNo);
|
|
|
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) {
|
|
|
return renderResult(Global.FALSE, text("同步ERP失败!"));
|
|
|
}
|
|
|
@@ -244,6 +256,7 @@ public class MesProductSaleController extends BaseController {
|
|
|
body.put("ID", request.getParameter("ID"));
|
|
|
body.put("DocNo", request.getParameter("DocNo"));
|
|
|
body.put("DocLineNo", request.getParameter("DocLineNo"));
|
|
|
+ body.put("PrivateDescSeg", request.getParameter("PrivateDescSeg"));
|
|
|
body.put("PrivateDescSeg1", request.getParameter("PrivateDescSeg1"));
|
|
|
if (StringUtils.isBlank(body.getString("DocNo")) && StringUtils.isBlank(body.getString("DocLineNo"))) {
|
|
|
return null;
|