Commit a850c6c0 by wuwenlong

实时库存管理 opt;

parent 142153e3
...@@ -6,9 +6,7 @@ import com.baosight.hpjx.core.security.UserSessionUtils; ...@@ -6,9 +6,7 @@ import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.hpjx.hp.kc.domain.HPKC010; import com.baosight.hpjx.hp.kc.domain.HPKC010;
import com.baosight.hpjx.hp.pz.domain.HPPZ006; import com.baosight.hpjx.hp.pz.domain.HPPZ006;
import com.baosight.hpjx.hp.pz.domain.HPPZ007; import com.baosight.hpjx.hp.pz.domain.HPPZ007;
import com.baosight.hpjx.hp.pz.tools.HPPZTools;
import com.baosight.hpjx.util.*; import com.baosight.hpjx.util.*;
import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant; import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo; import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException; import com.baosight.iplat4j.core.exception.PlatException;
...@@ -17,7 +15,6 @@ import com.baosight.iplat4j.core.service.soa.XLocalManager; ...@@ -17,7 +15,6 @@ import com.baosight.iplat4j.core.service.soa.XLocalManager;
import com.baosight.iplat4j.core.util.DateUtils; import com.baosight.iplat4j.core.util.DateUtils;
import com.baosight.iplat4j.core.web.threadlocal.UserSession; import com.baosight.iplat4j.core.web.threadlocal.UserSession;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import java.math.BigDecimal; import java.math.BigDecimal;
...@@ -41,7 +38,9 @@ public class ServiceHPKC010 extends ServiceBase { ...@@ -41,7 +38,9 @@ public class ServiceHPKC010 extends ServiceBase {
EiInfo outInfo = super.initLoad(inInfo, HPKC010); EiInfo outInfo = super.initLoad(inInfo, HPKC010);
outInfo.getBlock(EiConstant.resultBlock).getRows().clear(); outInfo.getBlock(EiConstant.resultBlock).getRows().clear();
CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.WH_RECORD_BLOCK_ID), null); CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.WH_RECORD_BLOCK_ID), null);
CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.INVENT_ALL_BLOCK_ID), null,false); CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.MATERIAL_RECORD_BLOCK_ID), null);
CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.INVENT_SPEC_BLOCK_ID), null);
CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.SPEC_NAME_BLOCK_ID), null, false);
return outInfo; return outInfo;
} }
...@@ -58,69 +57,7 @@ public class ServiceHPKC010 extends ServiceBase { ...@@ -58,69 +57,7 @@ public class ServiceHPKC010 extends ServiceBase {
return inInfo; return inInfo;
} }
/**
* 保存操作.
*
* @param inInfo
* @return
*/
public EiInfo save(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 数据校验
this.checkSaveData(resultRows);
// 写入数据
for (int i = 0; i < resultRows.size(); i++) {
HPKC010 fKc010 = new HPKC010();
fKc010.fromMap(resultRows.get(i));
// 设置基础信息
if (fKc010.getId() == null || fKc010.getId() == 0) {
this.add(fKc010);
} else {
this.modify(fKc010);
}
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 校验保存的数据
*
* @param resultRows
*/
private void checkSaveData(List<Map> resultRows) {
for (int i = 0; i < resultRows.size(); i++) {
HPKC010 fKc010 = new HPKC010();
fKc010.fromMap(resultRows.get(i));
AssertUtils.isEmpty(fKc010.getWhCode(), "仓库名称不能为空");
AssertUtils.isNull(fKc010.getInventRecordId(), "存货名称不能为空");
}
}
/**
* 新增
*
* @param fKc010
*/
private void add(HPKC010 fKc010) {
DaoUtils.insert("HPKC010.insert", fKc010);
}
/**
* 修改数据
*
* @param fKc010
*/
private void modify(HPKC010 fKc010) {
DaoUtils.update("HPKC010.update", fKc010);
}
/** /**
* 新增操作. * 新增操作.
*/ */
...@@ -141,29 +78,6 @@ public class ServiceHPKC010 extends ServiceBase { ...@@ -141,29 +78,6 @@ public class ServiceHPKC010 extends ServiceBase {
} }
return inInfo; return inInfo;
} }
/**
* 修改操作
*
* @param inInfo
* @return
*/
public EiInfo update(EiInfo inInfo) {
try {
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for (int i = 0; i < eiBlock.getRowCount(); i++) {
HPKC010 fKc010 = new HPKC010();
fKc010.fromMap(eiBlock.getRow(i));
DaoUtils.update(HPKC010.UPDATE, fKc010);
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsg("修改成功!");
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "修改失败");
}
return inInfo;
}
/** /**
* 更新库存 * 更新库存
...@@ -314,26 +228,4 @@ public class ServiceHPKC010 extends ServiceBase { ...@@ -314,26 +228,4 @@ public class ServiceHPKC010 extends ServiceBase {
} }
} }
/**
* 删除操作
*
* @param inInfo
* @return
*/
public EiInfo delete(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
for (int i = 0; i < resultRows.size(); i++) {
DaoUtils.update(HPKC010.DELETE, resultRows.get(i));
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据删除成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "删除失败");
}
return inInfo;
}
} }
...@@ -63,11 +63,23 @@ ...@@ -63,11 +63,23 @@
</sql> </sql>
<sql id="customCondition">
<isNotEmpty prepend=" AND " property="spec">
<isEqual property="spec" compareValue="无规格">
INVENT_RECORD_ID IN (SELECT ID FROM ${hpjxSchema}.T_HPPZ006 WHERE SPEC = '')
</isEqual>
<isNotEqual property="spec" compareValue="无规格">
INVENT_RECORD_ID IN (SELECT ID FROM ${hpjxSchema}.T_HPPZ006 WHERE SPEC = #spec#)
</isNotEqual>
</isNotEmpty>
</sql>
<select id="query" resultClass="com.baosight.hpjx.hp.kc.domain.HPKC010"> <select id="query" resultClass="com.baosight.hpjx.hp.kc.domain.HPKC010">
SELECT <include refid="column"/> SELECT <include refid="column"/>
FROM hpjx.T_HPKC010 FROM hpjx.T_HPKC010
WHERE 1=1 WHERE 1=1
<include refid="condition"/> <include refid="condition"/>
<include refid="customCondition"/>
<dynamic prepend="ORDER BY"> <dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy"> <isNotEmpty property="orderBy">
$orderBy$ $orderBy$
...@@ -89,17 +101,10 @@ ...@@ -89,17 +101,10 @@
SELECT COUNT(*) FROM hpjx.T_HPKC010 SELECT COUNT(*) FROM hpjx.T_HPKC010
WHERE 1=1 WHERE 1=1
<include refid="condition"/> <include refid="condition"/>
<include refid="customCondition"/>
</select> </select>
<!-- 查询统计 -->
<select id="querySum" resultClass="com.baosight.hpjx.hp.kc.domain.HPKC010">
SELECT
COALESCE(SUM(AMOUNT), 0) AS "amount", <!-- 数量 -->
COALESCE(SUM(WEIGHT), 0) AS "weight" <!-- 重量 -->
FROM ${hpjxSchema}.T_HPKC010
WHERE 1=1
<include refid="condition"/>
</select>
<insert id="insert"> <insert id="insert">
INSERT INTO hpjx.T_HPKC010 ( INSERT INTO hpjx.T_HPKC010 (
...@@ -125,26 +130,6 @@ ...@@ -125,26 +130,6 @@
) )
</insert> </insert>
<delete id="delete">
DELETE FROM hpjx.T_HPKC010 WHERE ID = #id#
</delete>
<update id="update">
UPDATE hpjx.T_HPKC010
SET
WH_CODE = #whCode#, <!-- 仓库编码 -->
WH_NAME = #whName#, <!-- 仓库名称 -->
INVENT_TYPE = #inventType#, <!-- 物料类型 -->
INVENT_CODE = #inventCode#, <!-- 物料编码 -->
INVENT_NAME = #inventName#, <!-- 物料名称 -->
INVENT_RECORD_ID = #inventRecordId#, <!-- 存货档案ID -->
AMOUNT = #amount#, <!-- 数量 -->
WEIGHT = #weight#, <!-- 重量 -->
UPDATED_BY = #updatedBy#, <!-- 更新人 -->
UPDATED_TIME = #updatedTime#, <!-- 更新时间 -->
VERSION = #version#
WHERE ID = #id#
</update>
<update id="updateStock"> <update id="updateStock">
UPDATE hpjx.T_HPKC010 UPDATE hpjx.T_HPKC010
......
...@@ -4,9 +4,6 @@ $(function() { ...@@ -4,9 +4,6 @@ $(function() {
// 查询 // 查询
$("#QUERY").on("click", query); $("#QUERY").on("click", query);
// 保存
$("#BTN_SAVE").on("click", save);
IPLATUI.EFGrid = { IPLATUI.EFGrid = {
"result": { "result": {
columns: [{ columns: [{
...@@ -18,31 +15,6 @@ $(function() { ...@@ -18,31 +15,6 @@ $(function() {
} }
} }
return ""; return "";
},
editor: function (container, options) {
var grid = container.closest(".k-grid").data("kendoGrid");
var cellIndex = grid.cellIndex(container);
var input = $('<input />');
input.attr("name", options.field);
input.attr("id", options.field);
input.appendTo(container);
let eiInfo = new EiInfo();
eiInfo.set("inventType", options.model["inventType"]);
var dataSource;
EiCommunicator.send("HPPZ006", "queryMaterialComboBox", eiInfo, {
onSuccess: function (ei) {
dataSource = ei.getBlock("material_record_block_id").getMappedRows();
},
onFail: function (ei) {
}
}, {async: false});
input.kendoDropDownList({
valuePrimitive: true,
dataTextField: "textField",
dataValueField: "valueField",
dataSource: dataSource,
template: "#=textField#"
});
} }
}, { }, {
field: "spec", field: "spec",
...@@ -53,31 +25,6 @@ $(function() { ...@@ -53,31 +25,6 @@ $(function() {
} }
} }
return ""; return "";
},
editor: function (container, options) {
var grid = container.closest(".k-grid").data("kendoGrid");
var cellIndex = grid.cellIndex(container);
var input = $('<input />');
input.attr("name", options.field);
input.attr("id", options.field);
input.appendTo(container);
let eiInfo = new EiInfo();
eiInfo.set("inqu_status-0-inventCode", options.model["inventCode"]);
var dataSource;
EiCommunicator.send("HPPZ006", "queryComboBoxSpec", eiInfo, {
onSuccess: function (ei) {
dataSource = ei.getBlock("invent_spec_block_id").getMappedRows();
},
onFail: function (ei) {
}
}, {async: false});
input.kendoDropDownList({
valuePrimitive: true,
dataTextField: "textField",
dataValueField: "valueField",
dataSource: dataSource,
template: "#=textField#"
});
} }
}, { }, {
field: "material", field: "material",
...@@ -99,45 +46,7 @@ $(function() { ...@@ -99,45 +46,7 @@ $(function() {
} }
return ""; return "";
} }
}], }]
loadComplete: function (grid) {
//删除
$("#DELETE").on("click", function () {
var btnNode = $(this);
//禁用按钮
btnNode.attr("disabled", true);
var dataItems = resultGrid.getCheckedRows();
if (dataItems == null || dataItems == "") {
NotificationUtil({
msg: '选择要删除的数据'
}, "warning");
//释放禁用按钮
btnNode.attr("disabled", false);
return false;
}
IPLAT.submitNode($("#HPKC010"), "HPKC010", "delete", {
onSuccess: function (ei) {
if (ei["status"] == -1) {
NotificationUtil(ei, "error");
} else {
NotificationUtil({
msg: '删除成功'
});
// 绑定grid
resultGrid.setEiInfo(ei);
}
//释放禁用按钮
btnNode.attr("disabled", false);
},
onFail: function (ei) {
// 发生异常
console.log(ei);
//释放禁用按钮
btnNode.attr("disabled", false);
}
});
});
}
}, },
}; };
}); });
...@@ -174,19 +83,3 @@ let query = function () { ...@@ -174,19 +83,3 @@ let query = function () {
resultGrid.dataSource.page(1); // 点击查询按钮,从第1页开始查询 resultGrid.dataSource.page(1); // 点击查询按钮,从第1页开始查询
} }
/**
* 保存
*/
let save = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HPKC010", "save", true);
}
});
}
...@@ -8,17 +8,24 @@ ...@@ -8,17 +8,24 @@
<EF:EFPage title="实时库存管理"> <EF:EFPage title="实时库存管理">
<EF:EFRegion id="inqu" title="查询条件"> <EF:EFRegion id="inqu" title="查询条件">
<div class="row"> <div class="row">
<EF:EFDatePicker ename="inqu_status-0-receiptDate" cname="单据日期" <EF:EFSelect ename="inqu_status-0-whCode" cname="仓库名称" colWidth="3" filter="contains" defultValue="">
role="date" format="yyyy-MM-dd" readonly="true"/> <EF:EFOption label="全部" value=""/>
<EF:EFSelect ename="inqu_status-0-inventType" cname="存货类型" filter="contains" defaultValue=""> <EF:EFOptions blockId="wh_record_block_id" textField="textField" valueField="valueField"/>
<EF:EFOption label="请选择" value=""/> </EF:EFSelect>
<EF:EFSelect ename="inqu_status-0-inventType" cname="存货类型" colWidth="3" filter="contains"
template="#=valueField#-#=textField#" valueTemplate="#=valueField#-#=textField#">
<EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="hpjx.hpkc.inventType"/> <EF:EFCodeOption codeName="hpjx.hpkc.inventType"/>
</EF:EFSelect> </EF:EFSelect>
<EF:EFSelect ename="inqu_status-0-whCode" cname="仓库名称" filter="contains" defultValue=""> <EF:EFSelect ename="inqu_status-0-inventCode" cname="存货名称" colWidth="3" filter="contains" defultValue="">
<EF:EFOption label="请选择" value=""/> <EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="wh_record_block_id" textField="textField" valueField="valueField"/> <EF:EFOptions blockId="material_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect> </EF:EFSelect>
</div> <EF:EFSelect ename="inqu_status-0-spec" cname="规格" colWidth="3" filter="contains" defultValue="">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="spec_name_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
</div>
</EF:EFRegion> </EF:EFRegion>
<EF:EFRegion id="result" title="明细信息"> <EF:EFRegion id="result" title="明细信息">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment