Browse Source

opt:其他发料新增excel查询

master
parent
commit
1bcab5d8e4
  1. 2
      lxapi/com/noblelift/imp/products/mes/api/st/is/IssueBillOtherService.java
  2. 89
      lxapp/app/products/mes/st/is/issue_bill_other_forinsert_mater_choice.jsp
  3. 6
      lxapp/app/products/mes/st/rc/receive_dtl3.jsp
  4. 4
      lxapp/src/wql/mes/st/is/ST_IS_ISSUE_OTHER_01.wql
  5. 77
      lxservice/com/noblelift/imp/products/mes/service/st/is/IssueBillOtherServiceImpl.java
  6. 1
      lxservice/com/noblelift/imp/products/mes/service/st/rc/ReceiveServiceImpl.java

2
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);
}

89
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 @@
</head>
<body class="easyui-layout" data-options="fit:true">
<div data-options="region:'north',border:false,collapsed:false"
class="page-title" style="overflow: hidden; height: 40px;">
<div data-options="region:'north',border:false,collapsed:false" class="page-title" style="overflow: hidden;height: 60px">
<div class="edit-page-toolbar">
<div style="float: right;">
<div id="excel_div">excel查询</div>
</div>
<a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'fa fa-save'" onclick="save();">确定</a>
<a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'fa fa-close'" onclick="_close()">关闭</a>
</div>
</div>
<div data-options="region:'center',border:false,collapsed:false">
<div class="easyui-layout" data-options="fit:true" style="overflow: auto;">
<div data-options="region:'north',border:false,collapsed:false" class="row-3" style="padding: 0 10px;overflow:hidden;">
<div class="easyui-layout" data-options="fit:true">
<div data-options="region:'north',border:false,collapsed:false" class="row-2" style="padding: 0 10px;overflow:hidden;">
<form id="search_form">
<input type="hidden" id="stor_uuid" name="stor_uuid" value="" />
<div class="h_layout fixed">
<div class="row">
<div class="formgroup">
<label>物料:</label>
<div class="h_layout">
` <div>
<div class="inputgroup" style="margin-top:8px">
<label>物料编码查询:</label>
<div>
<input type="text" class="easyui-validatebox nospaceinside" id="searchBar" name="searchBar" placeholder="物料号">
<input class="easyui-validatebox" data-options="validType:'length[0,50]',tipPosition:'bottom'" id="searchBar" name="searchBar" placeholder="物料号" style="width:200px;"/>
</div>
</div>
<div class="formgroup">
</div>
</div>
<div>
<div class="inputgroup" style="margin-top:15px">
<label>工厂:</label>
<div>
<input type="text" class="easyui-validatebox nospaceinside" id="factory_uuid" name="factory_uuid" >
</div>
</div>
</div>
</div>
</div>
<div class="h_layout fixed">
<div style="width:125px;">
<a class="eapbutton" style="float:right;margin-right:10px;" onclick="query()"><i class="fa fa-search" aria-hidden="true"></i><span><span>查询</span></span></a>
</div>
<div style="width:125px; ">
<a class="eapbutton" style="float:right;" onclick="query()"><i class="fa fa-search" aria-hidden="true"></i><span><span>查询</span></span></a>
</div>
</div>
</form>
</div>
<div id="layout_grid" data-options="region:'center',border:false,collapsed:false" style="padding: 0px 10px;"></div>

6
lxapp/app/products/mes/st/rc/receive_dtl3.jsp

@ -121,8 +121,8 @@
</head>
<body class="easyui-layout" data-options="fit:true">
<div data-options="region:'north',border:false,collapsed:false" class="page-title" style="overflow:hidden">
<div class="page-toolbar">
<div data-options="region:'north',border:false,collapsed:false" class="page-title" style="overflow:hidden;height: 60px">
<div class="edit-page-toolbar">
<div style="float: right;">
<div id="excel_div">excel查询</div>
</div>
@ -144,7 +144,7 @@
</div>
</div>
<div class="inputgroup" style="margin-top:15px;">
<label>显示全部:</label>
<label>显示全部仓库物料:</label>
<input type="checkbox" id="is_check" name="is_check" />

4
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

77
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<String, String> 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<String,Double> map = new HashMap<String,Double> ();
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<rows.size();i++){
JSONObject jo = rows.getJSONObject(i);
if(map.containsKey(jo.optString("material_code"))){
Double fact_qty = map.get(jo.optString("material_code"));
jo.put("audit_qty", fact_qty);
}
new_rows.add(jo);
}
jres.put("rows", new_rows);
}
ServiceResultBean srb = new ServiceResultBean();
srb.setSuccess();
srb.setDesc("查询成功");
@ -1943,4 +1982,42 @@ public class IssueBillOtherServiceImpl implements IssueBillOtherService {
srb.setSuccess();
return srb;
}
@WDKTransaction
@Override
public ServiceResultBean excelSave(ServiceContext context, JSONObject accountInfo, String fileid) {
if (uString.isEmpty(fileid)) {
throw new WDKException("Excel文件ID不能为空");
}
FileReturn fr = null;
try {
fr = FileServerFactory.getInstance().get(fileid);
} catch (Exception e) {
e.printStackTrace();
}
ArrayList<?> 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;
}
}

1
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){

Loading…
Cancel
Save