From f1dd60bf7e3af8564848d1c0fab886759f827a2b Mon Sep 17 00:00:00 2001
From: "DESKTOP-5DIJMF9\\admin" <2388969634@qq.com>
Date: Wed, 1 Jan 2025 08:48:00 +0800
Subject: [PATCH] =?UTF-8?q?opt:=E6=8F=90=E4=BA=A4=E6=9C=80=E6=96=B0?=
=?UTF-8?q?=E4=BB=A3=E7=A0=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../mes/api/md/me/api/MaterialService.java | 13 ++++
.../app/products/mes/md/me/material_query.jsp | 59 +++++++++++++++----
.../products/mes/md/me/material_update.jsp | 2 +-
.../service/ifs/sap/SapToWmsServiceImpl.java | 27 ++++++---
.../service/md/me/MaterialServiceImpl.java | 36 ++++++++++-
5 files changed, 117 insertions(+), 20 deletions(-)
diff --git a/lxapi/com/noblelift/imp/products/mes/api/md/me/api/MaterialService.java b/lxapi/com/noblelift/imp/products/mes/api/md/me/api/MaterialService.java
index b51df4f..7c36386 100644
--- a/lxapi/com/noblelift/imp/products/mes/api/md/me/api/MaterialService.java
+++ b/lxapi/com/noblelift/imp/products/mes/api/md/me/api/MaterialService.java
@@ -134,6 +134,19 @@ public interface MaterialService {
* @return
*/
public ServiceResultBean delete(ServiceContext ctx, String accountId, String material_uuid);
+ /**
+ *
+ * @discription 删除物料维护页面的grid数据
+ * @author lmyu
+ * @created 2018年11月1日 下午4:21:23
+ * @param ctx
+ * 上下文
+ * @param accountId
+ * @param material_uuid
+ * 主键
+ * @return
+ */
+ public ServiceResultBean add1061(ServiceContext ctx, String accountId, String material_uuid);
/**
*
diff --git a/lxapp/app/products/mes/md/me/material_query.jsp b/lxapp/app/products/mes/md/me/material_query.jsp
index aae3879..8740658 100644
--- a/lxapp/app/products/mes/md/me/material_query.jsp
+++ b/lxapp/app/products/mes/md/me/material_query.jsp
@@ -164,16 +164,53 @@
}
//添加物料
function add(){
- $.openInTab({
- id:$.getUUID(),
- title : '新增物料',
- height:600,
- width:1200,
- url : './products/mes/md/me/material_insert.jsp',
- queryParams : {
- class_uuid:class_uuid
- }
+ var row = $.grid_getSelected({
+ id : _gridid
});
+ if(row == null){
+ alert("请先选择一条物料信息!");
+ return;
+ }
+ confirmDialog('是否确认新增1061工厂物料!',function(){
+ //打开旋转
+ $.wait_open();
+ //请求参数
+ var dataParam = {
+ _SRVNAME:'service.md.material'
+ ,_SRVMETHOD:'add1061'
+ ,_DATA:$.json2str({
+ accountId:$.getSessionUser().account_id,
+ deleteId: row.material_uuid
+ })
+ };
+
+ //加载数据
+ $.cuajax({
+ url:'wdk?action=wdk.pub&method=call_service&ajaxparam='+new Date().getTime()
+ ,method:"post"
+ ,timeout:WDK_Timeout
+ ,data:dataParam
+ ,success:function(result) {
+ //关闭旋转
+ $.wait_close();
+ var jres = $.str2json(result);
+ //操作成功
+ if (jres.code == "1") {
+ alert(jres.desc);
+ //删除后重新请求
+ query("");
+
+ }else{
+ alert(jres.desc);
+ }
+ },
+ error:function(result){
+ $.wait_close();
+ alert('网络错误!result='+result);
+ }
+ });
+
+ },function(){});
}
//修改供应商数据
@@ -406,10 +443,10 @@
diff --git a/lxapp/app/products/mes/md/me/material_update.jsp b/lxapp/app/products/mes/md/me/material_update.jsp
index 2eae470..c0f7650 100644
--- a/lxapp/app/products/mes/md/me/material_update.jsp
+++ b/lxapp/app/products/mes/md/me/material_update.jsp
@@ -537,7 +537,7 @@
diff --git a/lxservice/com/noblelift/imp/products/mes/service/ifs/sap/SapToWmsServiceImpl.java b/lxservice/com/noblelift/imp/products/mes/service/ifs/sap/SapToWmsServiceImpl.java
index b6869d1..49fc9ac 100644
--- a/lxservice/com/noblelift/imp/products/mes/service/ifs/sap/SapToWmsServiceImpl.java
+++ b/lxservice/com/noblelift/imp/products/mes/service/ifs/sap/SapToWmsServiceImpl.java
@@ -11,6 +11,7 @@ import org.wdk.core.bean.WDKLogger;
import org.wdk.core.env.context.ServiceContext;
import org.wdk.core.spring.annotation.WDKTransaction;
import org.wdk.core.util.uString;
+import org.wdk.core.wql.core.bean.ResultBean;
import org.wdk.core.wql.core.bean.WQLData;
import org.wdk.core.wql.core.bean.WQLObject;
@@ -237,8 +238,8 @@ public class SapToWmsServiceImpl implements SapToWmsService {
String IF_SAP_ProductOrder = "IF_SAP_ProductOrder";
// 生产订单接口处理表
String IF_SAP_ProductOrderProc = "IF_SAP_ProductOrderProc";
- WQLObject wo_IssueBillUrgent = WQLObject.getWQLObject(IF_SAP_ProductOrder);
- WQLObject wo_IssueBillUrgentProc = WQLObject.getWQLObject(IF_SAP_ProductOrderProc);
+ WQLObject wo_IF_SAP_ProductOrder = WQLObject.getWQLObject(IF_SAP_ProductOrder);
+ WQLObject wo_IF_SAP_ProductOrderProc = WQLObject.getWQLObject(IF_SAP_ProductOrderProc);
logger.debug("数据数量:" + tblexport.getNumRows());
for (int i = 0; i < tblexport.getNumRows(); i++) {
tblexport.setRow(i);
@@ -261,7 +262,7 @@ public class SapToWmsServiceImpl implements SapToWmsService {
joi.put("MEINS", tblexport.getString("MEINS"));
joi.put("LGORT", tblexport.getString("LGORT"));
// 新增
- wo_IssueBillUrgent.insert(joi);
+ wo_IF_SAP_ProductOrder.insert(joi);
JSONObject row = WdkUtil.queryOneByAttr(whereExpr.toJSONArray(), "", IF_SAP_ProductOrderProc);
if (row == null || row.optDouble("crea_receive_qty") == 0) {
@@ -277,7 +278,7 @@ public class SapToWmsServiceImpl implements SapToWmsService {
joi.put("no_instor_qty", qty + "");
joi.put("importor_id", "0000");
joi.put("import_time", WDK.getDateTime());
- wo_IssueBillUrgentProc.insert(joi);
+ wo_IF_SAP_ProductOrderProc.insert(joi);
}
}
}
@@ -790,6 +791,8 @@ public class SapToWmsServiceImpl implements SapToWmsService {
jo = new JSONObject();
jo.put("material_code", joi.optString("MATNR"));
String material_name = joi.optString("MAKTX");
+ material_name = material_name.replace("\"","’");
+
material_name = material_name.replace("'","’");
jo.put("material_name", material_name);
JSONObject unit = WQLObject.getWQLObject("MD_PB_MeasureUnit")
@@ -855,18 +858,23 @@ public class SapToWmsServiceImpl implements SapToWmsService {
ST_BS_WMSMaterialIsDull.insert(wmsmaterial);
//暂时屏蔽1061的物料
- wmsmaterial.put("wmsmaterial_uuid", "uuid-" + MATNR + "-1061");
+ /*wmsmaterial.put("wmsmaterial_uuid", "uuid-" + MATNR + "-1061");
wmsmaterial.put("factory_uuid", "1061");
ST_BS_WMSMaterial.insert(wmsmaterial);
wmsmaterial.put("is_dull", "0");
- ST_BS_WMSMaterialIsDull.insert(wmsmaterial);
+ ST_BS_WMSMaterialIsDull.insert(wmsmaterial);*/
} else {// 更新
jo.put("sysupdatetime", datanow);
jo.put("sysupdateuseruuid", "0000");
- jo.put("material_name", joi.optString("MAKTX"));
+ String material_name = joi.optString("MAKTX");
+ material_name = material_name.replace("\"","’");
+
+ material_name = material_name.replace("'","’");
+ jo.put("material_name", material_name);
+
JSONObject unit = WQLObject.getWQLObject("MD_PB_MeasureUnit")
.query("unit_name = '" + joi.optString("MEINS") + "'").uniqueResult(0);
jo.put("base_unit_uuid", unit.optString("measure_unit_uuid"));
@@ -905,6 +913,11 @@ public class SapToWmsServiceImpl implements SapToWmsService {
jo.put("sect_name", sect.optString("sect_name", ""));
}
MD_ME_MaterialBase.update(jo);
+ //更新物料唯一表
+ HashMap map = new HashMap();
+ map.put("material_name", material_name);
+ ResultBean rb2 = ST_BS_WMSMaterial.update(map, "material_code = ?",
+ new String[] { MATNR });
}
}
}
diff --git a/lxservice/com/noblelift/imp/products/mes/service/md/me/MaterialServiceImpl.java b/lxservice/com/noblelift/imp/products/mes/service/md/me/MaterialServiceImpl.java
index c94edc6..3d73375 100644
--- a/lxservice/com/noblelift/imp/products/mes/service/md/me/MaterialServiceImpl.java
+++ b/lxservice/com/noblelift/imp/products/mes/service/md/me/MaterialServiceImpl.java
@@ -229,7 +229,41 @@ public class MaterialServiceImpl implements MaterialService {
}
return srb;
}
-
+ @WDKTransaction
+ @Override
+ public ServiceResultBean add1061(ServiceContext ctx, String accountId, String material_uuid) {
+ //物料基本信息接口表
+
+ WQLObject wo_ST_BS_WMSMaterial = WQLObject.getWQLObject("ST_BS_WMSMaterial");
+
+ WQLObject wo_ST_BS_WMSMaterialIsDull = WQLObject.getWQLObject("ST_BS_WMSMaterialIsDull");
+
+ JSONObject jo = WQLObject.getWQLObject("MD_ME_MaterialBase")
+ .query("material_uuid = ?", new String[] { material_uuid }, "").uniqueResult(0);
+
+ if(jo != null){
+
+ if (jo.optString("sysisdelete").equals("1")) {
+ throw new WDKException("物料已被删除 ");
+ }
+
+ String MATNR = jo.optString("material_code");
+ JSONObject wmsmaterial = new JSONObject();
+ wmsmaterial.put("wmsmaterial_uuid", "uuid-" + MATNR + "-1061");
+ wmsmaterial.put("material_uuid", "uuid-" + MATNR);
+ wmsmaterial.put("material_code", MATNR);
+ wmsmaterial.put("material_name", jo.optString("material_name"));
+ wmsmaterial.put("factory_uuid", "1061");
+ wo_ST_BS_WMSMaterial.insert(wmsmaterial);
+ wmsmaterial.put("is_dull", "0");
+ wo_ST_BS_WMSMaterialIsDull.insert(wmsmaterial);
+ }
+
+ ServiceResultBean srb = new ServiceResultBean();
+ srb.setSuccess();
+ srb.setDesc("新增1061工厂物料成功!");
+ return srb;
+ }
@WDKTransaction
@Override
public ServiceResultBean delete(ServiceContext ctx, String accountId, String material_uuid) {