diff --git a/lxapi/com/noblelift/imp/products/mes/api/st/is/IssueBillOtherService.java b/lxapi/com/noblelift/imp/products/mes/api/st/is/IssueBillOtherService.java index 364bb88..e7005b1 100644 --- a/lxapi/com/noblelift/imp/products/mes/api/st/is/IssueBillOtherService.java +++ b/lxapi/com/noblelift/imp/products/mes/api/st/is/IssueBillOtherService.java @@ -335,7 +335,7 @@ public interface IssueBillOtherService { public ServiceResultBean checkIssueIvt(ServiceContext ctx,JSONArray rows); - + public ServiceResultBean excelSave(ServiceContext context, JSONObject accountInfo,String fileid); } diff --git a/lxapp/app/products/mes/st/is/issue_bill_other_forinsert_mater_choice.jsp b/lxapp/app/products/mes/st/is/issue_bill_other_forinsert_mater_choice.jsp index f7ccc61..9830852 100644 --- a/lxapp/app/products/mes/st/is/issue_bill_other_forinsert_mater_choice.jsp +++ b/lxapp/app/products/mes/st/is/issue_bill_other_forinsert_mater_choice.jsp @@ -18,6 +18,7 @@ $('#stor_uuid').val(stor_uuid); loadGrid(); Combo_box_factory(); + excel(); }); //查询类型 //工厂下拉框 @@ -60,9 +61,9 @@ } //查询 - function query() { + function query(result) { //组织参数 - var dataParam = getGridQueryParam(); + var dataParam = getGridQueryParam(result); $.grid_reload({ id : _gridid, queryParams : dataParam @@ -71,7 +72,7 @@ function loadGrid(){ //查询grid数据 //组织参数 - var dataParam = getGridQueryParam(); + var dataParam = getGridQueryParam(null); var gridid = $.grid({ id : _gridid, containerid : 'layout_grid', @@ -93,9 +94,10 @@ } }); } - function getGridQueryParam() { + function getGridQueryParam(result) { //获取form对象值 var FieldValues = $.getFieldValue({formid:'search_form'}); + FieldValues.result = result; //组织参数 var dataParam = { _SRVNAME:'server.store.issueBillOther' @@ -110,7 +112,47 @@ }; return dataParam; } - + function excel(){ + $.exceluploader({ + id:'excel_div' + ,uploadSuccess:function(file,res){ + fileid = res.fileid; + btn_save(fileid); + } + }); + } + function btn_save(fileid) { + $.wait_open(); + $.cuajax({ + url : 'wdk?action=wdk.pub&method=call_service&ajaxparam='+ new Date().getTime(), + method : "post", + timeout : WDK_Timeout, + data : { + _SRVNAME : 'server.store.issueBillOther', + _SRVMETHOD : 'excelSave',// + _DATA : $.json2str({ + accountInfo:$.getSessionUser() //登陆账号的信息 + ,fileid : fileid + }) + }, + success : function(result) { + $.wait_close(); + //返回值字符串转json + var jres = $.str2json(result); + if (jres.code == "1") { //操作成功 + alert(jres.desc); + query(jres.result); + } else { + alert(jres.desc); + } + }, + error : function(result) { + $.wait_close(); + alert('网络错误!result=' + result); + } + }); + + } function save() { var rows = $.grid_getChecked({ @@ -126,7 +168,6 @@ return; } } - debugger; var widc = $.getURLParam("wid"); $.setWinReturn(widc,rows); $.closeWin(widc); @@ -136,40 +177,42 @@ -
+
+
+
excel查询
+
确定 关闭
-
-
+
+
-
-
-
- +
+ `
+
+
- +
-
-
+
+
+
+
-
+
-
-
-
- 查询 -
+
+ 查询
+
diff --git a/lxapp/app/products/mes/st/rc/receive_dtl3.jsp b/lxapp/app/products/mes/st/rc/receive_dtl3.jsp index 6b34647..6cb693b 100644 --- a/lxapp/app/products/mes/st/rc/receive_dtl3.jsp +++ b/lxapp/app/products/mes/st/rc/receive_dtl3.jsp @@ -121,8 +121,8 @@ -
-
+
+
excel查询
@@ -144,7 +144,7 @@
- + diff --git a/lxapp/src/wql/mes/st/is/ST_IS_ISSUE_OTHER_01.wql b/lxapp/src/wql/mes/st/is/ST_IS_ISSUE_OTHER_01.wql index ca34100..d229863 100644 --- a/lxapp/src/wql/mes/st/is/ST_IS_ISSUE_OTHER_01.wql +++ b/lxapp/src/wql/mes/st/is/ST_IS_ISSUE_OTHER_01.wql @@ -42,6 +42,7 @@ 输入.sourcebill_dtluuid TYPEAS s_string 输入.sect_type TYPEAS s_string 输入.sect_types TYPEAS f_string + 输入.material_codes TYPEAS f_string 输入.group_code TYPEAS s_string 输入.material_code TYPEAS s_string 输入.audit_per TYPEAS s_string @@ -536,6 +537,9 @@ IF 输入.flag = "12" OPTION 输入.material_code <> "" mater.material_code = 输入.material_code ENDOPTION + OPTION 输入.material_codes <> "" + mater.material_code in (输入.material_codes) + ENDOPTION ENDSELECT ENDPAGEQUERY ENDIF diff --git a/lxservice/com/noblelift/imp/products/mes/service/st/is/IssueBillOtherServiceImpl.java b/lxservice/com/noblelift/imp/products/mes/service/st/is/IssueBillOtherServiceImpl.java index 34c7c95..2671551 100644 --- a/lxservice/com/noblelift/imp/products/mes/service/st/is/IssueBillOtherServiceImpl.java +++ b/lxservice/com/noblelift/imp/products/mes/service/st/is/IssueBillOtherServiceImpl.java @@ -1,5 +1,6 @@ package com.noblelift.imp.products.mes.service.st.is; import java.math.BigDecimal; +import java.util.ArrayList; import java.util.HashMap; import org.wdk.WDK; @@ -8,11 +9,14 @@ import org.wdk.core.bean.WDKException; import org.wdk.core.env.context.ServiceContext; import org.wdk.core.spring.SpringContext; import org.wdk.core.spring.annotation.WDKTransaction; +import org.wdk.core.util.uExcelUtilByPOI; import org.wdk.core.util.uMath; import org.wdk.core.util.uString; import org.wdk.core.wql.WQL; import org.wdk.core.wql.core.bean.ResultBean; import org.wdk.core.wql.core.bean.WQLObject; +import org.wdk.module.file.FileReturn; +import org.wdk.module.file.FileServerFactory; import com.noblelift.imp.platform.core.util.ServiceParameterParseUtil; import com.noblelift.imp.platform.core.util.WdkUtil; @@ -153,7 +157,42 @@ public class IssueBillOtherServiceImpl implements IssueBillOtherService { HashMap param = WDK.json2map(form); if (uString.isNotBlank(form.optString("searchBar"))) param.put("material_code", form.optString("searchBar")); + + JSONArray result = form.optJSONArray("result"); + + String material_codes = ""; + HashMap map = new HashMap (); + if(result != null){ + for (int i = 0; i < result.size(); i++) { + map.put(result.getJSONObject(i).optString("material_code"), result.getJSONObject(i).optDouble("audit_qty")); + if (material_codes.equals("")) + material_codes = result.getJSONObject(i).optString("material_code"); + else + material_codes = material_codes + "," + result.getJSONObject(i).optString("material_code"); + } + if(uString.isNotBlank(material_codes)){ + material_codes = "'" + material_codes.replaceAll(",", "','") + "'"; + param.put("material_codes", material_codes); + } + } + param.remove("result"); JSONObject jres = WQL.getWO("ST_IS_ISSUE_OTHER_01").addParamMap(param).addParam("flag", "12").pageQuery(context, ""); + + + if(result != null){ + JSONArray rows = jres.optJSONArray("rows"); + JSONArray new_rows = new JSONArray(); + for(int i=0;i excelList = uExcelUtilByPOI._readExcel(fr.getInputstream()); + + JSONArray jres = new JSONArray(); + for (int i = 0, j = excelList.size(); i < j; i++) { + // 对应Excel的每一列 + ArrayList list = (ArrayList) excelList.get(i); + JSONObject tblexport = new JSONObject(); + // 对应Excel的第一列 + tblexport.put("material_code", list.get(0)); + tblexport.put("audit_qty", list.get(1)); + + // 说明到了最后一行 + if (uString.isEmpty(tblexport.optString("material_code"))) { + break; + } + + jres.add(tblexport); + } + + ServiceResultBean srb = new ServiceResultBean(); + srb.setDesc("导入excel成功!"); + srb.addJSONArray("result", jres); + srb.setSuccess(); + return srb; + } } diff --git a/lxservice/com/noblelift/imp/products/mes/service/st/rc/ReceiveServiceImpl.java b/lxservice/com/noblelift/imp/products/mes/service/st/rc/ReceiveServiceImpl.java index 01d8885..37dc0dd 100644 --- a/lxservice/com/noblelift/imp/products/mes/service/st/rc/ReceiveServiceImpl.java +++ b/lxservice/com/noblelift/imp/products/mes/service/st/rc/ReceiveServiceImpl.java @@ -1378,6 +1378,7 @@ public class ReceiveServiceImpl implements ReceiveService { form.put("material_codes", material_codes); } } + form.remove("result"); JSONObject jres = WQL.getWO("ST_RC_RECEIVE_04").addParamMap(WDK.json2map(form)).pageQuery(context, ""); if(result != null){