diff --git a/erp_web/js/easyui-1.3.5/themes/icon.css b/erp_web/js/easyui-1.3.5/themes/icon.css
index 6bd4668b..fbe4ffe8 100644
--- a/erp_web/js/easyui-1.3.5/themes/icon.css
+++ b/erp_web/js/easyui-1.3.5/themes/icon.css
@@ -1,99 +1,102 @@
-.icon-blank{
- background:url('icons/blank.gif') no-repeat center center;
-}
-.icon-add{
- background:url('icons/edit_add.png') no-repeat center center;
-}
-.icon-edit{
- background:url('icons/pencil.png') no-repeat center center;
-}
-.icon-remove{
- background:url('icons/edit_remove.png') no-repeat center center;
-}
-.icon-save{
- background:url('icons/filesave.png') no-repeat center center;
-}
-.icon-cut{
- background:url('icons/cut.png') no-repeat center center;
-}
-.icon-ok{
- background:url('icons/ok.png') no-repeat center center;
-}
-.icon-no{
- background:url('icons/no.png') no-repeat center center;
-}
-.icon-cancel{
- background:url('icons/cancel.png') no-repeat center center;
-}
-.icon-reload{
- background:url('icons/reload.png') no-repeat center center;
-}
-.icon-search{
- background:url('icons/049.png') no-repeat center center;
-}
-.icon-print{
- background:url('icons/print.png') no-repeat center center;
-}
-.icon-help{
- background:url('icons/help.png') no-repeat center center;
-}
-.icon-undo{
- background:url('icons/undo.png') no-repeat center center;
-}
-.icon-redo{
- background:url('icons/redo.png') no-repeat center center;
-}
-.icon-back{
- background:url('icons/back.png') no-repeat center center;
-}
-.icon-sum{
- background:url('icons/sum.png') no-repeat center center;
-}
-.icon-tip{
- background:url('icons/tip.png') no-repeat center center;
-}
-.icon-filter{
- background:url('icons/filter.png') no-repeat center center;
-}
-.icon-mini-add{
- background:url('icons/mini_add.png') no-repeat center center;
-}
-.icon-mini-edit{
- background:url('icons/mini_edit.png') no-repeat center center;
-}
-.icon-mini-refresh{
- background:url('icons/mini_refresh.png') no-repeat center center;
-}
-.icon-list{
- background:url('icons/list.png') no-repeat center center;
-}
-.icon-chart-column{
- background:url('icons/chart_bar.png') no-repeat center center;
-}
-.icon-chart-zonghe{
- background:url('icons/zonghe.png') no-repeat center center;
-}
-.icon-chart-pie{
- background:url('icons/pie.png') no-repeat center center;
-}
-.icon-chart-statistics{
- background:url('icons/statistics.png') no-repeat center center;
-}
-.icon-chart-polygram{
- background:url('icons/polygram.png') no-repeat center center;
-}
-.icon-unlock{
- background:url('icons/lock_unlock.png') no-repeat center center;
-}
-.icon-comment{
- background:url('icons/comment.png') no-repeat center center;
-}
-.icon-excel{
- background:url('icons/receipt-excel.png') no-repeat center center;
-}
-.icon-excel-new{
- background:url('icons/excel1.png') no-repeat center center;
-}
-.icon-page-excel{
- background:url('icons/page_excel.png') no-repeat center center;
+.icon-blank{
+ background:url('icons/blank.gif') no-repeat center center;
+}
+.icon-add{
+ background:url('icons/edit_add.png') no-repeat center center;
+}
+.icon-edit{
+ background:url('icons/pencil.png') no-repeat center center;
+}
+.icon-remove{
+ background:url('icons/edit_remove.png') no-repeat center center;
+}
+.icon-save{
+ background:url('icons/filesave.png') no-repeat center center;
+}
+.icon-cut{
+ background:url('icons/cut.png') no-repeat center center;
+}
+.icon-ok{
+ background:url('icons/ok.png') no-repeat center center;
+}
+.icon-no{
+ background:url('icons/no.png') no-repeat center center;
+}
+.icon-cancel{
+ background:url('icons/cancel.png') no-repeat center center;
+}
+.icon-reload{
+ background:url('icons/reload.png') no-repeat center center;
+}
+.icon-search{
+ background:url('icons/049.png') no-repeat center center;
+}
+.icon-print{
+ background:url('icons/print.png') no-repeat center center;
+}
+.icon-help{
+ background:url('icons/help.png') no-repeat center center;
+}
+.icon-undo{
+ background:url('icons/undo.png') no-repeat center center;
+}
+.icon-redo{
+ background:url('icons/redo.png') no-repeat center center;
+}
+.icon-back{
+ background:url('icons/back.png') no-repeat center center;
+}
+.icon-sum{
+ background:url('icons/sum.png') no-repeat center center;
+}
+.icon-tip{
+ background:url('icons/tip.png') no-repeat center center;
+}
+.icon-filter{
+ background:url('icons/filter.png') no-repeat center center;
+}
+.icon-mini-add{
+ background:url('icons/mini_add.png') no-repeat center center;
+}
+.icon-mini-edit{
+ background:url('icons/mini_edit.png') no-repeat center center;
+}
+.icon-mini-refresh{
+ background:url('icons/mini_refresh.png') no-repeat center center;
+}
+.icon-list{
+ background:url('icons/list.png') no-repeat center center;
+}
+.icon-chart-column{
+ background:url('icons/chart_bar.png') no-repeat center center;
+}
+.icon-chart-zonghe{
+ background:url('icons/zonghe.png') no-repeat center center;
+}
+.icon-chart-pie{
+ background:url('icons/pie.png') no-repeat center center;
+}
+.icon-chart-statistics{
+ background:url('icons/statistics.png') no-repeat center center;
+}
+.icon-chart-polygram{
+ background:url('icons/polygram.png') no-repeat center center;
+}
+.icon-unlock{
+ background:url('icons/lock_unlock.png') no-repeat center center;
+}
+.icon-comment{
+ background:url('icons/comment.png') no-repeat center center;
+}
+.icon-excel{
+ background:url('icons/receipt-excel.png') no-repeat center center;
+}
+.icon-excel-new{
+ background:url('icons/excel1.png') no-repeat center center;
+}
+.icon-page-excel{
+ background:url('icons/page_excel.png') no-repeat center center;
+}
+.icon-basket_add{
+ background:url('icons/basket_add.png') no-repeat center center;
}
\ No newline at end of file
diff --git a/erp_web/js/easyui-1.3.5/themes/icons/basket_add.png b/erp_web/js/easyui-1.3.5/themes/icons/basket_add.png
new file mode 100644
index 00000000..35543682
Binary files /dev/null and b/erp_web/js/easyui-1.3.5/themes/icons/basket_add.png differ
diff --git a/erp_web/js/md5/md5.js b/erp_web/js/md5/md5.js
new file mode 100644
index 00000000..46d2aab7
--- /dev/null
+++ b/erp_web/js/md5/md5.js
@@ -0,0 +1,256 @@
+/*
+ * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message
+ * Digest Algorithm, as defined in RFC 1321.
+ * Version 2.1 Copyright (C) Paul Johnston 1999 - 2002.
+ * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
+ * Distributed under the BSD License
+ * See http://pajhome.org.uk/crypt/md5 for more info.
+ */
+
+/*
+ * Configurable variables. You may need to tweak these to be compatible with
+ * the server-side, but the defaults work in most cases.
+ */
+var hexcase = 0; /* hex output format. 0 - lowercase; 1 - uppercase */
+var b64pad = ""; /* base-64 pad character. "=" for strict RFC compliance */
+var chrsz = 8; /* bits per input character. 8 - ASCII; 16 - Unicode */
+
+/*
+ * These are the functions you'll usually want to call
+ * They take string arguments and return either hex or base-64 encoded strings
+ */
+function hex_md5(s){ return binl2hex(core_md5(str2binl(s), s.length * chrsz));}
+function b64_md5(s){ return binl2b64(core_md5(str2binl(s), s.length * chrsz));}
+function str_md5(s){ return binl2str(core_md5(str2binl(s), s.length * chrsz));}
+function hex_hmac_md5(key, data) { return binl2hex(core_hmac_md5(key, data)); }
+function b64_hmac_md5(key, data) { return binl2b64(core_hmac_md5(key, data)); }
+function str_hmac_md5(key, data) { return binl2str(core_hmac_md5(key, data)); }
+
+/*
+ * Perform a simple self-test to see if the VM is working
+ */
+function md5_vm_test()
+{
+ return hex_md5("abc") == "900150983cd24fb0d6963f7d28e17f72";
+}
+
+/*
+ * Calculate the MD5 of an array of little-endian words, and a bit length
+ */
+function core_md5(x, len)
+{
+ /* append padding */
+ x[len >> 5] |= 0x80 << ((len) % 32);
+ x[(((len + 64) >>> 9) << 4) + 14] = len;
+
+ var a = 1732584193;
+ var b = -271733879;
+ var c = -1732584194;
+ var d = 271733878;
+
+ for(var i = 0; i < x.length; i += 16)
+ {
+ var olda = a;
+ var oldb = b;
+ var oldc = c;
+ var oldd = d;
+
+ a = md5_ff(a, b, c, d, x[i+ 0], 7 , -680876936);
+ d = md5_ff(d, a, b, c, x[i+ 1], 12, -389564586);
+ c = md5_ff(c, d, a, b, x[i+ 2], 17, 606105819);
+ b = md5_ff(b, c, d, a, x[i+ 3], 22, -1044525330);
+ a = md5_ff(a, b, c, d, x[i+ 4], 7 , -176418897);
+ d = md5_ff(d, a, b, c, x[i+ 5], 12, 1200080426);
+ c = md5_ff(c, d, a, b, x[i+ 6], 17, -1473231341);
+ b = md5_ff(b, c, d, a, x[i+ 7], 22, -45705983);
+ a = md5_ff(a, b, c, d, x[i+ 8], 7 , 1770035416);
+ d = md5_ff(d, a, b, c, x[i+ 9], 12, -1958414417);
+ c = md5_ff(c, d, a, b, x[i+10], 17, -42063);
+ b = md5_ff(b, c, d, a, x[i+11], 22, -1990404162);
+ a = md5_ff(a, b, c, d, x[i+12], 7 , 1804603682);
+ d = md5_ff(d, a, b, c, x[i+13], 12, -40341101);
+ c = md5_ff(c, d, a, b, x[i+14], 17, -1502002290);
+ b = md5_ff(b, c, d, a, x[i+15], 22, 1236535329);
+
+ a = md5_gg(a, b, c, d, x[i+ 1], 5 , -165796510);
+ d = md5_gg(d, a, b, c, x[i+ 6], 9 , -1069501632);
+ c = md5_gg(c, d, a, b, x[i+11], 14, 643717713);
+ b = md5_gg(b, c, d, a, x[i+ 0], 20, -373897302);
+ a = md5_gg(a, b, c, d, x[i+ 5], 5 , -701558691);
+ d = md5_gg(d, a, b, c, x[i+10], 9 , 38016083);
+ c = md5_gg(c, d, a, b, x[i+15], 14, -660478335);
+ b = md5_gg(b, c, d, a, x[i+ 4], 20, -405537848);
+ a = md5_gg(a, b, c, d, x[i+ 9], 5 , 568446438);
+ d = md5_gg(d, a, b, c, x[i+14], 9 , -1019803690);
+ c = md5_gg(c, d, a, b, x[i+ 3], 14, -187363961);
+ b = md5_gg(b, c, d, a, x[i+ 8], 20, 1163531501);
+ a = md5_gg(a, b, c, d, x[i+13], 5 , -1444681467);
+ d = md5_gg(d, a, b, c, x[i+ 2], 9 , -51403784);
+ c = md5_gg(c, d, a, b, x[i+ 7], 14, 1735328473);
+ b = md5_gg(b, c, d, a, x[i+12], 20, -1926607734);
+
+ a = md5_hh(a, b, c, d, x[i+ 5], 4 , -378558);
+ d = md5_hh(d, a, b, c, x[i+ 8], 11, -2022574463);
+ c = md5_hh(c, d, a, b, x[i+11], 16, 1839030562);
+ b = md5_hh(b, c, d, a, x[i+14], 23, -35309556);
+ a = md5_hh(a, b, c, d, x[i+ 1], 4 , -1530992060);
+ d = md5_hh(d, a, b, c, x[i+ 4], 11, 1272893353);
+ c = md5_hh(c, d, a, b, x[i+ 7], 16, -155497632);
+ b = md5_hh(b, c, d, a, x[i+10], 23, -1094730640);
+ a = md5_hh(a, b, c, d, x[i+13], 4 , 681279174);
+ d = md5_hh(d, a, b, c, x[i+ 0], 11, -358537222);
+ c = md5_hh(c, d, a, b, x[i+ 3], 16, -722521979);
+ b = md5_hh(b, c, d, a, x[i+ 6], 23, 76029189);
+ a = md5_hh(a, b, c, d, x[i+ 9], 4 , -640364487);
+ d = md5_hh(d, a, b, c, x[i+12], 11, -421815835);
+ c = md5_hh(c, d, a, b, x[i+15], 16, 530742520);
+ b = md5_hh(b, c, d, a, x[i+ 2], 23, -995338651);
+
+ a = md5_ii(a, b, c, d, x[i+ 0], 6 , -198630844);
+ d = md5_ii(d, a, b, c, x[i+ 7], 10, 1126891415);
+ c = md5_ii(c, d, a, b, x[i+14], 15, -1416354905);
+ b = md5_ii(b, c, d, a, x[i+ 5], 21, -57434055);
+ a = md5_ii(a, b, c, d, x[i+12], 6 , 1700485571);
+ d = md5_ii(d, a, b, c, x[i+ 3], 10, -1894986606);
+ c = md5_ii(c, d, a, b, x[i+10], 15, -1051523);
+ b = md5_ii(b, c, d, a, x[i+ 1], 21, -2054922799);
+ a = md5_ii(a, b, c, d, x[i+ 8], 6 , 1873313359);
+ d = md5_ii(d, a, b, c, x[i+15], 10, -30611744);
+ c = md5_ii(c, d, a, b, x[i+ 6], 15, -1560198380);
+ b = md5_ii(b, c, d, a, x[i+13], 21, 1309151649);
+ a = md5_ii(a, b, c, d, x[i+ 4], 6 , -145523070);
+ d = md5_ii(d, a, b, c, x[i+11], 10, -1120210379);
+ c = md5_ii(c, d, a, b, x[i+ 2], 15, 718787259);
+ b = md5_ii(b, c, d, a, x[i+ 9], 21, -343485551);
+
+ a = safe_add(a, olda);
+ b = safe_add(b, oldb);
+ c = safe_add(c, oldc);
+ d = safe_add(d, oldd);
+ }
+ return Array(a, b, c, d);
+
+}
+
+/*
+ * These functions implement the four basic operations the algorithm uses.
+ */
+function md5_cmn(q, a, b, x, s, t)
+{
+ return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s),b);
+}
+function md5_ff(a, b, c, d, x, s, t)
+{
+ return md5_cmn((b & c) | ((~b) & d), a, b, x, s, t);
+}
+function md5_gg(a, b, c, d, x, s, t)
+{
+ return md5_cmn((b & d) | (c & (~d)), a, b, x, s, t);
+}
+function md5_hh(a, b, c, d, x, s, t)
+{
+ return md5_cmn(b ^ c ^ d, a, b, x, s, t);
+}
+function md5_ii(a, b, c, d, x, s, t)
+{
+ return md5_cmn(c ^ (b | (~d)), a, b, x, s, t);
+}
+
+/*
+ * Calculate the HMAC-MD5, of a key and some data
+ */
+function core_hmac_md5(key, data)
+{
+ var bkey = str2binl(key);
+ if(bkey.length > 16) bkey = core_md5(bkey, key.length * chrsz);
+
+ var ipad = Array(16), opad = Array(16);
+ for(var i = 0; i < 16; i++)
+ {
+ ipad[i] = bkey[i] ^ 0x36363636;
+ opad[i] = bkey[i] ^ 0x5C5C5C5C;
+ }
+
+ var hash = core_md5(ipad.concat(str2binl(data)), 512 + data.length * chrsz);
+ return core_md5(opad.concat(hash), 512 + 128);
+}
+
+/*
+ * Add integers, wrapping at 2^32. This uses 16-bit operations internally
+ * to work around bugs in some JS interpreters.
+ */
+function safe_add(x, y)
+{
+ var lsw = (x & 0xFFFF) + (y & 0xFFFF);
+ var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
+ return (msw << 16) | (lsw & 0xFFFF);
+}
+
+/*
+ * Bitwise rotate a 32-bit number to the left.
+ */
+function bit_rol(num, cnt)
+{
+ return (num << cnt) | (num >>> (32 - cnt));
+}
+
+/*
+ * Convert a string to an array of little-endian words
+ * If chrsz is ASCII, characters >255 have their hi-byte silently ignored.
+ */
+function str2binl(str)
+{
+ var bin = Array();
+ var mask = (1 << chrsz) - 1;
+ for(var i = 0; i < str.length * chrsz; i += chrsz)
+ bin[i>>5] |= (str.charCodeAt(i / chrsz) & mask) << (i%32);
+ return bin;
+}
+
+/*
+ * Convert an array of little-endian words to a string
+ */
+function binl2str(bin)
+{
+ var str = "";
+ var mask = (1 << chrsz) - 1;
+ for(var i = 0; i < bin.length * 32; i += chrsz)
+ str += String.fromCharCode((bin[i>>5] >>> (i % 32)) & mask);
+ return str;
+}
+
+/*
+ * Convert an array of little-endian words to a hex string.
+ */
+function binl2hex(binarray)
+{
+ var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef";
+ var str = "";
+ for(var i = 0; i < binarray.length * 4; i++)
+ {
+ str += hex_tab.charAt((binarray[i>>2] >> ((i%4)*8+4)) & 0xF) +
+ hex_tab.charAt((binarray[i>>2] >> ((i%4)*8 )) & 0xF);
+ }
+ return str;
+}
+
+/*
+ * Convert an array of little-endian words to a base-64 string
+ */
+function binl2b64(binarray)
+{
+ var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+ var str = "";
+ for(var i = 0; i < binarray.length * 4; i += 3)
+ {
+ var triplet = (((binarray[i >> 2] >> 8 * ( i %4)) & 0xFF) << 16)
+ | (((binarray[i+1 >> 2] >> 8 * ((i+1)%4)) & 0xFF) << 8 )
+ | ((binarray[i+2 >> 2] >> 8 * ((i+2)%4)) & 0xFF);
+ for(var j = 0; j < 4; j++)
+ {
+ if(i * 8 + j * 6 > binarray.length * 32) str += b64pad;
+ else str += tab.charAt((triplet >> 6*(3-j)) & 0x3F);
+ }
+ }
+ return str;
+}
diff --git a/erp_web/js/pages/materials/in_out.js b/erp_web/js/pages/materials/in_out.js
index cfa761ff..d9c9d249 100644
--- a/erp_web/js/pages/materials/in_out.js
+++ b/erp_web/js/pages/materials/in_out.js
@@ -23,7 +23,8 @@
var organUrl = ""; //组织数据接口地址
var amountNum = ""; //单据编号开头字符
var depotString = ""; //店铺id列表
- var orgDefaultId = 0; //单位默认编号
+ /**默认编号有意义吗,不如空着吧*/
+ var orgDefaultId=''; //单位默认编号
var orgDefaultList; //存储查询出来的会员列表
var accountList; //账户列表
var outItemList; //支出项目列表
@@ -682,7 +683,7 @@
}
}
thisStock = (thisStock / loadRatio).toFixed(2);
- body.find("[field='Stock']").find(input).val(thisStock).attr("data-stock", res.rows[0].thisSum); //加载库存数据
+ body.find("[field='Stock']").find(input).val(thisStock).attr("data-stock", res.data.page[0].thisSum); //加载库存数据
}
else {
body.find("[field='Stock']").find(input).val(0).attr("data-stock", 0); //加载库存数据
@@ -757,14 +758,20 @@
anotherDepotTextField = "depotName";
}
if(listSubType == "礼品充值"){
+ /**
+ * who added the .action
+ * */
isShowAnotherDepot = false; //礼品充值时候显示礼品卡
anotherDepotHeadName = "礼品卡";
- anotherDepotUrl = "/depot/findGiftByType.action?type=1";
+ anotherDepotUrl = "/depot/findGiftByType?type=1";
anotherDepotTextField = "name";
}
if(listSubType == "礼品销售"){
+ /**
+ * who added the .action
+ * */
depotHeadName = "礼品卡";
- depotUrl = "/depot/findGiftByType.action?type=1";
+ depotUrl = "/depot/findGiftByType?type=1";
depotTextField = "name";
}
else {
@@ -1290,8 +1297,12 @@
if (r) {
$.ajax({
type:"post",
- url: "/depotHead/" + depotHeadID + "/delete",
+ // url: "/depotHead/" + depotHeadID + "/delete",
+ url: "/depotHead/deleteDepotHeadAndDetail",
dataType: "json",
+ data:{
+ id: depotHeadID
+ },
success: function (res) {
if(res && res.code == 200) {
$("#searchBtn").click();
@@ -1382,7 +1393,8 @@
//批量删除
$.ajax({
type:"post",
- url: "/depotHead/batchDelete",
+ // url: "/depotHead/batchDelete",
+ url: "/depotHead/batchDeleteDepotHeadAndDetail",
dataType: "json",
async : false,
data: ({
@@ -1560,7 +1572,7 @@
$("#addOrgan").off("click").on("click",function(){
$('#supplierDlg').dialog('open').dialog('setTitle','
增加供应商信息');
});
- url = '/depotHead/add';
+ url = '/depotHead/addDepotHeadAndDetail';
//零售单据修改收款时,自动计算找零
if(listSubType == "零售" || listSubType == "零售退货") {
@@ -1628,7 +1640,7 @@
}
$("#Number").val(depotHeadInfo[2]).attr("data-defaultNumber",depotHeadInfo[2]);
$("#OperTime").val(depotHeadInfo[4]);
- $('#OrganId').combobox('setValue', depotHeadInfo[5]);
+ $('#OrganId').combobox('setValue', depotHeadInfo[5]=='undefined'?'':depotHeadInfo[5]);
$("#HandsPersonId").val(depotHeadInfo[6]);
$("#AccountId").val(depotHeadInfo[7]);
$("#ChangeAmount").val(depotHeadInfo[8]);
@@ -1715,7 +1727,7 @@
initTableData_material("edit",TotalPrice); //商品列表
reject(); //撤销下、刷新商品列表
- url = '/depotHead/update?id=' + depotHeadInfo[0];
+ url = '/depotHead/updateDepotHeadAndDetail?id=' + depotHeadInfo[0];
}
//查看信息
@@ -1899,6 +1911,18 @@
return flag;
}
//保存信息
+ /**
+ * 2019-01-25
+ * 我对这个方法的实现结果存在严重怀疑,决定重构
+ * 有如下疑点:
+ * 1、保存完主表,返回结果后,再发起请求去操作子表,如何保证事务的一致性(业务数据一致性)
+ * 2、保存完主表后,再通过selectmax的方式去获取主表主键id完全就是看人品的不可靠的思路
+ * 修改计划:
+ * 2019-01-25修改零售出库相关操作
+ * 修改方式,重写url,将主从表操作合并
+ *
+ *
+ * **/
$("#saveDepotHead").off("click").on("click",function(){
if(!$('#depotHeadFM').form('validate')){
return;
@@ -1961,6 +1985,7 @@
$.messager.alert('提示', '选择多账户时的找零金额不能大于0!', 'warning');
return;
}
+
}
else if(listTitle === "销售出库列表"){
if(!$('#OrganId').combobox('getValue')){
@@ -2052,38 +2077,49 @@
if($("#AccountId").val() === "many"){ //多账户
getAccountID = null;
}
+ var infoStr=JSON.stringify({
+ Type: listType,
+ SubType: listSubType,
+ ProjectId: ProjectId,
+ AllocationProjectId: AllocationProjectId,
+ DefaultNumber: $.trim($("#Number").attr("data-defaultNumber")),//初始编号
+ Number: $.trim($("#Number").val()),
+ OperTime: $("#OperTime").val(),
+ OrganId: OrganId,
+ HandsPersonId: $.trim($("#HandsPersonId").val()),
+ Salesman: SalesmanStr, //销售人员
+ AccountId: getAccountID,
+ ChangeAmount: ChangeAmount, //付款/收款
+ TotalPrice: TotalPrice, //合计
+ PayType: thisPayType, //现付/预付款
+ Remark: $.trim($("#Remark").val()),
+ AccountIdList: $("#AccountId").attr("data-accountarr"), //账户列表-多账户
+ AccountMoneyList: accountMoneyArr ? JSON.stringify(accountMoneyArr) : "", //账户金额列表-多账户
+ Discount: $.trim($("#Discount").val()),
+ DiscountMoney: $.trim($("#DiscountMoney").val()),
+ DiscountLastMoney: $.trim($("#DiscountLastMoney").val()),
+ OtherMoney: $.trim($("#OtherMoney").val()), //采购费用、销售费用
+ OtherMoneyList: $("#OtherMoney").attr("data-itemarr"), //支出项目列表-涉及费用
+ OtherMoneyItem: $("#OtherMoney").attr("data-itemmoneyarr"), //支出项目金额列表-涉及费用
+ AccountDay: $("#AccountDay").val() //结算天数
+ });
+ /**
+ * 零售出库,单独操作
+ * */
+ if(url.indexOf("/depotHead/addDepotHeadAndDetail")>=0){
+ addDepotHeadAndDetail(url,infoStr);
+ return;
+ }else if(url.indexOf("/depotHead/updateDepotHeadAndDetail")>=0){
+ updateDepotHeadAndDetail(url,infoStr,preTotalPrice);
+ return;
+ }
$.ajax({
type:"post",
url: url,
dataType: "json",
async : false,
data: ({
- info : JSON.stringify({
- Type: listType,
- SubType: listSubType,
- ProjectId: ProjectId,
- AllocationProjectId: AllocationProjectId,
- DefaultNumber: $.trim($("#Number").attr("data-defaultNumber")),//初始编号
- Number: $.trim($("#Number").val()),
- OperTime: $("#OperTime").val(),
- OrganId: OrganId,
- HandsPersonId: $.trim($("#HandsPersonId").val()),
- Salesman: SalesmanStr, //销售人员
- AccountId: getAccountID,
- ChangeAmount: ChangeAmount, //付款/收款
- TotalPrice: TotalPrice, //合计
- PayType: thisPayType, //现付/预付款
- Remark: $.trim($("#Remark").val()),
- AccountIdList: $("#AccountId").attr("data-accountarr"), //账户列表-多账户
- AccountMoneyList: accountMoneyArr ? JSON.stringify(accountMoneyArr) : "", //账户金额列表-多账户
- Discount: $.trim($("#Discount").val()),
- DiscountMoney: $.trim($("#DiscountMoney").val()),
- DiscountLastMoney: $.trim($("#DiscountLastMoney").val()),
- OtherMoney: $.trim($("#OtherMoney").val()), //采购费用、销售费用
- OtherMoneyList: $("#OtherMoney").attr("data-itemarr"), //支出项目列表-涉及费用
- OtherMoneyItem: $("#OtherMoney").attr("data-itemmoneyarr"), //支出项目金额列表-涉及费用
- AccountDay: $("#AccountDay").val() //结算天数
- })
+ info:infoStr
}),
success: function (tipInfo)
{
@@ -2955,7 +2991,103 @@
}
}
-
+ /**
+ * 新增单据主表及单据子表
+ * */
+ function addDepotHeadAndDetail(url,infoStr){
+ var inserted = $("#materialData").datagrid('getChanges', "inserted");
+ var deleted = $("#materialData").datagrid('getChanges', "deleted");
+ var updated = $("#materialData").datagrid('getChanges', "updated");
+ $.ajax({
+ type:"post",
+ url: url,
+ dataType: "json",
+ async : false,
+ data: ({
+ info:infoStr,
+ inserted: JSON.stringify(inserted),
+ deleted: JSON.stringify(deleted),
+ updated: JSON.stringify(updated)
+ }),
+ success: function (tipInfo){
+
+ if(tipInfo){
+ if(tipInfo.code!=200){
+ $.messager.alert('提示', tipInfo.msg, 'error');
+ return;
+ }
+ $.messager.alert('提示','保存成功!','info');
+ $('#depotHeadDlg').dialog('close');
+ var opts = $("#tableData").datagrid('options');
+ showDepotHeadDetails(opts.pageNumber,opts.pageSize);
+
+ }else {
+ $.messager.show({
+ title: '错误提示',
+ msg: '保存信息失败,请稍后重试!'
+ });
+ }
+
+ },
+ //此处添加错误处理
+ error:function()
+ {
+ $.messager.alert('提示','保存信息异常,请稍后再试!','error');
+ return;
+ }
+
+
+ });
+ }
+ /**
+ * 修改单据主表及单据子表
+ * */
+ function updateDepotHeadAndDetail(url,infoStr,preTotalPrice){
+ var inserted = $("#materialData").datagrid('getChanges', "inserted");
+ var deleted = $("#materialData").datagrid('getChanges', "deleted");
+ var updated = $("#materialData").datagrid('getChanges', "updated");
+ $.ajax({
+ type:"post",
+ url: url,
+ dataType: "json",
+ async : false,
+ data: ({
+ id:url.substring(url.lastIndexOf("?id=")+4,url.length),
+ info:infoStr,
+ inserted: JSON.stringify(inserted),
+ deleted: JSON.stringify(deleted),
+ updated: JSON.stringify(updated),
+ preTotalPrice:preTotalPrice
+ }),
+ success: function (tipInfo){
+ if(tipInfo){
+ if(tipInfo.code!=200){
+ $.messager.alert('提示', tipInfo.msg, 'error');
+ return;
+ }
+ $.messager.alert('提示','保存成功!','info');
+ $('#depotHeadDlg').dialog('close');
+ var opts = $("#tableData").datagrid('options');
+ showDepotHeadDetails(opts.pageNumber,opts.pageSize);
+ if (endEditing()) {
+ $('#materialData').datagrid('acceptChanges');
+ }
+ }else {
+ $.messager.show({
+ title: '错误提示',
+ msg: '保存信息失败,请稍后重试!'
+ });
+ }
+
+ },
+ //此处添加错误处理
+ error:function()
+ {
+ $.messager.alert('提示','保存信息异常,请稍后再试!','error');
+ return;
+ }
+ });
+ }
diff --git a/erp_web/login.html b/erp_web/login.html
index 2e6d1101..af2d9094 100644
--- a/erp_web/login.html
+++ b/erp_web/login.html
@@ -7,6 +7,7 @@
+
-
+
+
diff --git a/erp_web/pages/materials/material.html b/erp_web/pages/materials/material.html
index 63c791e6..8f53413b 100644
--- a/erp_web/pages/materials/material.html
+++ b/erp_web/pages/materials/material.html
@@ -684,7 +684,7 @@
},
{
title: '序列号', field: 'enableSerialNumber', width: 70, align: "center", formatter: function (value) {
- return value ? "启用" : "禁用";
+ return value=='1' ? "启用" : "禁用";
}
}
]],
@@ -1363,7 +1363,7 @@
// console.log("enableSerialNumber:"+(materialInfo[24]=='true'?'1':'0'));
// console.log("enableSerialNumber:"+materialInfo[24]);
// $("#enableSerialNumber").combobox('setValue',materialInfo[24]=='true'?'1':'0');
- $("#enableSerialNumber").val(materialInfo[24]=='true'?'1':'0');
+ $("#enableSerialNumber").val(materialInfo[24]=='1'?'1':'0');
// console.log($("#enableSerialNumber").val());
var categoryName = ""; //类型名称
diff --git a/sql/jsh_erp.sql b/sql/jsh_erp.sql
index e62ae3af..74c8c29a 100644
--- a/sql/jsh_erp.sql
+++ b/sql/jsh_erp.sql
@@ -5219,5 +5219,25 @@ alter table jsh_material add enableSerialNumber bit(1) DEFAULT 0 COMMENT '是否
-- ----------------------------
delete from `jsh_functions` where Name='序列号';
INSERT INTO `jsh_functions`(`Number`, `Name`, `PNumber`, `URL`, `State`, `Sort`, `Enabled`, `Type`, `PushBtn`) VALUES ('010104', '序列号', '0101', '../manage/serialNumber.html', b'0', '0246', b'1', '电脑版', '');
-
-
+-- ----------------------------
+-- 删除单据主表供应商id字段对应外键约束
+-- ----------------------------
+ALTER TABLE jsh_depothead DROP FOREIGN KEY jsh_depothead_ibfk_3;
+-- ----------------------------
+-- 序列号表添加单据主表id字段,用于跟踪序列号流向
+-- ----------------------------
+alter table jsh_serial_number add depothead_Id bigint(20) DEFAULT null COMMENT '单据主表id,用于跟踪序列号流向';
+-- ----------------------------
+-- 修改商品表enableSerialNumber字段类型为varchar(1)
+-- ----------------------------
+alter table jsh_material change enableSerialNumber enableSerialNumber varchar(1) DEFAULT '0' COMMENT '是否开启序列号,0否,1是';
+-- ----------------------------
+-- 修改序列号表is_Sell字段类型为varchar(1)
+-- 修改序列号表delete_Flag字段类型为varchar(1)
+-- ----------------------------
+alter table jsh_serial_number change is_Sell is_Sell varchar(1) DEFAULT '0' COMMENT '是否卖出,0未卖出,1卖出';
+alter table jsh_serial_number change delete_Flag delete_Flag varchar(1) DEFAULT '0' COMMENT '删除标记,0未删除,1删除';
+-- ----------------------------
+-- 删除单据子表单据主表id字段对应外键约束
+-- ----------------------------
+ALTER TABLE jsh_depotitem DROP FOREIGN KEY jsh_depotitem_ibfk_1;
\ No newline at end of file
diff --git a/sql/华夏ERP数据库设计汇总.xlsx b/sql/华夏ERP数据库设计汇总.xlsx
index cc2f72ea..8bf618b5 100644
Binary files a/sql/华夏ERP数据库设计汇总.xlsx and b/sql/华夏ERP数据库设计汇总.xlsx differ
diff --git a/src/main/java/com/jsh/erp/constants/BusinessConstants.java b/src/main/java/com/jsh/erp/constants/BusinessConstants.java
index 9842ebff..557355b6 100644
--- a/src/main/java/com/jsh/erp/constants/BusinessConstants.java
+++ b/src/main/java/com/jsh/erp/constants/BusinessConstants.java
@@ -21,18 +21,49 @@ public class BusinessConstants {
* 默认的分页页数
*/
public static final String DEFAULT_PAGINATION_PAGE_SIZE = "10";
- /**
- * 商品是否开启序列号标识enableSerialNumber 0否false,1是true
- *
- * */
- public static final boolean MATERIAL_ENABLE_SERIAL_NUMBER = true;
- public static final boolean MATERIAL_NOT_ENABLE_SERIAL_NUMBER = false;
/**
* 单据主表出入库类型 type 入库 出库
* depothead
* */
public static final String DEPOTHEAD_TYPE_STORAGE = "入库";
public static final String DEPOTHEAD_TYPE_OUT = "出库";
+ /**
+ * 付款类型 payType //现付/预付款
+ * */
+ public static final String PAY_TYPE_PREPAID = "预付款";
+ public static final String PAY_TYPE_BY_CASH = "现付";
+ /**
+ * 删除标记 deleteFlag '0'未删除 '1'已删除
+ * */
+ public static final String DELETE_FLAG_DELETED = "1";
+ public static final String DELETE_FLAG_EXISTS = "0";
+ /**
+ * 是否卖出 isSell '0'未卖出 '1'已卖出
+ * */
+ public static final String IS_SELL_SELLED = "1";
+ public static final String IS_SELL_HOLD = "0";
+ /**
+ * 商品是否开启序列号标识enableSerialNumber '0'未启用 '1'启用
+ * */
+ public static final String ENABLE_SERIAL_NUMBER_ENABLED = "1";
+ public static final String ENABLE_SERIAL_NUMBER_NOT_ENABLED = "0";
+ /**
+ * 出入库分类
+ *采购、采购退货、其它、零售、销售、调拨、礼品充值
+ * */
+ public static final String SUB_TYPE_PURCHASE = "采购";
+ public static final String SUB_TYPE_PURCHASE_TETURNS = "采购退货";
+ public static final String SUB_TYPE_OTHER = "其它";
+ public static final String SUB_TYPE_RETAIL = "零售";
+ public static final String SUB_TYPE_SALES = "销售";
+ public static final String SUB_TYPE_TRANSFER = "调拨";
+ /**
+ * 批量插入sql时最大的数据条数
+ * */
+ public static final int BATCH_INSERT_MAX_NUMBER = 500;
+
+
+
diff --git a/src/main/java/com/jsh/erp/constants/ExceptionConstants.java b/src/main/java/com/jsh/erp/constants/ExceptionConstants.java
index 913eaf53..6e795ca1 100644
--- a/src/main/java/com/jsh/erp/constants/ExceptionConstants.java
+++ b/src/main/java/com/jsh/erp/constants/ExceptionConstants.java
@@ -34,6 +34,9 @@ public class ExceptionConstants {
/**序列号不能为为空*/
public static final int SERIAL_NUMBERE_NOT_BE_EMPTY_CODE = 10500000;
public static final String SERIAL_NUMBERE_NOT_BE_EMPTY_MSG = "序列号不能为为空";
+ /**商品%s下序列号不充足,请补充后重试*/
+ public static final int MATERIAL_SERIAL_NUMBERE_NOT_ENOUGH_CODE = 10500000;
+ public static final String MATERIAL_SERIAL_NUMBERE_NOT_ENOUGH_MSG = "商品:%s下序列号不充足,请补充后重试";
diff --git a/src/main/java/com/jsh/erp/controller/DepotController.java b/src/main/java/com/jsh/erp/controller/DepotController.java
index 64a6c840..3a195a1e 100644
--- a/src/main/java/com/jsh/erp/controller/DepotController.java
+++ b/src/main/java/com/jsh/erp/controller/DepotController.java
@@ -1,152 +1,152 @@
-package com.jsh.erp.controller;
-
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
-import com.jsh.erp.datasource.entities.Depot;
-import com.jsh.erp.service.depot.DepotService;
-import com.jsh.erp.service.userBusiness.UserBusinessService;
-import com.jsh.erp.utils.BaseResponseInfo;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.dao.DataAccessException;
-import org.springframework.web.bind.annotation.*;
-
-import javax.annotation.Resource;
-import javax.servlet.http.HttpServletRequest;
-import java.io.IOException;
-import java.util.List;
-
-/**
- * @author ji sheng hua 752*718*920
- */
-@RestController
-@RequestMapping(value = "/depot")
-public class DepotController {
- private Logger logger = LoggerFactory.getLogger(DepotController.class);
-
- @Resource
- private DepotService depotService;
-
- @Resource
- private UserBusinessService userBusinessService;
-
- @GetMapping(value = "/getAllList")
- public BaseResponseInfo getAllList(HttpServletRequest request) {
- BaseResponseInfo res = new BaseResponseInfo();
- try {
- List depotList = depotService.getAllList();
- res.code = 200;
- res.data = depotList;
- } catch(Exception e){
- e.printStackTrace();
- res.code = 500;
- res.data = "获取数据失败";
- }
- return res;
- }
-
- /**
- * 用户对应仓库显示
- * @param type
- * @param keyId
- * @param request
- * @return
- */
- @PostMapping(value = "/findUserDepot")
- public JSONArray findUserDepot(@RequestParam("UBType") String type, @RequestParam("UBKeyId") String keyId,
- HttpServletRequest request) {
- JSONArray arr = new JSONArray();
- try {
- List dataList = depotService.findUserDepot();
- //开始拼接json数据
- JSONObject outer = new JSONObject();
- outer.put("id", 1);
- outer.put("text", "仓库列表");
- outer.put("state", "open");
- //存放数据json数组
- JSONArray dataArray = new JSONArray();
- if (null != dataList) {
- for (Depot depot : dataList) {
- JSONObject item = new JSONObject();
- item.put("id", depot.getId());
- item.put("text", depot.getName());
- //勾选判断1
- Boolean flag = false;
- try {
- flag = userBusinessService.checkIsUserBusinessExist(type, keyId, "[" + depot.getId().toString() + "]");
- } catch (Exception e) {
- logger.error(">>>>>>>>>>>>>>>>>设置用户对应的仓库:类型" + type + " KeyId为: " + keyId + " 存在异常!");
- }
- if (flag == true) {
- item.put("checked", true);
- }
- //结束
- dataArray.add(item);
- }
- }
- outer.put("children", dataArray);
- arr.add(outer);
- } catch (Exception e) {
- e.printStackTrace();
- }
- return arr;
- }
-
- @GetMapping(value = "/findDepotByUserId")
- public JSONArray findDepotByUserId(@RequestParam("UBType") String type, @RequestParam("UBKeyId") String keyId,
- HttpServletRequest request) {
- JSONArray arr = new JSONArray();
- try {
- List dataList = depotService.findUserDepot();
- //开始拼接json数据
- if (null != dataList) {
- for (Depot depot : dataList) {
- JSONObject item = new JSONObject();
- //勾选判断1
- Boolean flag = false;
- try {
- flag = userBusinessService.checkIsUserBusinessExist(type, keyId, "[" + depot.getId().toString() + "]");
- } catch (DataAccessException e) {
- logger.error(">>>>>>>>>>>>>>>>>查询用户对应的仓库:类型" + type + " KeyId为: " + keyId + " 存在异常!");
- }
- if (flag == true) {
- item.put("id", depot.getId());
- item.put("depotName", depot.getName());
- arr.add(item);
- }
- }
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- return arr;
- }
-
- /**
- * 查找礼品卡-虚拟仓库
- * @param type
- * @param request
- * @return
- */
- @PostMapping(value = "/findGiftByType")
- public JSONArray findGiftByType(@RequestParam("type") Integer type,
- HttpServletRequest request) {
- JSONArray arr = new JSONArray();
- try {
- List dataList = depotService.findGiftByType(type);
- //存放数据json数组
- if (null != dataList) {
- for (Depot depot : dataList) {
- JSONObject item = new JSONObject();
- item.put("id", depot.getId());
- //仓库名称
- item.put("name", depot.getName());
- arr.add(item);
- }
- }
- } catch (Exception e) {
- logger.error(">>>>>>>>>查找仓库信息异常", e);
- }
- return arr;
- }
-}
+package com.jsh.erp.controller;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.jsh.erp.datasource.entities.Depot;
+import com.jsh.erp.service.depot.DepotService;
+import com.jsh.erp.service.userBusiness.UserBusinessService;
+import com.jsh.erp.utils.BaseResponseInfo;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.dao.DataAccessException;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import java.io.IOException;
+import java.util.List;
+
+/**
+ * @author ji sheng hua 752*718*920
+ */
+@RestController
+@RequestMapping(value = "/depot")
+public class DepotController {
+ private Logger logger = LoggerFactory.getLogger(DepotController.class);
+
+ @Resource
+ private DepotService depotService;
+
+ @Resource
+ private UserBusinessService userBusinessService;
+
+ @GetMapping(value = "/getAllList")
+ public BaseResponseInfo getAllList(HttpServletRequest request) {
+ BaseResponseInfo res = new BaseResponseInfo();
+ try {
+ List depotList = depotService.getAllList();
+ res.code = 200;
+ res.data = depotList;
+ } catch(Exception e){
+ e.printStackTrace();
+ res.code = 500;
+ res.data = "获取数据失败";
+ }
+ return res;
+ }
+
+ /**
+ * 用户对应仓库显示
+ * @param type
+ * @param keyId
+ * @param request
+ * @return
+ */
+ @PostMapping(value = "/findUserDepot")
+ public JSONArray findUserDepot(@RequestParam("UBType") String type, @RequestParam("UBKeyId") String keyId,
+ HttpServletRequest request) {
+ JSONArray arr = new JSONArray();
+ try {
+ List dataList = depotService.findUserDepot();
+ //开始拼接json数据
+ JSONObject outer = new JSONObject();
+ outer.put("id", 1);
+ outer.put("text", "仓库列表");
+ outer.put("state", "open");
+ //存放数据json数组
+ JSONArray dataArray = new JSONArray();
+ if (null != dataList) {
+ for (Depot depot : dataList) {
+ JSONObject item = new JSONObject();
+ item.put("id", depot.getId());
+ item.put("text", depot.getName());
+ //勾选判断1
+ Boolean flag = false;
+ try {
+ flag = userBusinessService.checkIsUserBusinessExist(type, keyId, "[" + depot.getId().toString() + "]");
+ } catch (Exception e) {
+ logger.error(">>>>>>>>>>>>>>>>>设置用户对应的仓库:类型" + type + " KeyId为: " + keyId + " 存在异常!");
+ }
+ if (flag == true) {
+ item.put("checked", true);
+ }
+ //结束
+ dataArray.add(item);
+ }
+ }
+ outer.put("children", dataArray);
+ arr.add(outer);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return arr;
+ }
+
+ @RequestMapping(value = "/findDepotByUserId")
+ public JSONArray findDepotByUserId(@RequestParam("UBType") String type, @RequestParam("UBKeyId") String keyId,
+ HttpServletRequest request) {
+ JSONArray arr = new JSONArray();
+ try {
+ List dataList = depotService.findUserDepot();
+ //开始拼接json数据
+ if (null != dataList) {
+ for (Depot depot : dataList) {
+ JSONObject item = new JSONObject();
+ //勾选判断1
+ Boolean flag = false;
+ try {
+ flag = userBusinessService.checkIsUserBusinessExist(type, keyId, "[" + depot.getId().toString() + "]");
+ } catch (DataAccessException e) {
+ logger.error(">>>>>>>>>>>>>>>>>查询用户对应的仓库:类型" + type + " KeyId为: " + keyId + " 存在异常!");
+ }
+ if (flag == true) {
+ item.put("id", depot.getId());
+ item.put("depotName", depot.getName());
+ arr.add(item);
+ }
+ }
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return arr;
+ }
+
+ /**
+ * 查找礼品卡-虚拟仓库
+ * @param type
+ * @param request
+ * @return
+ */
+ @RequestMapping(value = "/findGiftByType")
+ public JSONArray findGiftByType(@RequestParam("type") Integer type,
+ HttpServletRequest request) {
+ JSONArray arr = new JSONArray();
+ try {
+ List dataList = depotService.findGiftByType(type);
+ //存放数据json数组
+ if (null != dataList) {
+ for (Depot depot : dataList) {
+ JSONObject item = new JSONObject();
+ item.put("id", depot.getId());
+ //仓库名称
+ item.put("name", depot.getName());
+ arr.add(item);
+ }
+ }
+ } catch (Exception e) {
+ logger.error(">>>>>>>>>查找仓库信息异常", e);
+ }
+ return arr;
+ }
+}
diff --git a/src/main/java/com/jsh/erp/controller/DepotHeadController.java b/src/main/java/com/jsh/erp/controller/DepotHeadController.java
index 28e21a2d..f0e8d2e9 100644
--- a/src/main/java/com/jsh/erp/controller/DepotHeadController.java
+++ b/src/main/java/com/jsh/erp/controller/DepotHeadController.java
@@ -2,6 +2,7 @@ package com.jsh.erp.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
+import com.jsh.erp.constants.ExceptionConstants;
import com.jsh.erp.datasource.entities.DepotHead;
import com.jsh.erp.datasource.vo.DepotHeadVo4InDetail;
import com.jsh.erp.datasource.vo.DepotHeadVo4InOutMCount;
@@ -464,5 +465,75 @@ public class DepotHeadController {
}
return allMoney;
}
+ /**
+ * create by: cjl
+ * description:
+ * 新增单据主表及单据子表信息
+ * create time: 2019/1/25 14:36
+ * @Param: beanJson
+ * @Param: inserted
+ * @Param: deleted
+ * @Param: updated
+ * @return java.lang.String
+ */
+ @RequestMapping(value = "/addDepotHeadAndDetail")
+ public Object addDepotHeadAndDetail(@RequestParam("info") String beanJson,@RequestParam("inserted") String inserted,
+ @RequestParam("deleted") String deleted,
+ @RequestParam("updated") String updated) throws Exception{
+ JSONObject result = ExceptionConstants.standardSuccess();
+ depotHeadService.addDepotHeadAndDetail(beanJson,inserted,deleted,updated);
+ return result;
+ }
+ /**
+ * create by: cjl
+ * description:
+ * 更新单据主表及单据子表信息
+ * create time: 2019/1/28 14:47
+ * @Param: id
+ * @Param: beanJson
+ * @Param: inserted
+ * @Param: deleted
+ * @Param: updated
+ * @Param: preTotalPrice
+ * @return java.lang.Object
+ */
+ @RequestMapping(value = "/updateDepotHeadAndDetail")
+ public Object updateDepotHeadAndDetail(@RequestParam("id") Long id,@RequestParam("info") String beanJson,@RequestParam("inserted") String inserted,
+ @RequestParam("deleted") String deleted,
+ @RequestParam("updated") String updated,@RequestParam("preTotalPrice") BigDecimal preTotalPrice) throws Exception{
+ JSONObject result = ExceptionConstants.standardSuccess();
+ depotHeadService.updateDepotHeadAndDetail(id,beanJson,inserted,deleted,updated,preTotalPrice);
+ return result;
+ }
+ /**
+ * create by: cjl
+ * description:
+ * 删除单据主表及子表信息
+ * create time: 2019/1/28 17:29
+ * @Param: id
+ * @return java.lang.Object
+ */
+ @RequestMapping(value = "/deleteDepotHeadAndDetail")
+ public Object deleteDepotHeadAndDetail(@RequestParam("id") Long id) throws Exception{
+
+ JSONObject result = ExceptionConstants.standardSuccess();
+ depotHeadService.deleteDepotHeadAndDetail(id);
+ return result;
+ }
+ /**
+ * create by: cjl
+ * description:
+ * 删除单据主表及子表信息
+ * create time: 2019/1/28 17:29
+ * @Param: id
+ * @return java.lang.Object
+ */
+ @RequestMapping(value = "/batchDeleteDepotHeadAndDetail")
+ public Object batchDeleteDepotHeadAndDetail(@RequestParam("ids") String ids) throws Exception{
+
+ JSONObject result = ExceptionConstants.standardSuccess();
+ depotHeadService.batchDeleteDepotHeadAndDetail(ids);
+ return result;
+ }
}
diff --git a/src/main/java/com/jsh/erp/controller/DepotItemController.java b/src/main/java/com/jsh/erp/controller/DepotItemController.java
index 16c776e2..99aedefc 100644
--- a/src/main/java/com/jsh/erp/controller/DepotItemController.java
+++ b/src/main/java/com/jsh/erp/controller/DepotItemController.java
@@ -262,7 +262,7 @@ public class DepotItemController {
@RequestParam("deleted") String deleted,
@RequestParam("updated") String updated,
@RequestParam("headerId") Long headerId,
- HttpServletRequest request) {
+ HttpServletRequest request) throws Exception{
Map objectMap = new HashMap();
try {
depotItemService.saveDetials(inserted,deleted,updated,headerId);
diff --git a/src/main/java/com/jsh/erp/controller/SerialNumberController.java b/src/main/java/com/jsh/erp/controller/SerialNumberController.java
index a75d434c..f47a6210 100644
--- a/src/main/java/com/jsh/erp/controller/SerialNumberController.java
+++ b/src/main/java/com/jsh/erp/controller/SerialNumberController.java
@@ -88,6 +88,27 @@ public class SerialNumberController {
return result;
}
+ /**
+ * create by: cjl
+ * description:
+ *批量添加序列号
+ * create time: 2019/1/29 15:11
+ * @Param: materialName
+ * @Param: serialNumberPrefix
+ * @Param: batAddTotal
+ * @Param: remark
+ * @return java.lang.Object
+ */
+ @PostMapping("/serialNumber/batAddSerialNumber")
+ @ResponseBody
+ public Object batAddSerialNumber(@RequestParam("materialName") String materialName, @RequestParam("serialNumberPrefix") String serialNumberPrefix,
+ @RequestParam("batAddTotal") Integer batAddTotal,@RequestParam("remark") String remark){
+
+ JSONObject result = ExceptionConstants.standardSuccess();
+ serialNumberService.batAddSerialNumber(materialName,serialNumberPrefix,batAddTotal,remark);
+ return result;
+
+ }
diff --git a/src/main/java/com/jsh/erp/controller/SupplierController.java b/src/main/java/com/jsh/erp/controller/SupplierController.java
index 81255fe7..e7b1e1ab 100644
--- a/src/main/java/com/jsh/erp/controller/SupplierController.java
+++ b/src/main/java/com/jsh/erp/controller/SupplierController.java
@@ -176,7 +176,12 @@ public class SupplierController {
item.put("AdvanceIn", supplier.getAdvancein());
item.put("BeginNeedGet", supplier.getBeginneedget());
item.put("BeginNeedPay", supplier.getBeginneedpay());
- item.put("isystem", supplier.getIsystem() == (short) 0 ? "是" : "否");
+ /**
+ * 2018-01-28这里会有空指针异常
+ * */
+ if(supplier.getIsystem()!=null){
+ item.put("isystem", supplier.getIsystem() == (short) 0 ? "是" : "否");
+ }
item.put("description", supplier.getDescription());
item.put("fax", supplier.getFax());
item.put("telephone", supplier.getTelephone());
diff --git a/src/main/java/com/jsh/erp/controller/UserController.java b/src/main/java/com/jsh/erp/controller/UserController.java
index 542b1877..46260d9c 100644
--- a/src/main/java/com/jsh/erp/controller/UserController.java
+++ b/src/main/java/com/jsh/erp/controller/UserController.java
@@ -1,211 +1,211 @@
-package com.jsh.erp.controller;
-
-import com.jsh.erp.datasource.entities.User;
-import com.jsh.erp.service.user.UserService;
-import com.jsh.erp.utils.*;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.web.bind.annotation.*;
-
-import javax.annotation.Resource;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.security.NoSuchAlgorithmException;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import static com.jsh.erp.utils.ResponseJsonUtil.returnJson;
-
-/**
- * @author ji_sheng_hua 华夏erp
- */
-@RestController
-@RequestMapping(value = "/user")
-public class UserController {
- private Logger logger = LoggerFactory.getLogger(ResourceController.class);
-
- @Resource
- private UserService userService;
-
- private static String message = "成功";
-
- @PostMapping(value = "/login")
- public BaseResponseInfo login(@RequestParam(value = "loginame", required = false) String loginame,
- @RequestParam(value = "password", required = false) String password,
- HttpServletRequest request) {
- logger.info("============用户登录 login 方法调用开始==============");
- String msgTip = "";
- BaseResponseInfo res = new BaseResponseInfo();
- try {
- String username = loginame.trim();
- password = password.trim();
- //因密码用MD5加密,需要对密码进行转化
- try {
- password = Tools.md5Encryp(password);
- } catch (NoSuchAlgorithmException e) {
- e.printStackTrace();
- logger.error(">>>>>>>>>>>>>>转化MD5字符串错误 :" + e.getMessage(), e);
- }
- //判断用户是否已经登录过,登录过不再处理
- Object userInfo = request.getSession().getAttribute("user");
- User sessionUser = new User();
- if (userInfo != null) {
- sessionUser = (User) userInfo;
- }
- if (sessionUser != null && username.equalsIgnoreCase(sessionUser.getLoginame())) {
- logger.info("====用户 " + username + "已经登录过, login 方法调用结束====");
- msgTip = "user already login";
- }
- //获取用户状态
- int userStatus = -1;
- try {
- userStatus = userService.validateUser(username, password);
- } catch (Exception e) {
- logger.error(">>>>>>>>>>>>>用户 " + username + " 登录 login 方法 访问服务层异常====", e);
- msgTip = "access service exception";
- }
- switch (userStatus) {
- case ExceptionCodeConstants.UserExceptionCode.USER_NOT_EXIST:
- msgTip = "user is not exist";
- break;
- case ExceptionCodeConstants.UserExceptionCode.USER_PASSWORD_ERROR:
- msgTip = "user password error";
- break;
- case ExceptionCodeConstants.UserExceptionCode.BLACK_USER:
- msgTip = "user is black";
- break;
- case ExceptionCodeConstants.UserExceptionCode.USER_ACCESS_EXCEPTION:
- msgTip = "access service error";
- break;
- default:
- try {
- //验证通过 ,可以登录,放入session,记录登录日志
- User user = userService.getUserByUserName(username);
- // logService.create(new Logdetails(user, "登录系统", model.getClientIp(),
- // new Timestamp(System.currentTimeMillis()), (short) 0, "管理用户:" + username + " 登录系统", username + " 登录系统"));
- msgTip = "user can login";
- request.getSession().setAttribute("user",user);
- } catch (Exception e) {
- logger.error(">>>>>>>>>>>>>>>查询用户名为:" + username + " ,用户信息异常", e);
- }
- break;
- }
- Map data = new HashMap();
- data.put("msgTip", msgTip);
- res.code = 200;
- res.data = data;
- logger.info("===============用户登录 login 方法调用结束===============");
- } catch(Exception e){
- e.printStackTrace();
- res.code = 500;
- res.data = "用户登录失败";
- }
- return res;
- }
-
- @GetMapping(value = "/getUserSession")
- public BaseResponseInfo getSessionUser(HttpServletRequest request) {
- BaseResponseInfo res = new BaseResponseInfo();
- try {
- Map data = new HashMap();
- Object userInfo = request.getSession().getAttribute("user");
- if(userInfo!=null) {
- User user = (User) userInfo;
- user.setPassword(null);
- data.put("user", user);
- }
- res.code = 200;
- res.data = data;
- } catch(Exception e){
- e.printStackTrace();
- res.code = 500;
- res.data = "获取session失败";
- }
- return res;
- }
-
- @GetMapping(value = "/logout")
- public BaseResponseInfo logout(HttpServletRequest request, HttpServletResponse response) {
- BaseResponseInfo res = new BaseResponseInfo();
- try {
- request.getSession().removeAttribute("user");
- response.sendRedirect("/login.html");
- } catch(Exception e){
- e.printStackTrace();
- res.code = 500;
- res.data = "退出失败";
- }
- return res;
- }
-
- @PostMapping(value = "/resetPwd")
- public String resetPwd(@RequestParam("id") Long id,
- HttpServletRequest request) throws NoSuchAlgorithmException {
- Map objectMap = new HashMap();
- String password = "123456";
- String md5Pwd = Tools.md5Encryp(password);
- int update = userService.resetPwd(md5Pwd, id);
- if(update > 0) {
- return returnJson(objectMap, message, ErpInfo.OK.code);
- } else {
- return returnJson(objectMap, message, ErpInfo.ERROR.code);
- }
- }
-
- @PostMapping(value = "/updatePwd")
- public String updatePwd(@RequestParam("userId") Long userId, @RequestParam("password") String password,
- @RequestParam("oldpwd") String oldpwd, HttpServletRequest request) {
- Integer flag = 0;
- Map objectMap = new HashMap();
- try {
- User user = userService.getUser(userId);
- String oldPassword = Tools.md5Encryp(oldpwd);
- String md5Pwd = Tools.md5Encryp(password);
- //必须和原始密码一致才可以更新密码
- if(user.getLoginame().equals("jsh")){
- flag = 3; //管理员jsh不能修改密码
- } else if (oldPassword.equalsIgnoreCase(user.getPassword())) {
- user.setPassword(md5Pwd);
- flag = userService.updateUserByObj(user); //1-成功
- } else {
- flag = 2; //原始密码输入错误
- }
- objectMap.put("status", flag);
- if(flag > 0) {
- return returnJson(objectMap, message, ErpInfo.OK.code);
- } else {
- return returnJson(objectMap, message, ErpInfo.ERROR.code);
- }
- } catch (Exception e) {
- logger.error(">>>>>>>>>>>>>修改用户ID为 : " + userId + "密码信息失败", e);
- flag = 3;
- objectMap.put("status", flag);
- return returnJson(objectMap, message, ErpInfo.ERROR.code);
- }
- }
-
- /**
- * 获取全部用户数据列表
- * @param request
- * @return
- */
- @GetMapping(value = "/getAllList")
- public BaseResponseInfo getAllList(HttpServletRequest request) {
- BaseResponseInfo res = new BaseResponseInfo();
- try {
- Map data = new HashMap();
- List dataList = userService.getUser();
- if(dataList!=null) {
- data.put("userList", dataList);
- }
- res.code = 200;
- res.data = data;
- } catch(Exception e){
- e.printStackTrace();
- res.code = 500;
- res.data = "获取失败";
- }
- return res;
- }
-}
+package com.jsh.erp.controller;
+
+import com.jsh.erp.datasource.entities.User;
+import com.jsh.erp.service.user.UserService;
+import com.jsh.erp.utils.*;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.security.NoSuchAlgorithmException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import static com.jsh.erp.utils.ResponseJsonUtil.returnJson;
+
+/**
+ * @author ji_sheng_hua 华夏erp
+ */
+@RestController
+@RequestMapping(value = "/user")
+public class UserController {
+ private Logger logger = LoggerFactory.getLogger(ResourceController.class);
+
+ @Resource
+ private UserService userService;
+
+ private static String message = "成功";
+
+ @PostMapping(value = "/login")
+ public BaseResponseInfo login(@RequestParam(value = "loginame", required = false) String loginame,
+ @RequestParam(value = "password", required = false) String password,
+ HttpServletRequest request) {
+ logger.info("============用户登录 login 方法调用开始==============");
+ String msgTip = "";
+ BaseResponseInfo res = new BaseResponseInfo();
+ try {
+ String username = loginame.trim();
+ password = password.trim();
+ //因密码用MD5加密,需要对密码进行转化
+// try {
+// password = Tools.md5Encryp(password);
+// } catch (NoSuchAlgorithmException e) {
+// e.printStackTrace();
+// logger.error(">>>>>>>>>>>>>>转化MD5字符串错误 :" + e.getMessage(), e);
+// }
+ //判断用户是否已经登录过,登录过不再处理
+ Object userInfo = request.getSession().getAttribute("user");
+ User sessionUser = new User();
+ if (userInfo != null) {
+ sessionUser = (User) userInfo;
+ }
+ if (sessionUser != null && username.equalsIgnoreCase(sessionUser.getLoginame())) {
+ logger.info("====用户 " + username + "已经登录过, login 方法调用结束====");
+ msgTip = "user already login";
+ }
+ //获取用户状态
+ int userStatus = -1;
+ try {
+ userStatus = userService.validateUser(username, password);
+ } catch (Exception e) {
+ logger.error(">>>>>>>>>>>>>用户 " + username + " 登录 login 方法 访问服务层异常====", e);
+ msgTip = "access service exception";
+ }
+ switch (userStatus) {
+ case ExceptionCodeConstants.UserExceptionCode.USER_NOT_EXIST:
+ msgTip = "user is not exist";
+ break;
+ case ExceptionCodeConstants.UserExceptionCode.USER_PASSWORD_ERROR:
+ msgTip = "user password error";
+ break;
+ case ExceptionCodeConstants.UserExceptionCode.BLACK_USER:
+ msgTip = "user is black";
+ break;
+ case ExceptionCodeConstants.UserExceptionCode.USER_ACCESS_EXCEPTION:
+ msgTip = "access service error";
+ break;
+ default:
+ try {
+ //验证通过 ,可以登录,放入session,记录登录日志
+ User user = userService.getUserByUserName(username);
+ // logService.create(new Logdetails(user, "登录系统", model.getClientIp(),
+ // new Timestamp(System.currentTimeMillis()), (short) 0, "管理用户:" + username + " 登录系统", username + " 登录系统"));
+ msgTip = "user can login";
+ request.getSession().setAttribute("user",user);
+ } catch (Exception e) {
+ logger.error(">>>>>>>>>>>>>>>查询用户名为:" + username + " ,用户信息异常", e);
+ }
+ break;
+ }
+ Map data = new HashMap();
+ data.put("msgTip", msgTip);
+ res.code = 200;
+ res.data = data;
+ logger.info("===============用户登录 login 方法调用结束===============");
+ } catch(Exception e){
+ e.printStackTrace();
+ res.code = 500;
+ res.data = "用户登录失败";
+ }
+ return res;
+ }
+
+ @GetMapping(value = "/getUserSession")
+ public BaseResponseInfo getSessionUser(HttpServletRequest request) {
+ BaseResponseInfo res = new BaseResponseInfo();
+ try {
+ Map data = new HashMap();
+ Object userInfo = request.getSession().getAttribute("user");
+ if(userInfo!=null) {
+ User user = (User) userInfo;
+ user.setPassword(null);
+ data.put("user", user);
+ }
+ res.code = 200;
+ res.data = data;
+ } catch(Exception e){
+ e.printStackTrace();
+ res.code = 500;
+ res.data = "获取session失败";
+ }
+ return res;
+ }
+
+ @GetMapping(value = "/logout")
+ public BaseResponseInfo logout(HttpServletRequest request, HttpServletResponse response) {
+ BaseResponseInfo res = new BaseResponseInfo();
+ try {
+ request.getSession().removeAttribute("user");
+ response.sendRedirect("/login.html");
+ } catch(Exception e){
+ e.printStackTrace();
+ res.code = 500;
+ res.data = "退出失败";
+ }
+ return res;
+ }
+
+ @PostMapping(value = "/resetPwd")
+ public String resetPwd(@RequestParam("id") Long id,
+ HttpServletRequest request) throws NoSuchAlgorithmException {
+ Map objectMap = new HashMap();
+ String password = "123456";
+ String md5Pwd = Tools.md5Encryp(password);
+ int update = userService.resetPwd(md5Pwd, id);
+ if(update > 0) {
+ return returnJson(objectMap, message, ErpInfo.OK.code);
+ } else {
+ return returnJson(objectMap, message, ErpInfo.ERROR.code);
+ }
+ }
+
+ @PostMapping(value = "/updatePwd")
+ public String updatePwd(@RequestParam("userId") Long userId, @RequestParam("password") String password,
+ @RequestParam("oldpwd") String oldpwd, HttpServletRequest request) {
+ Integer flag = 0;
+ Map objectMap = new HashMap();
+ try {
+ User user = userService.getUser(userId);
+ String oldPassword = Tools.md5Encryp(oldpwd);
+ String md5Pwd = Tools.md5Encryp(password);
+ //必须和原始密码一致才可以更新密码
+ if(user.getLoginame().equals("jsh")){
+ flag = 3; //管理员jsh不能修改密码
+ } else if (oldPassword.equalsIgnoreCase(user.getPassword())) {
+ user.setPassword(md5Pwd);
+ flag = userService.updateUserByObj(user); //1-成功
+ } else {
+ flag = 2; //原始密码输入错误
+ }
+ objectMap.put("status", flag);
+ if(flag > 0) {
+ return returnJson(objectMap, message, ErpInfo.OK.code);
+ } else {
+ return returnJson(objectMap, message, ErpInfo.ERROR.code);
+ }
+ } catch (Exception e) {
+ logger.error(">>>>>>>>>>>>>修改用户ID为 : " + userId + "密码信息失败", e);
+ flag = 3;
+ objectMap.put("status", flag);
+ return returnJson(objectMap, message, ErpInfo.ERROR.code);
+ }
+ }
+
+ /**
+ * 获取全部用户数据列表
+ * @param request
+ * @return
+ */
+ @GetMapping(value = "/getAllList")
+ public BaseResponseInfo getAllList(HttpServletRequest request) {
+ BaseResponseInfo res = new BaseResponseInfo();
+ try {
+ Map data = new HashMap();
+ List dataList = userService.getUser();
+ if(dataList!=null) {
+ data.put("userList", dataList);
+ }
+ res.code = 200;
+ res.data = data;
+ } catch(Exception e){
+ e.printStackTrace();
+ res.code = 500;
+ res.data = "获取失败";
+ }
+ return res;
+ }
+}
diff --git a/src/main/java/com/jsh/erp/datasource/entities/Material.java b/src/main/java/com/jsh/erp/datasource/entities/Material.java
index f21c6adf..e7d2f0f1 100644
--- a/src/main/java/com/jsh/erp/datasource/entities/Material.java
+++ b/src/main/java/com/jsh/erp/datasource/entities/Material.java
@@ -190,7 +190,7 @@ public class Material {
* 2019-01-21新增字段enableSerialNumber
*是否开启序列号
* */
- private Boolean enableSerialNumber;
+ private String enableSerialNumber;
/**
* This method was generated by MyBatis Generator.
@@ -744,11 +744,11 @@ public class Material {
this.otherfield3 = otherfield3 == null ? null : otherfield3.trim();
}
- public Boolean getEnableSerialNumber() {
+ public String getEnableSerialNumber() {
return enableSerialNumber;
}
- public void setEnableSerialNumber(Boolean enableSerialNumber) {
+ public void setEnableSerialNumber(String enableSerialNumber) {
this.enableSerialNumber = enableSerialNumber;
}
}
\ No newline at end of file
diff --git a/src/main/java/com/jsh/erp/datasource/entities/MaterialExample.java b/src/main/java/com/jsh/erp/datasource/entities/MaterialExample.java
index f962828e..e74d0a68 100644
--- a/src/main/java/com/jsh/erp/datasource/entities/MaterialExample.java
+++ b/src/main/java/com/jsh/erp/datasource/entities/MaterialExample.java
@@ -1704,6 +1704,72 @@ public class MaterialExample {
addCriterion("OtherField3 not between", value1, value2, "otherfield3");
return (Criteria) this;
}
+ public Criteria andEnableSerialNumberIsNull() {
+ addCriterion("enableSerialNumber is null");
+ return (Criteria) this;
+ }
+
+ public Criteria andEnableSerialNumberIsNotNull() {
+ addCriterion("enableSerialNumber is not null");
+ return (Criteria) this;
+ }
+
+ public Criteria andEnableSerialNumberEqualTo(String value) {
+ addCriterion("enableSerialNumber =", value, "enableSerialNumber");
+ return (Criteria) this;
+ }
+
+ public Criteria andEnableSerialNumberNotEqualTo(String value) {
+ addCriterion("enableSerialNumber <>", value, "enableSerialNumber");
+ return (Criteria) this;
+ }
+
+ public Criteria andEnableSerialNumberGreaterThan(String value) {
+ addCriterion("enableSerialNumber >", value, "enableSerialNumber");
+ return (Criteria) this;
+ }
+
+ public Criteria andEnableSerialNumberGreaterThanOrEqualTo(String value) {
+ addCriterion("enableSerialNumber >=", value, "enableSerialNumber");
+ return (Criteria) this;
+ }
+
+ public Criteria andEnableSerialNumberLessThan(String value) {
+ addCriterion("enableSerialNumber <", value, "enableSerialNumber");
+ return (Criteria) this;
+ }
+
+ public Criteria andEnableSerialNumberLessThanOrEqualTo(String value) {
+ addCriterion("enableSerialNumber <=", value, "enableSerialNumber");
+ return (Criteria) this;
+ }
+ public Criteria andEnableSerialNumberLike(String value) {
+ addCriterion("enableSerialNumber like", value, "enableSerialNumber");
+ return (Criteria) this;
+ }
+ public Criteria andEnableSerialNumberNotLike(String value) {
+ addCriterion("enableSerialNumber not like", value, "enableSerialNumber");
+ return (Criteria) this;
+ }
+ public Criteria andEnableSerialNumberIn(List values) {
+ addCriterion("enableSerialNumber in", values, "enableSerialNumber");
+ return (Criteria) this;
+ }
+
+ public Criteria andEnableSerialNumberNotIn(List values) {
+ addCriterion("enableSerialNumber not in", values, "enableSerialNumber");
+ return (Criteria) this;
+ }
+
+ public Criteria andEnableSerialNumberBetween(String value1, String value2) {
+ addCriterion("enableSerialNumber between", value1, value2, "enableSerialNumber");
+ return (Criteria) this;
+ }
+
+ public Criteria andEnableSerialNumberNotBetween(String value1, String value2) {
+ addCriterion("enableSerialNumber not between", value1, value2, "enableSerialNumber");
+ return (Criteria) this;
+ }
}
/**
diff --git a/src/main/java/com/jsh/erp/datasource/entities/MaterialVo4Unit.java b/src/main/java/com/jsh/erp/datasource/entities/MaterialVo4Unit.java
index 521442a7..47101015 100644
--- a/src/main/java/com/jsh/erp/datasource/entities/MaterialVo4Unit.java
+++ b/src/main/java/com/jsh/erp/datasource/entities/MaterialVo4Unit.java
@@ -59,7 +59,7 @@ public class MaterialVo4Unit {
* 2019-01-21新增字段enableSerialNumber
*是否开启序列号
* */
- private Boolean enableSerialNumber;
+ private String enableSerialNumber;
public Long getId() {
return id;
@@ -269,11 +269,11 @@ public class MaterialVo4Unit {
this.materialOther = materialOther;
}
- public Boolean getEnableSerialNumber() {
+ public String getEnableSerialNumber() {
return enableSerialNumber;
}
- public void setEnableSerialNumber(Boolean enableSerialNumber) {
+ public void setEnableSerialNumber(String enableSerialNumber) {
this.enableSerialNumber = enableSerialNumber;
}
}
\ No newline at end of file
diff --git a/src/main/java/com/jsh/erp/datasource/entities/SerialNumber.java b/src/main/java/com/jsh/erp/datasource/entities/SerialNumber.java
index 63b14de6..e00648cc 100644
--- a/src/main/java/com/jsh/erp/datasource/entities/SerialNumber.java
+++ b/src/main/java/com/jsh/erp/datasource/entities/SerialNumber.java
@@ -33,7 +33,7 @@ public class SerialNumber {
*
* @mbggenerated
*/
- private Boolean isSell;
+ private String isSell;
/**
* This field was generated by MyBatis Generator.
@@ -49,7 +49,7 @@ public class SerialNumber {
*
* @mbggenerated
*/
- private Boolean deleteFlag;
+ private String deleteFlag;
/**
* This field was generated by MyBatis Generator.
@@ -82,6 +82,10 @@ public class SerialNumber {
* @mbggenerated
*/
private Long updater;
+ /**
+ * 单据主表id,用于跟踪序列号流向
+ * */
+ private Long depotheadId;
/**
* This method was generated by MyBatis Generator.
@@ -163,7 +167,7 @@ public class SerialNumber {
*
* @mbggenerated
*/
- public Boolean getIsSell() {
+ public String getIsSell() {
return isSell;
}
@@ -175,7 +179,7 @@ public class SerialNumber {
*
* @mbggenerated
*/
- public void setIsSell(Boolean isSell) {
+ public void setIsSell(String isSell) {
this.isSell = isSell;
}
@@ -211,7 +215,7 @@ public class SerialNumber {
*
* @mbggenerated
*/
- public Boolean getDeleteFlag() {
+ public String getDeleteFlag() {
return deleteFlag;
}
@@ -223,7 +227,7 @@ public class SerialNumber {
*
* @mbggenerated
*/
- public void setDeleteFlag(Boolean deleteFlag) {
+ public void setDeleteFlag(String deleteFlag) {
this.deleteFlag = deleteFlag;
}
@@ -322,4 +326,13 @@ public class SerialNumber {
public void setUpdater(Long updater) {
this.updater = updater;
}
+
+
+ public Long getDepotheadId() {
+ return depotheadId;
+ }
+
+ public void setDepotheadId(Long depotheadId) {
+ this.depotheadId = depotheadId;
+ }
}
\ No newline at end of file
diff --git a/src/main/java/com/jsh/erp/datasource/entities/SerialNumberExample.java b/src/main/java/com/jsh/erp/datasource/entities/SerialNumberExample.java
index 10abeed2..33006783 100644
--- a/src/main/java/com/jsh/erp/datasource/entities/SerialNumberExample.java
+++ b/src/main/java/com/jsh/erp/datasource/entities/SerialNumberExample.java
@@ -395,52 +395,61 @@ public class SerialNumberExample {
return (Criteria) this;
}
- public Criteria andIsSellEqualTo(Boolean value) {
+ public Criteria andIsSellEqualTo(String value) {
addCriterion("is_Sell =", value, "isSell");
return (Criteria) this;
}
- public Criteria andIsSellNotEqualTo(Boolean value) {
+ public Criteria andIsSellNotEqualTo(String value) {
addCriterion("is_Sell <>", value, "isSell");
return (Criteria) this;
}
- public Criteria andIsSellGreaterThan(Boolean value) {
+ public Criteria andIsSellGreaterThan(String value) {
addCriterion("is_Sell >", value, "isSell");
return (Criteria) this;
}
- public Criteria andIsSellGreaterThanOrEqualTo(Boolean value) {
+ public Criteria andIsSellGreaterThanOrEqualTo(String value) {
addCriterion("is_Sell >=", value, "isSell");
return (Criteria) this;
}
- public Criteria andIsSellLessThan(Boolean value) {
+ public Criteria andIsSellLessThan(String value) {
addCriterion("is_Sell <", value, "isSell");
return (Criteria) this;
}
- public Criteria andIsSellLessThanOrEqualTo(Boolean value) {
+ public Criteria andIsSellLessThanOrEqualTo(String value) {
addCriterion("is_Sell <=", value, "isSell");
return (Criteria) this;
}
- public Criteria andIsSellIn(List values) {
+ public Criteria andIsSellLike(String value) {
+ addCriterion("isSell like", value, "isSell");
+ return (Criteria) this;
+ }
+ public Criteria andIsSellNotLike(String value) {
+ addCriterion("isSell not like", value, "isSell");
+ return (Criteria) this;
+ }
+
+ public Criteria andIsSellIn(List values) {
addCriterion("is_Sell in", values, "isSell");
return (Criteria) this;
}
- public Criteria andIsSellNotIn(List values) {
+ public Criteria andIsSellNotIn(List values) {
addCriterion("is_Sell not in", values, "isSell");
return (Criteria) this;
}
- public Criteria andIsSellBetween(Boolean value1, Boolean value2) {
+ public Criteria andIsSellBetween(String value1, String value2) {
addCriterion("is_Sell between", value1, value2, "isSell");
return (Criteria) this;
}
- public Criteria andIsSellNotBetween(Boolean value1, Boolean value2) {
+ public Criteria andIsSellNotBetween(String value1, String value2) {
addCriterion("is_Sell not between", value1, value2, "isSell");
return (Criteria) this;
}
@@ -525,52 +534,59 @@ public class SerialNumberExample {
return (Criteria) this;
}
- public Criteria andDeleteFlagEqualTo(Boolean value) {
+ public Criteria andDeleteFlagEqualTo(String value) {
addCriterion("delete_Flag =", value, "deleteFlag");
return (Criteria) this;
}
- public Criteria andDeleteFlagNotEqualTo(Boolean value) {
+ public Criteria andDeleteFlagNotEqualTo(String value) {
addCriterion("delete_Flag <>", value, "deleteFlag");
return (Criteria) this;
}
- public Criteria andDeleteFlagGreaterThan(Boolean value) {
+ public Criteria andDeleteFlagGreaterThan(String value) {
addCriterion("delete_Flag >", value, "deleteFlag");
return (Criteria) this;
}
- public Criteria andDeleteFlagGreaterThanOrEqualTo(Boolean value) {
+ public Criteria andDeleteFlagGreaterThanOrEqualTo(String value) {
addCriterion("delete_Flag >=", value, "deleteFlag");
return (Criteria) this;
}
- public Criteria andDeleteFlagLessThan(Boolean value) {
+ public Criteria andDeleteFlagLessThan(String value) {
addCriterion("delete_Flag <", value, "deleteFlag");
return (Criteria) this;
}
- public Criteria andDeleteFlagLessThanOrEqualTo(Boolean value) {
+ public Criteria andDeleteFlagLessThanOrEqualTo(String value) {
addCriterion("delete_Flag <=", value, "deleteFlag");
return (Criteria) this;
}
-
- public Criteria andDeleteFlagIn(List values) {
+ public Criteria andDeleteFlagLike(String value) {
+ addCriterion("deleteFlag like", value, "deleteFlag");
+ return (Criteria) this;
+ }
+ public Criteria andDeleteFlagNotLike(String value) {
+ addCriterion("deleteFlag not like", value, "deleteFlag");
+ return (Criteria) this;
+ }
+ public Criteria andDeleteFlagIn(List values) {
addCriterion("delete_Flag in", values, "deleteFlag");
return (Criteria) this;
}
- public Criteria andDeleteFlagNotIn(List values) {
+ public Criteria andDeleteFlagNotIn(List values) {
addCriterion("delete_Flag not in", values, "deleteFlag");
return (Criteria) this;
}
- public Criteria andDeleteFlagBetween(Boolean value1, Boolean value2) {
+ public Criteria andDeleteFlagBetween(String value1, String value2) {
addCriterion("delete_Flag between", value1, value2, "deleteFlag");
return (Criteria) this;
}
- public Criteria andDeleteFlagNotBetween(Boolean value1, Boolean value2) {
+ public Criteria andDeleteFlagNotBetween(String value1, String value2) {
addCriterion("delete_Flag not between", value1, value2, "deleteFlag");
return (Criteria) this;
}
@@ -814,6 +830,68 @@ public class SerialNumberExample {
addCriterion("updater not between", value1, value2, "updater");
return (Criteria) this;
}
+ public Criteria andDepotheadIdIsNull() {
+ addCriterion("depotheadId is null");
+ return (Criteria) this;
+ }
+
+ public Criteria andDepotheadIdIsNotNull() {
+ addCriterion("depotheadId is not null");
+ return (Criteria) this;
+ }
+
+ public Criteria andDepotheadIdEqualTo(Long value) {
+ addCriterion("depotheadId =", value, "depotheadId");
+ return (Criteria) this;
+ }
+
+ public Criteria andDepotheadIdNotEqualTo(Long value) {
+ addCriterion("depotheadId <>", value, "depotheadId");
+ return (Criteria) this;
+ }
+
+ public Criteria andDepotheadIdGreaterThan(Long value) {
+ addCriterion("depotheadId >", value, "depotheadId");
+ return (Criteria) this;
+ }
+
+ public Criteria andDepotheadIdGreaterThanOrEqualTo(Long value) {
+ addCriterion("depotheadId >=", value, "depotheadId");
+ return (Criteria) this;
+ }
+
+ public Criteria andDepotheadIdLessThan(Long value) {
+ addCriterion("depotheadId <", value, "depotheadId");
+ return (Criteria) this;
+ }
+
+ public Criteria andDepotheadIdLessThanOrEqualTo(Long value) {
+ addCriterion("depotheadId <=", value, "depotheadId");
+ return (Criteria) this;
+ }
+
+ public Criteria andDepotheadIdIn(List values) {
+ addCriterion("depotheadId in", values, "depotheadId");
+ return (Criteria) this;
+ }
+
+ public Criteria andDepotheadIdNotIn(List values) {
+ addCriterion("depotheadId not in", values, "depotheadId");
+ return (Criteria) this;
+ }
+
+ public Criteria andDepotheadIdBetween(Long value1, Long value2) {
+ addCriterion("depotheadId between", value1, value2, "depotheadId");
+ return (Criteria) this;
+ }
+
+ public Criteria andDepotheadIdNotBetween(Long value1, Long value2) {
+ addCriterion("depotheadId not between", value1, value2, "depotheadId");
+ return (Criteria) this;
+ }
+
+
+
}
/**
diff --git a/src/main/java/com/jsh/erp/datasource/mappers/DepotHeadMapper.java b/src/main/java/com/jsh/erp/datasource/mappers/DepotHeadMapper.java
index 3d620fac..73f99835 100644
--- a/src/main/java/com/jsh/erp/datasource/mappers/DepotHeadMapper.java
+++ b/src/main/java/com/jsh/erp/datasource/mappers/DepotHeadMapper.java
@@ -101,87 +101,6 @@ public interface DepotHeadMapper {
*/
int updateByPrimaryKey(DepotHead record);
- List selectByConditionDepotHead(
- @Param("type") String type,
- @Param("subType") String subType,
- @Param("number") String number,
- @Param("beginTime") String beginTime,
- @Param("endTime") String endTime,
- @Param("dhIds") String dhIds,
- @Param("offset") Integer offset,
- @Param("rows") Integer rows);
- int countsByDepotHead(
- @Param("type") String type,
- @Param("subType") String subType,
- @Param("number") String number,
- @Param("beginTime") String beginTime,
- @Param("endTime") String endTime,
- @Param("dhIds") String dhIds);
-
- Long getMaxId();
-
- String findMaterialsListByHeaderId(
- @Param("id") Long id);
-
- List findByAll(
- @Param("beginTime") String beginTime,
- @Param("endTime") String endTime,
- @Param("type") String type,
- @Param("pid") Integer pid,
- @Param("dids") String dids,
- @Param("oId") Integer oId,
- @Param("offset") Integer offset,
- @Param("rows") Integer rows);
-
- int findByAllCount(
- @Param("beginTime") String beginTime,
- @Param("endTime") String endTime,
- @Param("type") String type,
- @Param("pid") Integer pid,
- @Param("dids") String dids,
- @Param("oId") Integer oId);
-
- List findInOutMaterialCount(
- @Param("beginTime") String beginTime,
- @Param("endTime") String endTime,
- @Param("type") String type,
- @Param("pid") Integer pid,
- @Param("dids") String dids,
- @Param("oId") Integer oId,
- @Param("offset") Integer offset,
- @Param("rows") Integer rows);
-
- int findInOutMaterialCountTotal(
- @Param("beginTime") String beginTime,
- @Param("endTime") String endTime,
- @Param("type") String type,
- @Param("pid") Integer pid,
- @Param("dids") String dids,
- @Param("oId") Integer oId);
-
- List findStatementAccount(
- @Param("beginTime") String beginTime,
- @Param("endTime") String endTime,
- @Param("organId") Integer organId,
- @Param("supType") String supType,
- @Param("offset") Integer offset,
- @Param("rows") Integer rows);
-
- int findStatementAccountCount(
- @Param("beginTime") String beginTime,
- @Param("endTime") String endTime,
- @Param("organId") Integer organId,
- @Param("supType") String supType);
-
- BigDecimal findAllMoney(
- @Param("supplierId") Integer supplierId,
- @Param("type") String type,
- @Param("subType") String subType,
- @Param("modeName") String modeName,
- @Param("endTime") String endTime);
-
- List getDetailByNumber(
- @Param("number") String number);
}
\ No newline at end of file
diff --git a/src/main/java/com/jsh/erp/datasource/mappers/DepotHeadMapperEx.java b/src/main/java/com/jsh/erp/datasource/mappers/DepotHeadMapperEx.java
new file mode 100644
index 00000000..4e5faaa1
--- /dev/null
+++ b/src/main/java/com/jsh/erp/datasource/mappers/DepotHeadMapperEx.java
@@ -0,0 +1,110 @@
+package com.jsh.erp.datasource.mappers;
+
+import com.jsh.erp.datasource.entities.DepotHead;
+import com.jsh.erp.datasource.vo.DepotHeadVo4InDetail;
+import com.jsh.erp.datasource.vo.DepotHeadVo4InOutMCount;
+import com.jsh.erp.datasource.vo.DepotHeadVo4List;
+import com.jsh.erp.datasource.vo.DepotHeadVo4StatementAccount;
+import org.apache.ibatis.annotations.Param;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+/**
+ * Description
+ *
+ * @Author: cjl
+ * @Date: 2019/1/25 14:50
+ */
+public interface DepotHeadMapperEx {
+ List selectByConditionDepotHead(
+ @Param("type") String type,
+ @Param("subType") String subType,
+ @Param("number") String number,
+ @Param("beginTime") String beginTime,
+ @Param("endTime") String endTime,
+ @Param("dhIds") String dhIds,
+ @Param("offset") Integer offset,
+ @Param("rows") Integer rows);
+
+ int countsByDepotHead(
+ @Param("type") String type,
+ @Param("subType") String subType,
+ @Param("number") String number,
+ @Param("beginTime") String beginTime,
+ @Param("endTime") String endTime,
+ @Param("dhIds") String dhIds);
+
+ Long getMaxId();
+
+ String findMaterialsListByHeaderId(
+ @Param("id") Long id);
+
+ List findByAll(
+ @Param("beginTime") String beginTime,
+ @Param("endTime") String endTime,
+ @Param("type") String type,
+ @Param("pid") Integer pid,
+ @Param("dids") String dids,
+ @Param("oId") Integer oId,
+ @Param("offset") Integer offset,
+ @Param("rows") Integer rows);
+
+ int findByAllCount(
+ @Param("beginTime") String beginTime,
+ @Param("endTime") String endTime,
+ @Param("type") String type,
+ @Param("pid") Integer pid,
+ @Param("dids") String dids,
+ @Param("oId") Integer oId);
+
+ List findInOutMaterialCount(
+ @Param("beginTime") String beginTime,
+ @Param("endTime") String endTime,
+ @Param("type") String type,
+ @Param("pid") Integer pid,
+ @Param("dids") String dids,
+ @Param("oId") Integer oId,
+ @Param("offset") Integer offset,
+ @Param("rows") Integer rows);
+
+ int findInOutMaterialCountTotal(
+ @Param("beginTime") String beginTime,
+ @Param("endTime") String endTime,
+ @Param("type") String type,
+ @Param("pid") Integer pid,
+ @Param("dids") String dids,
+ @Param("oId") Integer oId);
+
+ List findStatementAccount(
+ @Param("beginTime") String beginTime,
+ @Param("endTime") String endTime,
+ @Param("organId") Integer organId,
+ @Param("supType") String supType,
+ @Param("offset") Integer offset,
+ @Param("rows") Integer rows);
+
+ int findStatementAccountCount(
+ @Param("beginTime") String beginTime,
+ @Param("endTime") String endTime,
+ @Param("organId") Integer organId,
+ @Param("supType") String supType);
+
+ BigDecimal findAllMoney(
+ @Param("supplierId") Integer supplierId,
+ @Param("type") String type,
+ @Param("subType") String subType,
+ @Param("modeName") String modeName,
+ @Param("endTime") String endTime);
+
+ List getDetailByNumber(
+ @Param("number") String number);
+ /**
+ * 新增单据主表信息,并反显单据主表id
+ * */
+ int adddepotHead(DepotHead depotHead);
+ /**
+ * 更新单据主表信息
+ * */
+ void updatedepotHead(DepotHead depotHead);
+}
diff --git a/src/main/java/com/jsh/erp/datasource/mappers/DepotItemMapper.java b/src/main/java/com/jsh/erp/datasource/mappers/DepotItemMapper.java
index 1ff4939f..484f0293 100644
--- a/src/main/java/com/jsh/erp/datasource/mappers/DepotItemMapper.java
+++ b/src/main/java/com/jsh/erp/datasource/mappers/DepotItemMapper.java
@@ -96,123 +96,6 @@ public interface DepotItemMapper {
*/
int updateByPrimaryKey(DepotItem record);
- List selectByConditionDepotItem(
- @Param("name") String name,
- @Param("type") Integer type,
- @Param("remark") String remark,
- @Param("offset") Integer offset,
- @Param("rows") Integer rows);
- int countsByDepotItem(
- @Param("name") String name,
- @Param("type") Integer type,
- @Param("remark") String remark);
-
- List getHeaderIdByMaterial(
- @Param("materialParam") String materialParam,
- @Param("depotIds") String depotIds);
-
- List findDetailByTypeAndMaterialIdList(
- @Param("mId") Long mId,
- @Param("offset") Integer offset,
- @Param("rows") Integer rows);
-
- int findDetailByTypeAndMaterialIdCounts(
- @Param("mId") Long mId);
-
- List findStockNumByMaterialIdList(
- @Param("mId") Long mId,
- @Param("monthTime") String monthTime,
- @Param("offset") Integer offset,
- @Param("rows") Integer rows);
-
- int findStockNumByMaterialIdCounts(
- @Param("mId") Long mId,
- @Param("monthTime") String monthTime);
-
- int findByTypeAndMaterialIdIn(
- @Param("mId") Long mId);
-
- int findByTypeAndMaterialIdOut(
- @Param("mId") Long mId);
-
- List getDetailList(
- @Param("headerId") Long headerId);
-
- List findByAll(
- @Param("headIds") String headIds,
- @Param("materialIds") String materialIds,
- @Param("offset") Integer offset,
- @Param("rows") Integer rows);
-
- int findByAllCount(
- @Param("headIds") String headIds,
- @Param("materialIds") String materialIds);
-
- BigDecimal findByTypeInIsPrev(
- @Param("ProjectId") Integer ProjectId,
- @Param("MId") Long MId,
- @Param("MonthTime") String MonthTime);
-
- BigDecimal findByTypeInIsNotPrev(
- @Param("ProjectId") Integer ProjectId,
- @Param("MId") Long MId,
- @Param("MonthTime") String MonthTime);
-
- BigDecimal findByTypeOutIsPrev(
- @Param("ProjectId") Integer ProjectId,
- @Param("MId") Long MId,
- @Param("MonthTime") String MonthTime);
-
- BigDecimal findByTypeOutIsNotPrev(
- @Param("ProjectId") Integer ProjectId,
- @Param("MId") Long MId,
- @Param("MonthTime") String MonthTime);
-
-
-
- BigDecimal findPriceByTypeInIsPrev(
- @Param("ProjectId") Integer ProjectId,
- @Param("MId") Long MId,
- @Param("MonthTime") String MonthTime);
-
- BigDecimal findPriceByTypeInIsNotPrev(
- @Param("ProjectId") Integer ProjectId,
- @Param("MId") Long MId,
- @Param("MonthTime") String MonthTime);
-
- BigDecimal findPriceByTypeOutIsPrev(
- @Param("ProjectId") Integer ProjectId,
- @Param("MId") Long MId,
- @Param("MonthTime") String MonthTime);
-
- BigDecimal findPriceByTypeOutIsNotPrev(
- @Param("ProjectId") Integer ProjectId,
- @Param("MId") Long MId,
- @Param("MonthTime") String MonthTime);
-
- BigDecimal buyOrSaleNumber(
- @Param("type") String type,
- @Param("subType") String subType,
- @Param("MId") Long MId,
- @Param("MonthTime") String MonthTime,
- @Param("sumType") String sumType);
-
- BigDecimal buyOrSalePrice(
- @Param("type") String type,
- @Param("subType") String subType,
- @Param("MId") Long MId,
- @Param("MonthTime") String MonthTime,
- @Param("sumType") String sumType);
-
- BigDecimal findGiftByTypeIn(
- @Param("subType") String subType,
- @Param("ProjectId") Integer ProjectId,
- @Param("MId") Long MId);
-
- BigDecimal findGiftByTypeOut(
- @Param("subType") String subType,
- @Param("ProjectId") Integer ProjectId,
- @Param("MId") Long MId);
}
\ No newline at end of file
diff --git a/src/main/java/com/jsh/erp/datasource/mappers/DepotItemMapperEx.java b/src/main/java/com/jsh/erp/datasource/mappers/DepotItemMapperEx.java
new file mode 100644
index 00000000..4c71049d
--- /dev/null
+++ b/src/main/java/com/jsh/erp/datasource/mappers/DepotItemMapperEx.java
@@ -0,0 +1,148 @@
+package com.jsh.erp.datasource.mappers;
+
+import com.jsh.erp.datasource.entities.*;
+import org.apache.ibatis.annotations.Param;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+/**
+ * Description
+ *
+ * @Author: cjl
+ * @Date: 2019/1/24 16:59
+ */
+public interface DepotItemMapperEx {
+ List selectByConditionDepotItem(
+ @Param("name") String name,
+ @Param("type") Integer type,
+ @Param("remark") String remark,
+ @Param("offset") Integer offset,
+ @Param("rows") Integer rows);
+
+ int countsByDepotItem(
+ @Param("name") String name,
+ @Param("type") Integer type,
+ @Param("remark") String remark);
+
+ List getHeaderIdByMaterial(
+ @Param("materialParam") String materialParam,
+ @Param("depotIds") String depotIds);
+
+ List findDetailByTypeAndMaterialIdList(
+ @Param("mId") Long mId,
+ @Param("offset") Integer offset,
+ @Param("rows") Integer rows);
+
+ int findDetailByTypeAndMaterialIdCounts(
+ @Param("mId") Long mId);
+
+ List findStockNumByMaterialIdList(
+ @Param("mId") Long mId,
+ @Param("monthTime") String monthTime,
+ @Param("offset") Integer offset,
+ @Param("rows") Integer rows);
+
+ int findStockNumByMaterialIdCounts(
+ @Param("mId") Long mId,
+ @Param("monthTime") String monthTime);
+
+ int findByTypeAndMaterialIdIn(
+ @Param("mId") Long mId);
+
+ int findByTypeAndMaterialIdOut(
+ @Param("mId") Long mId);
+
+ List getDetailList(
+ @Param("headerId") Long headerId);
+
+ List findByAll(
+ @Param("headIds") String headIds,
+ @Param("materialIds") String materialIds,
+ @Param("offset") Integer offset,
+ @Param("rows") Integer rows);
+
+ int findByAllCount(
+ @Param("headIds") String headIds,
+ @Param("materialIds") String materialIds);
+
+ BigDecimal findByTypeInIsPrev(
+ @Param("ProjectId") Integer ProjectId,
+ @Param("MId") Long MId,
+ @Param("MonthTime") String MonthTime);
+
+ BigDecimal findByTypeInIsNotPrev(
+ @Param("ProjectId") Integer ProjectId,
+ @Param("MId") Long MId,
+ @Param("MonthTime") String MonthTime);
+
+ BigDecimal findByTypeOutIsPrev(
+ @Param("ProjectId") Integer ProjectId,
+ @Param("MId") Long MId,
+ @Param("MonthTime") String MonthTime);
+
+ BigDecimal findByTypeOutIsNotPrev(
+ @Param("ProjectId") Integer ProjectId,
+ @Param("MId") Long MId,
+ @Param("MonthTime") String MonthTime);
+
+
+
+ BigDecimal findPriceByTypeInIsPrev(
+ @Param("ProjectId") Integer ProjectId,
+ @Param("MId") Long MId,
+ @Param("MonthTime") String MonthTime);
+
+ BigDecimal findPriceByTypeInIsNotPrev(
+ @Param("ProjectId") Integer ProjectId,
+ @Param("MId") Long MId,
+ @Param("MonthTime") String MonthTime);
+
+ BigDecimal findPriceByTypeOutIsPrev(
+ @Param("ProjectId") Integer ProjectId,
+ @Param("MId") Long MId,
+ @Param("MonthTime") String MonthTime);
+
+ BigDecimal findPriceByTypeOutIsNotPrev(
+ @Param("ProjectId") Integer ProjectId,
+ @Param("MId") Long MId,
+ @Param("MonthTime") String MonthTime);
+
+ BigDecimal buyOrSaleNumber(
+ @Param("type") String type,
+ @Param("subType") String subType,
+ @Param("MId") Long MId,
+ @Param("MonthTime") String MonthTime,
+ @Param("sumType") String sumType);
+
+ BigDecimal buyOrSalePrice(
+ @Param("type") String type,
+ @Param("subType") String subType,
+ @Param("MId") Long MId,
+ @Param("MonthTime") String MonthTime,
+ @Param("sumType") String sumType);
+
+ BigDecimal findGiftByTypeIn(
+ @Param("subType") String subType,
+ @Param("ProjectId") Integer ProjectId,
+ @Param("MId") Long MId);
+
+ BigDecimal findGiftByTypeOut(
+ @Param("subType") String subType,
+ @Param("ProjectId") Integer ProjectId,
+ @Param("MId") Long MId);
+ /**
+ * create by: cjl
+ * description:
+ * 通过单据主表id查询所有单据子表数据
+ * create time: 2019/1/24 16:56
+ * @Param: depotheadId
+ * @return java.util.List
+ */
+ List findDepotItemListBydepotheadId(@Param("depotheadId")Long depotheadId,
+ @Param("enableSerialNumber")String enableSerialNumber);
+ /**
+ * 根据单据主表id删除单据子表数据
+ * */
+ int deleteDepotItemByDepotHeadIds(@Param("depotheadIds")Long []depotHeadIds);
+}
diff --git a/src/main/java/com/jsh/erp/datasource/mappers/SerialNumberMapperEx.java b/src/main/java/com/jsh/erp/datasource/mappers/SerialNumberMapperEx.java
index b8b4276d..d45532a4 100644
--- a/src/main/java/com/jsh/erp/datasource/mappers/SerialNumberMapperEx.java
+++ b/src/main/java/com/jsh/erp/datasource/mappers/SerialNumberMapperEx.java
@@ -1,9 +1,9 @@
package com.jsh.erp.datasource.mappers;
-import com.jsh.erp.datasource.entities.SerialNumber;
import com.jsh.erp.datasource.entities.SerialNumberEx;
import org.apache.ibatis.annotations.Param;
+import java.util.Date;
import java.util.List;
/**
@@ -42,4 +42,22 @@ public interface SerialNumberMapperEx {
* 未删除为卖出的视为有效
* */
int findSerialNumberByMaterialId(@Param("materialId") Long materialId);
+ /**
+ * 查询符合条件的序列号数量
+ * */
+ int countSerialNumberByMaterialIdAndDepotheadId(@Param("materialId")Long materialId, @Param("depotheadId")Long depotheadId, @Param("isSell")String isSell);
+ /**
+ * 卖出: update jsh_serial_number set is_Sell='1' ,depothead_Id='depotheadId' where 1=1 and material_Id='materialId'
+ * and is_Sell !='1' and delete_Flag !='1' {limit 0,count}
+ * */
+ int sellSerialNumber(@Param("materialId")Long materialId, @Param("depotheadId")Long depotheadId,@Param("count")Integer count, @Param("updateTime") Date updateTime,@Param("updater") Long updater);
+ /**
+ * 赎回:update jsh_serial_number set is_Sell='0' where 1=1 and material_Id='materialId'
+ * and depothead_Id='depotheadId' and is_Sell !='0' and delete_Flag !='1' {limit 0,count}
+ * */
+ int cancelSerialNumber(@Param("materialId")Long materialId, @Param("depotheadId")Long depotheadId, @Param("count")Integer count, @Param("updateTime") Date updateTime,@Param("updater") Long updater);
+ /**
+ * 批量添加序列号
+ * */
+ int batAddSerialNumber(@Param("list") List list);
}
diff --git a/src/main/java/com/jsh/erp/service/depotHead/DepotHeadService.java b/src/main/java/com/jsh/erp/service/depotHead/DepotHeadService.java
index 2c951165..d282c4bb 100644
--- a/src/main/java/com/jsh/erp/service/depotHead/DepotHeadService.java
+++ b/src/main/java/com/jsh/erp/service/depotHead/DepotHeadService.java
@@ -2,14 +2,22 @@ package com.jsh.erp.service.depotHead;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
+import com.jsh.erp.constants.BusinessConstants;
import com.jsh.erp.datasource.entities.DepotHead;
import com.jsh.erp.datasource.entities.DepotHeadExample;
+import com.jsh.erp.datasource.entities.DepotItem;
import com.jsh.erp.datasource.entities.User;
import com.jsh.erp.datasource.mappers.DepotHeadMapper;
+import com.jsh.erp.datasource.mappers.DepotHeadMapperEx;
+import com.jsh.erp.datasource.mappers.DepotItemMapperEx;
import com.jsh.erp.datasource.vo.DepotHeadVo4InDetail;
import com.jsh.erp.datasource.vo.DepotHeadVo4InOutMCount;
import com.jsh.erp.datasource.vo.DepotHeadVo4List;
import com.jsh.erp.datasource.vo.DepotHeadVo4StatementAccount;
+import com.jsh.erp.service.depotItem.DepotItemService;
+import com.jsh.erp.service.serialNumber.SerialNumberService;
+import com.jsh.erp.service.supplier.SupplierService;
+import com.jsh.erp.service.user.UserService;
import com.jsh.erp.utils.StringUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -33,6 +41,19 @@ public class DepotHeadService {
@Resource
private DepotHeadMapper depotHeadMapper;
+ @Resource
+ private DepotHeadMapperEx depotHeadMapperEx;
+ @Resource
+ private UserService userService;
+ @Resource
+ DepotItemService depotItemService;
+ @Resource
+ private SupplierService supplierService;
+ @Resource
+ private SerialNumberService serialNumberService;
+ @Resource
+ DepotItemMapperEx depotItemMapperEx;
+
public DepotHead getDepotHead(long id) {
return depotHeadMapper.selectByPrimaryKey(id);
@@ -45,7 +66,7 @@ public class DepotHeadService {
public List select(String type, String subType, String number, String beginTime, String endTime, String dhIds, int offset, int rows) {
List resList = new ArrayList();
- List list = depotHeadMapper.selectByConditionDepotHead(type, subType, number, beginTime, endTime, dhIds, offset, rows);
+ List list = depotHeadMapperEx.selectByConditionDepotHead(type, subType, number, beginTime, endTime, dhIds, offset, rows);
if (null != list) {
for (DepotHeadVo4List dh : list) {
if(dh.getOthermoneylist() != null) {
@@ -73,7 +94,7 @@ public class DepotHeadService {
public int countDepotHead(String type, String subType, String number, String beginTime, String endTime, String dhIds) {
- return depotHeadMapper.countsByDepotHead(type, subType, number, beginTime, endTime, dhIds);
+ return depotHeadMapperEx.countsByDepotHead(type, subType, number, beginTime, endTime, dhIds);
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
@@ -169,11 +190,11 @@ public class DepotHeadService {
}
public Long getMaxId() {
- return depotHeadMapper.getMaxId();
+ return depotHeadMapperEx.getMaxId();
}
public String findMaterialsListByHeaderId(Long id) {
- String allReturn = depotHeadMapper.findMaterialsListByHeaderId(id);
+ String allReturn = depotHeadMapperEx.findMaterialsListByHeaderId(id);
return allReturn;
}
@@ -194,27 +215,27 @@ public class DepotHeadService {
}
public List findByAll(String beginTime, String endTime, String type, Integer pid, String dids, Integer oId, Integer offset, Integer rows) {
- return depotHeadMapper.findByAll(beginTime, endTime, type, pid, dids, oId, offset, rows);
+ return depotHeadMapperEx.findByAll(beginTime, endTime, type, pid, dids, oId, offset, rows);
}
public int findByAllCount(String beginTime, String endTime, String type, Integer pid, String dids, Integer oId) {
- return depotHeadMapper.findByAllCount(beginTime, endTime, type, pid, dids, oId);
+ return depotHeadMapperEx.findByAllCount(beginTime, endTime, type, pid, dids, oId);
}
public List findInOutMaterialCount(String beginTime, String endTime, String type, Integer pid, String dids, Integer oId, Integer offset, Integer rows) {
- return depotHeadMapper.findInOutMaterialCount(beginTime, endTime, type, pid, dids, oId, offset, rows);
+ return depotHeadMapperEx.findInOutMaterialCount(beginTime, endTime, type, pid, dids, oId, offset, rows);
}
public int findInOutMaterialCountTotal(String beginTime, String endTime, String type, Integer pid, String dids, Integer oId) {
- return depotHeadMapper.findInOutMaterialCountTotal(beginTime, endTime, type, pid, dids, oId);
+ return depotHeadMapperEx.findInOutMaterialCountTotal(beginTime, endTime, type, pid, dids, oId);
}
public List findStatementAccount(String beginTime, String endTime, Integer organId, String supType, Integer offset, Integer rows) {
- return depotHeadMapper.findStatementAccount(beginTime, endTime, organId, supType, offset, rows);
+ return depotHeadMapperEx.findStatementAccount(beginTime, endTime, organId, supType, offset, rows);
}
public int findStatementAccountCount(String beginTime, String endTime, Integer organId, String supType) {
- return depotHeadMapper.findStatementAccountCount(beginTime, endTime, organId, supType);
+ return depotHeadMapperEx.findStatementAccountCount(beginTime, endTime, organId, supType);
}
public BigDecimal findAllMoney(Integer supplierId, String type, String subType, String mode, String endTime) {
@@ -224,12 +245,12 @@ public class DepotHeadService {
} else if (mode.equals("合计")) {
modeName = "DiscountLastMoney";
}
- return depotHeadMapper.findAllMoney(supplierId, type, subType, modeName, endTime);
+ return depotHeadMapperEx.findAllMoney(supplierId, type, subType, modeName, endTime);
}
public List getDetailByNumber(String number) {
List resList = new ArrayList();
- List list = depotHeadMapper.getDetailByNumber(number);
+ List list = depotHeadMapperEx.getDetailByNumber(number);
if (null != list) {
for (DepotHeadVo4List dh : list) {
if(dh.getOthermoneylist() != null) {
@@ -254,4 +275,115 @@ public class DepotHeadService {
return resList;
}
+ /**
+ * create by: cjl
+ * description:
+ * 新增单据主表及单据子表信息
+ * create time: 2019/1/25 14:36
+ * @Param: beanJson
+ * @Param: inserted
+ * @Param: deleted
+ * @Param: updated
+ * @return java.lang.String
+ */
+ @Transactional(value = "transactionManager", rollbackFor = Exception.class)
+ public void addDepotHeadAndDetail(String beanJson, String inserted, String deleted, String updated) throws Exception {
+ /**处理单据主表数据*/
+ DepotHead depotHead = JSONObject.parseObject(beanJson, DepotHead.class);
+ //判断用户是否已经登录过,登录过不再处理
+ User userInfo=userService.getCurrentUser();
+ depotHead.setOperpersonname(userInfo==null?null:userInfo.getUsername());
+ depotHead.setCreatetime(new Timestamp(System.currentTimeMillis()));
+ depotHead.setStatus(false);
+ depotHeadMapperEx.adddepotHead(depotHead);
+
+ /**入库和出库处理预付款信息*/
+ if(BusinessConstants.PAY_TYPE_PREPAID.equals(depotHead.getPaytype())){
+ if(depotHead.getOrganid()!=null) {
+ supplierService.updateAdvanceIn(depotHead.getOrganid(), BigDecimal.ZERO.subtract(depotHead.getTotalprice()));
+ }
+ }
+ /**入库和出库处理单据子表信息*/
+ depotItemService.saveDetials(inserted,deleted,updated,depotHead.getId());
+ }
+ /**
+ * create by: cjl
+ * description:
+ * 更新单据主表及单据子表信息
+ * create time: 2019/1/28 14:47
+ * @Param: id
+ * @Param: beanJson
+ * @Param: inserted
+ * @Param: deleted
+ * @Param: updated
+ * @Param: preTotalPrice
+ * @return java.lang.Object
+ */
+ @Transactional(value = "transactionManager", rollbackFor = Exception.class)
+ public void updateDepotHeadAndDetail(Long id, String beanJson, String inserted, String deleted, String updated, BigDecimal preTotalPrice)throws Exception {
+ /**更新单据主表信息*/
+ DepotHead depotHead = JSONObject.parseObject(beanJson, DepotHead.class);
+ //判断用户是否已经登录过,登录过不再处理
+ depotHead.setId(id);
+ User userInfo=userService.getCurrentUser();
+ depotHead.setOperpersonname(userInfo==null?null:userInfo.getUsername());
+ depotHead.setOpertime(new Timestamp(System.currentTimeMillis()));
+ depotHeadMapperEx.updatedepotHead(depotHead);
+ /**入库和出库处理预付款信息*/
+ if(BusinessConstants.PAY_TYPE_PREPAID.equals(depotHead.getPaytype())){
+ if(depotHead.getOrganid()!=null){
+ supplierService.updateAdvanceIn(depotHead.getOrganid(), BigDecimal.ZERO.subtract(depotHead.getTotalprice().subtract(preTotalPrice)));
+ }
+ }
+ /**入库和出库处理单据子表信息*/
+ depotItemService.saveDetials(inserted,deleted,updated,depotHead.getId());
+ }
+
+ /**
+ * create by: cjl
+ * description:
+ * 删除单据主表及子表信息
+ * create time: 2019/1/28 17:29
+ * @Param: id
+ * @return java.lang.Object
+ */
+ @Transactional(value = "transactionManager", rollbackFor = Exception.class)
+ public void deleteDepotHeadAndDetail(Long id) throws Exception {
+ //查询单据主表信息
+ DepotHead depotHead =getDepotHead(id);
+ User userInfo=userService.getCurrentUser();
+ //删除出库数据回收序列号
+ if(BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())
+ &&!BusinessConstants.SUB_TYPE_TRANSFER.equals(depotHead.getSubtype())){
+ //查询单据子表列表
+ List depotItemList = depotItemMapperEx.findDepotItemListBydepotheadId(id,BusinessConstants.ENABLE_SERIAL_NUMBER_ENABLED);
+ /**回收序列号*/
+ if(depotItemList!=null&&depotItemList.size()>0){
+ for(DepotItem depotItem:depotItemList){
+ serialNumberService.cancelSerialNumber(depotItem.getMaterialid(), depotItem.getHeaderid(),depotItem.getOpernumber().intValue(),userInfo);
+ }
+ }
+ }
+ /**删除单据子表数据*/
+ depotItemMapperEx.deleteDepotItemByDepotHeadIds(new Long []{id});
+ /**删除单据主表信息*/
+ deleteDepotHead(id);
+ }
+ /**
+ * create by: cjl
+ * description:
+ * 批量删除单据主表及子表信息
+ * create time: 2019/1/28 17:29
+ * @Param: id
+ * @return java.lang.Object
+ */
+ @Transactional(value = "transactionManager", rollbackFor = Exception.class)
+ public void batchDeleteDepotHeadAndDetail(String ids) throws Exception{
+ if(StringUtil.isNotEmpty(ids)){
+ String [] headIds=ids.split(",");
+ for(int i=0;i select(String name, Integer type, String remark, int offset, int rows) {
- return depotItemMapper.selectByConditionDepotItem(name, type, remark, offset, rows);
+ return depotItemMapperEx.selectByConditionDepotItem(name, type, remark, offset, rows);
}
public int countDepotItem(String name, Integer type, String remark) {
- return depotItemMapper.countsByDepotItem(name, type, remark);
+ return depotItemMapperEx.countsByDepotItem(name, type, remark);
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
@@ -87,7 +104,7 @@ public class DepotItemService {
}
public List getHeaderIdByMaterial(String materialParam, String depotIds) {
- return depotItemMapper.getHeaderIdByMaterial(materialParam, depotIds);
+ return depotItemMapperEx.getHeaderIdByMaterial(materialParam, depotIds);
}
public List findDetailByTypeAndMaterialIdList(Map map) {
@@ -96,7 +113,7 @@ public class DepotItemService {
if(!StringUtil.isEmpty(mIdStr)) {
mId = Long.parseLong(mIdStr);
}
- return depotItemMapper.findDetailByTypeAndMaterialIdList(mId, QueryUtils.offset(map), QueryUtils.rows(map));
+ return depotItemMapperEx.findDetailByTypeAndMaterialIdList(mId, QueryUtils.offset(map), QueryUtils.rows(map));
}
public int findDetailByTypeAndMaterialIdCounts(Map map) {
@@ -105,7 +122,7 @@ public class DepotItemService {
if(!StringUtil.isEmpty(mIdStr)) {
mId = Long.parseLong(mIdStr);
}
- return depotItemMapper.findDetailByTypeAndMaterialIdCounts(mId);
+ return depotItemMapperEx.findDetailByTypeAndMaterialIdCounts(mId);
}
public List findStockNumByMaterialIdList(Map map) {
@@ -115,7 +132,7 @@ public class DepotItemService {
mId = Long.parseLong(mIdStr);
}
String monthTime = map.get("monthTime");
- return depotItemMapper.findStockNumByMaterialIdList(mId, monthTime, QueryUtils.offset(map), QueryUtils.rows(map));
+ return depotItemMapperEx.findStockNumByMaterialIdList(mId, monthTime, QueryUtils.offset(map), QueryUtils.rows(map));
}
public int findStockNumByMaterialIdCounts(Map map) {
@@ -125,7 +142,7 @@ public class DepotItemService {
mId = Long.parseLong(mIdStr);
}
String monthTime = map.get("monthTime");
- return depotItemMapper.findStockNumByMaterialIdCounts(mId, monthTime);
+ return depotItemMapperEx.findStockNumByMaterialIdCounts(mId, monthTime);
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
@@ -140,36 +157,36 @@ public class DepotItemService {
public int findByTypeAndMaterialId(String type, Long mId) {
if(type.equals(TYPE)) {
- return depotItemMapper.findByTypeAndMaterialIdIn(mId);
+ return depotItemMapperEx.findByTypeAndMaterialIdIn(mId);
} else {
- return depotItemMapper.findByTypeAndMaterialIdOut(mId);
+ return depotItemMapperEx.findByTypeAndMaterialIdOut(mId);
}
}
public List getDetailList(Long headerId) {
- return depotItemMapper.getDetailList(headerId);
+ return depotItemMapperEx.getDetailList(headerId);
}
public List findByAll(String headIds, String materialIds, Integer offset, Integer rows) {
- return depotItemMapper.findByAll(headIds, materialIds, offset, rows);
+ return depotItemMapperEx.findByAll(headIds, materialIds, offset, rows);
}
public int findByAllCount(String headIds, String materialIds) {
- return depotItemMapper.findByAllCount(headIds, materialIds);
+ return depotItemMapperEx.findByAllCount(headIds, materialIds);
}
public BigDecimal findByType(String type, Integer ProjectId, Long MId, String MonthTime, Boolean isPrev) {
if (TYPE.equals(type)) {
if (isPrev) {
- return depotItemMapper.findByTypeInIsPrev(ProjectId, MId, MonthTime);
+ return depotItemMapperEx.findByTypeInIsPrev(ProjectId, MId, MonthTime);
} else {
- return depotItemMapper.findByTypeInIsNotPrev(ProjectId, MId, MonthTime);
+ return depotItemMapperEx.findByTypeInIsNotPrev(ProjectId, MId, MonthTime);
}
} else {
if (isPrev) {
- return depotItemMapper.findByTypeOutIsPrev(ProjectId, MId, MonthTime);
+ return depotItemMapperEx.findByTypeOutIsPrev(ProjectId, MId, MonthTime);
} else {
- return depotItemMapper.findByTypeOutIsNotPrev(ProjectId, MId, MonthTime);
+ return depotItemMapperEx.findByTypeOutIsNotPrev(ProjectId, MId, MonthTime);
}
}
}
@@ -177,41 +194,64 @@ public class DepotItemService {
public BigDecimal findPriceByType(String type, Integer ProjectId, Long MId, String MonthTime, Boolean isPrev) {
if (TYPE.equals(type)) {
if (isPrev) {
- return depotItemMapper.findPriceByTypeInIsPrev(ProjectId, MId, MonthTime);
+ return depotItemMapperEx.findPriceByTypeInIsPrev(ProjectId, MId, MonthTime);
} else {
- return depotItemMapper.findPriceByTypeInIsNotPrev(ProjectId, MId, MonthTime);
+ return depotItemMapperEx.findPriceByTypeInIsNotPrev(ProjectId, MId, MonthTime);
}
} else {
if (isPrev) {
- return depotItemMapper.findPriceByTypeOutIsPrev(ProjectId, MId, MonthTime);
+ return depotItemMapperEx.findPriceByTypeOutIsPrev(ProjectId, MId, MonthTime);
} else {
- return depotItemMapper.findPriceByTypeOutIsNotPrev(ProjectId, MId, MonthTime);
+ return depotItemMapperEx.findPriceByTypeOutIsNotPrev(ProjectId, MId, MonthTime);
}
}
}
public BigDecimal buyOrSale(String type, String subType, Long MId, String MonthTime, String sumType) {
if (SUM_TYPE.equals(sumType)) {
- return depotItemMapper.buyOrSaleNumber(type, subType, MId, MonthTime, sumType);
+ return depotItemMapperEx.buyOrSaleNumber(type, subType, MId, MonthTime, sumType);
} else {
- return depotItemMapper.buyOrSalePrice(type, subType, MId, MonthTime, sumType);
+ return depotItemMapperEx.buyOrSalePrice(type, subType, MId, MonthTime, sumType);
}
}
public BigDecimal findGiftByType(String subType, Integer ProjectId, Long MId, String type) {
if (IN.equals(type)) {
- return depotItemMapper.findGiftByTypeIn(subType, ProjectId, MId);
+ return depotItemMapperEx.findGiftByTypeIn(subType, ProjectId, MId);
} else {
- return depotItemMapper.findGiftByTypeOut(subType, ProjectId, MId);
+ return depotItemMapperEx.findGiftByTypeOut(subType, ProjectId, MId);
}
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
- public String saveDetials(String inserted, String deleted, String updated, Long headerId) throws DataAccessException{
- //转为json
+ public String saveDetials(String inserted, String deleted, String updated, Long headerId) throws Exception{
+ //查询单据主表信息
+ DepotHead depotHead=depotHeadMapper.selectByPrimaryKey(headerId);
+ //获得当前操作人
+ User userInfo=userService.getCurrentUser();
+ //转为json
JSONArray insertedJson = JSONArray.parseArray(inserted);
JSONArray deletedJson = JSONArray.parseArray(deleted);
JSONArray updatedJson = JSONArray.parseArray(updated);
+ /**
+ * 2019-01-28优先处理删除的
+ * 删除的可以继续卖,删除的需要将使用的序列号回收
+ * 插入的需要判断当前货源是否充足
+ * 更新的需要判断货源是否充足
+ * */
+ if (null != deletedJson) {
+ for (int i = 0; i < deletedJson.size(); i++) {
+ //首先回收序列号,如果是调拨,不用处理序列号
+ JSONObject tempDeletedJson = JSONObject.parseObject(deletedJson.getString(i));
+ if(BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())
+ &&!BusinessConstants.SUB_TYPE_TRANSFER.equals(depotHead.getSubtype())){
+ DepotItem depotItem = getDepotItem(tempDeletedJson.getLong("Id"));
+ serialNumberMapperEx.cancelSerialNumber(depotItem.getMaterialid(),depotItem.getHeaderid(),depotItem.getOpernumber().intValue(),
+ new Date(),userInfo==null?null:userInfo.getId());
+ }
+ this.deleteDepotItem(tempDeletedJson.getLong("Id"));
+ }
+ }
if (null != insertedJson) {
for (int i = 0; i < insertedJson.size(); i++) {
DepotItem depotItem = new DepotItem();
@@ -289,18 +329,25 @@ public class DepotItemService {
depotItem.setMtype(tempInsertedJson.getString("MType"));
}
this.insertDepotItemWithObj(depotItem);
+ /**出库时处理序列号*/
+ if(BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())
+ &&!BusinessConstants.SUB_TYPE_TRANSFER.equals(depotHead.getSubtype())){
+ //查询单据子表中开启序列号的数据列表
+ serialNumberService.checkAndUpdateSerialNumber(depotItem,userInfo);
+ }
}
}
- if (null != deletedJson) {
- for (int i = 0; i < deletedJson.size(); i++) {
- JSONObject tempDeletedJson = JSONObject.parseObject(deletedJson.getString(i));
- this.deleteDepotItem(tempDeletedJson.getLong("Id"));
- }
- }
+
if (null != updatedJson) {
for (int i = 0; i < updatedJson.size(); i++) {
JSONObject tempUpdatedJson = JSONObject.parseObject(updatedJson.getString(i));
DepotItem depotItem = this.getDepotItem(tempUpdatedJson.getLong("Id"));
+ //首先回收序列号
+ if(BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())
+ &&!BusinessConstants.SUB_TYPE_TRANSFER.equals(depotHead.getSubtype())) {
+ serialNumberMapperEx.cancelSerialNumber(depotItem.getMaterialid(), depotItem.getHeaderid(), depotItem.getOpernumber().intValue(),
+ new Date(),userInfo==null?null:userInfo.getId());
+ }
depotItem.setId(tempUpdatedJson.getLong("Id"));
depotItem.setMaterialid(tempUpdatedJson.getLong("MaterialId"));
depotItem.setMunit(tempUpdatedJson.getString("Unit"));
@@ -362,6 +409,12 @@ public class DepotItemService {
depotItem.setOtherfield5(tempUpdatedJson.getString("OtherField5"));
depotItem.setMtype(tempUpdatedJson.getString("MType"));
this.updateDepotItemWithObj(depotItem);
+ /**出库时处理序列号*/
+ if(BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())
+ &&!BusinessConstants.SUB_TYPE_TRANSFER.equals(depotHead.getSubtype())){
+ //查询单据子表中开启序列号的数据列表
+ serialNumberService.checkAndUpdateSerialNumber(depotItem,userInfo);
+ }
}
}
return null;
@@ -386,4 +439,5 @@ public class DepotItemService {
}
return unitName;
}
+
}
diff --git a/src/main/java/com/jsh/erp/service/serialNumber/SerialNumberService.java b/src/main/java/com/jsh/erp/service/serialNumber/SerialNumberService.java
index ec2a2e0b..3285eb1a 100644
--- a/src/main/java/com/jsh/erp/service/serialNumber/SerialNumberService.java
+++ b/src/main/java/com/jsh/erp/service/serialNumber/SerialNumberService.java
@@ -4,9 +4,7 @@ import com.alibaba.fastjson.JSONObject;
import com.jsh.erp.constants.BusinessConstants;
import com.jsh.erp.constants.ExceptionConstants;
import com.jsh.erp.datasource.entities.*;
-import com.jsh.erp.datasource.mappers.MaterialMapperEx;
-import com.jsh.erp.datasource.mappers.SerialNumberMapper;
-import com.jsh.erp.datasource.mappers.SerialNumberMapperEx;
+import com.jsh.erp.datasource.mappers.*;
import com.jsh.erp.exception.BusinessRunTimeException;
import com.jsh.erp.service.depotItem.DepotItemService;
import com.jsh.erp.service.material.MaterialService;
@@ -19,6 +17,7 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
+import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@@ -39,9 +38,13 @@ public class SerialNumberService {
@Resource
private MaterialMapperEx materialMapperEx;
@Resource
+ private MaterialMapper materialMapper;
+ @Resource
private DepotItemService depotItemService;
@Resource
private UserService userService;
+ @Resource
+ private DepotItemMapperEx depotItemMapperEx;
public SerialNumber getSerialNumber(long id) {
@@ -173,9 +176,9 @@ public class SerialNumberService {
serialNumberEx.setMaterialId(getSerialNumberMaterialIdByMaterialName(serialNumberEx.getMaterialName()));
}
//删除标记,默认未删除
- serialNumberEx.setDeleteFlag(false);
+ serialNumberEx.setDeleteFlag(BusinessConstants.DELETE_FLAG_EXISTS);
//已卖出,默认未否
- serialNumberEx.setIsSell(false);
+ serialNumberEx.setIsSell(BusinessConstants.IS_SELL_HOLD);
Date date=new Date();
serialNumberEx.setCreateTime(date);
serialNumberEx.setUpdateTime(date);
@@ -205,6 +208,38 @@ public class SerialNumberService {
}
return null;
}
+ /**
+ * create by: cjl
+ * description:
+ * 根据商品名称判断商品名称是否有效
+ * create time: 2019/1/23 17:04
+ * @Param: materialName
+ * @return Long 满足使用条件的商品的id
+ */
+ public Long checkMaterialName(String materialName){
+ if(StringUtil.isNotEmpty(materialName)) {
+ List mlist = materialMapperEx.findByMaterialName(materialName);
+ if (mlist == null || mlist.size() < 1) {
+ //商品名称不存在
+ throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_NOT_EXISTS_CODE,
+ ExceptionConstants.MATERIAL_NOT_EXISTS_MSG);
+ }
+ if (mlist.size() > 1) {
+ //商品信息不唯一
+ throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_NOT_ONLY_CODE,
+ ExceptionConstants.MATERIAL_NOT_ONLY_MSG);
+
+ }
+ //获得唯一商品
+ if (BusinessConstants.ENABLE_SERIAL_NUMBER_NOT_ENABLED.equals(mlist.get(0).getEnableSerialNumber())) {
+ //商品未开启序列号
+ throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_NOT_ENABLE_SERIAL_NUMBER_CODE,
+ ExceptionConstants.MATERIAL_NOT_ENABLE_SERIAL_NUMBER_MSG);
+ }
+ return mlist.get(0).getId();
+ }
+ return null;
+ }
/**
* create by: cjl
* description:
@@ -217,29 +252,11 @@ public class SerialNumberService {
* @return Long 满足使用条件的商品的id
*/
public Long getSerialNumberMaterialIdByMaterialName(String materialName){
- if(StringUtil.isNotEmpty(materialName)){
- List mlist = materialMapperEx.findByMaterialName(materialName);
- if(mlist==null||mlist.size()<1){
- //商品名称不存在
- throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_NOT_EXISTS_CODE,
- ExceptionConstants.MATERIAL_NOT_EXISTS_MSG);
- }
- if(mlist.size()>1){
- //商品信息不唯一
- throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_NOT_ONLY_CODE,
- ExceptionConstants.MATERIAL_NOT_ONLY_MSG);
-
- }
- //获得唯一商品
- if(BusinessConstants.MATERIAL_NOT_ENABLE_SERIAL_NUMBER==mlist.get(0).getEnableSerialNumber()){
- //商品未开启序列号
- throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_NOT_ENABLE_SERIAL_NUMBER_CODE,
- ExceptionConstants.MATERIAL_NOT_ENABLE_SERIAL_NUMBER_MSG);
- }
+ if(StringUtil.isNotEmpty(materialName)){
//计算商品库存和目前占用的可用序列号数量关系
//库存=入库-出库
//入库数量
- Long materialId=mlist.get(0).getId();
+ Long materialId=checkMaterialName(materialName);
int inSum = depotItemService.findByTypeAndMaterialId(BusinessConstants.DEPOTHEAD_TYPE_STORAGE, materialId);
//出库数量
int outSum = depotItemService.findByTypeAndMaterialId(BusinessConstants.DEPOTHEAD_TYPE_OUT, materialId);
@@ -254,4 +271,113 @@ public class SerialNumberService {
return null;
}
+ /**
+ * create by: cjl
+ * description:
+ * 出库时判断序列号库存是否足够,
+ * 同时将对应的序列号绑定单据
+ * create time: 2019/1/24 16:24
+ * @Param: List
+ * @return void
+ */
+ public void checkAndUpdateSerialNumber(DepotItem depotItem,User userInfo) throws Exception{
+ if(depotItem!=null){
+ //查询商品下已分配的可用序列号数量
+ int SerialNumberSum= serialNumberMapperEx.countSerialNumberByMaterialIdAndDepotheadId(depotItem.getMaterialid(),null,BusinessConstants.IS_SELL_HOLD);
+ if(depotItem.getOpernumber().intValue()>SerialNumberSum){
+ //获取商品名称
+ Material material= materialMapper.selectByPrimaryKey(depotItem.getMaterialid());
+ throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_SERIAL_NUMBERE_NOT_ENOUGH_CODE,
+ String.format(ExceptionConstants.MATERIAL_SERIAL_NUMBERE_NOT_ENOUGH_MSG,material==null?"":material.getName()));
+ }
+ //商品下序列号充足,分配序列号
+ sellSerialNumber(depotItem.getMaterialid(),depotItem.getHeaderid(),depotItem.getOpernumber().intValue(),userInfo);
+ }
+
+ }
+ /**
+ *
+ *
+ * */
+ /**
+ * create by: cjl
+ * description:
+ * 卖出序列号
+ * create time: 2019/1/25 9:17
+ * @Param: materialId
+ * @Param: depotheadId
+ * @Param: isSell 卖出'1'
+ * @Param: Count 卖出或者赎回的数量
+ * @return com.jsh.erp.datasource.entities.SerialNumberEx
+ */
+ @Transactional(value = "transactionManager", rollbackFor = Exception.class)
+ public int sellSerialNumber(Long materialId, Long depotheadId,int count,User user) throws Exception{
+ return serialNumberMapperEx.sellSerialNumber(materialId,depotheadId,count,new Date(),user==null?null:user.getId());
+ }
+
+ /**
+ * create by: cjl
+ * description:
+ * 赎回序列号
+ * create time: 2019/1/25 9:17
+ * @Param: materialId
+ * @Param: depotheadId
+ * @Param: isSell 赎回'0'
+ * @Param: Count 卖出或者赎回的数量
+ * @return com.jsh.erp.datasource.entities.SerialNumberEx
+ */
+ @Transactional(value = "transactionManager", rollbackFor = Exception.class)
+ public int cancelSerialNumber(Long materialId, Long depotheadId,int count,User user) throws Exception{
+ return serialNumberMapperEx.cancelSerialNumber(materialId,depotheadId,count,new Date(),user==null?null:user.getId());
+ }
+
+ /**
+ * create by: cjl
+ * description:
+ *批量添加序列号
+ * create time: 2019/1/29 15:11
+ * @Param: materialName
+ * @Param: serialNumberPrefix
+ * @Param: batAddTotal
+ * @Param: remark
+ * @return java.lang.Object
+ */
+ @Transactional(value = "transactionManager", rollbackFor = Exception.class)
+ public void batAddSerialNumber(String materialName, String serialNumberPrefix, Integer batAddTotal, String remark) {
+ if(StringUtil.isNotEmpty(materialName)){
+ //查询商品id
+ Long materialId = checkMaterialName(materialName);
+ List list=null;
+ //当前用户
+ User userInfo=userService.getCurrentUser();
+ Long userId=userInfo==null?null:userInfo.getId();
+ Date date = null;
+ Long million=null;
+ synchronized(this){
+ date = new Date();
+ million=date.getTime();
+ }
+
+ int insertNum=0;
+ StringBuffer prefixBuf=new StringBuffer(serialNumberPrefix).append(million);
+ do{
+ list=new ArrayList();
+ int forNum = BusinessConstants.BATCH_INSERT_MAX_NUMBER>=batAddTotal?batAddTotal:BusinessConstants.BATCH_INSERT_MAX_NUMBER;
+ for(int i=0;i0);
+ }
+ }
}
diff --git a/src/main/java/com/jsh/erp/service/supplier/SupplierService.java b/src/main/java/com/jsh/erp/service/supplier/SupplierService.java
index 1f4ef4c3..72d97945 100644
--- a/src/main/java/com/jsh/erp/service/supplier/SupplierService.java
+++ b/src/main/java/com/jsh/erp/service/supplier/SupplierService.java
@@ -78,8 +78,13 @@ public class SupplierService {
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int updateAdvanceIn(Long supplierId, BigDecimal advanceIn){
Supplier supplier = supplierMapper.selectByPrimaryKey(supplierId);
- supplier.setAdvancein(supplier.getAdvancein().add(advanceIn)); //增加预收款的金额,可能增加的是负值
- return supplierMapper.updateByPrimaryKeySelective(supplier);
+ if(supplier!=null){
+ supplier.setAdvancein(supplier.getAdvancein().add(advanceIn)); //增加预收款的金额,可能增加的是负值
+ return supplierMapper.updateByPrimaryKeySelective(supplier);
+ }else{
+ return 0;
+ }
+
}
public List findBySelectCus() {
diff --git a/src/main/resources/mapper_xml/DepotHeadMapperEx.xml b/src/main/resources/mapper_xml/DepotHeadMapperEx.xml
index 2209360c..0995fd7f 100644
--- a/src/main/resources/mapper_xml/DepotHeadMapperEx.xml
+++ b/src/main/resources/mapper_xml/DepotHeadMapperEx.xml
@@ -1,8 +1,8 @@
-
+
-
+
@@ -282,4 +282,112 @@
+
+ insert into jsh_depothead (Type, SubType,
+ ProjectId, DefaultNumber, Number,
+ OperPersonName, CreateTime, OperTime,
+ OrganId, HandsPersonId, AccountId,
+ ChangeAmount, AllocationProjectId, TotalPrice,
+ PayType, Remark, Salesman,
+ AccountIdList, AccountMoneyList, Discount,
+ DiscountMoney, DiscountLastMoney, OtherMoney,
+ OtherMoneyList, OtherMoneyItem, AccountDay,
+ Status)
+ values (#{type,jdbcType=VARCHAR}, #{subtype,jdbcType=VARCHAR},
+ #{projectid,jdbcType=BIGINT}, #{defaultnumber,jdbcType=VARCHAR}, #{number,jdbcType=VARCHAR},
+ #{operpersonname,jdbcType=VARCHAR}, #{createtime,jdbcType=TIMESTAMP}, #{opertime,jdbcType=TIMESTAMP},
+ #{organid,jdbcType=BIGINT}, #{handspersonid,jdbcType=BIGINT}, #{accountid,jdbcType=BIGINT},
+ #{changeamount,jdbcType=DECIMAL}, #{allocationprojectid,jdbcType=BIGINT}, #{totalprice,jdbcType=DECIMAL},
+ #{paytype,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR}, #{salesman,jdbcType=VARCHAR},
+ #{accountidlist,jdbcType=VARCHAR}, #{accountmoneylist,jdbcType=VARCHAR}, #{discount,jdbcType=DECIMAL},
+ #{discountmoney,jdbcType=DECIMAL}, #{discountlastmoney,jdbcType=DECIMAL}, #{othermoney,jdbcType=DECIMAL},
+ #{othermoneylist,jdbcType=VARCHAR}, #{othermoneyitem,jdbcType=VARCHAR}, #{accountday,jdbcType=INTEGER},
+ #{status,jdbcType=BIT})
+
+
+ update jsh_depothead
+
+
+ Type = #{type,jdbcType=VARCHAR},
+
+
+ SubType = #{subtype,jdbcType=VARCHAR},
+
+
+ ProjectId = #{projectid,jdbcType=BIGINT},
+
+
+ DefaultNumber = #{defaultnumber,jdbcType=VARCHAR},
+
+
+ Number = #{number,jdbcType=VARCHAR},
+
+
+ OperPersonName = #{operpersonname,jdbcType=VARCHAR},
+
+
+ OperTime = #{opertime,jdbcType=TIMESTAMP},
+
+
+ OrganId = #{organid,jdbcType=BIGINT},
+
+
+ HandsPersonId = #{handspersonid,jdbcType=BIGINT},
+
+
+ AccountId = #{accountid,jdbcType=BIGINT},
+
+
+ ChangeAmount = #{changeamount,jdbcType=DECIMAL},
+
+
+ AllocationProjectId = #{allocationprojectid,jdbcType=BIGINT},
+
+
+ TotalPrice = #{totalprice,jdbcType=DECIMAL},
+
+
+ PayType = #{paytype,jdbcType=VARCHAR},
+
+
+ Remark = #{remark,jdbcType=VARCHAR},
+
+
+ Salesman = #{salesman,jdbcType=VARCHAR},
+
+
+ AccountIdList = #{accountidlist,jdbcType=VARCHAR},
+
+
+ AccountMoneyList = #{accountmoneylist,jdbcType=VARCHAR},
+
+
+ Discount = #{discount,jdbcType=DECIMAL},
+
+
+ DiscountMoney = #{discountmoney,jdbcType=DECIMAL},
+
+
+ DiscountLastMoney = #{discountlastmoney,jdbcType=DECIMAL},
+
+
+ OtherMoney = #{othermoney,jdbcType=DECIMAL},
+
+
+ OtherMoneyList = #{othermoneylist,jdbcType=VARCHAR},
+
+
+ OtherMoneyItem = #{othermoneyitem,jdbcType=VARCHAR},
+
+
+ AccountDay = #{accountday,jdbcType=INTEGER},
+
+
+ Status = #{status,jdbcType=BIT},
+
+
+ where Id = #{id,jdbcType=BIGINT}
+
+
\ No newline at end of file
diff --git a/src/main/resources/mapper_xml/DepotItemMapperEx.xml b/src/main/resources/mapper_xml/DepotItemMapperEx.xml
index a52c129b..4e4e54be 100644
--- a/src/main/resources/mapper_xml/DepotItemMapperEx.xml
+++ b/src/main/resources/mapper_xml/DepotItemMapperEx.xml
@@ -1,6 +1,7 @@
-
+
+
@@ -12,12 +13,12 @@
-
+
-
+
@@ -33,7 +34,7 @@
-
+
@@ -41,7 +42,7 @@
-
\ No newline at end of file
diff --git a/src/main/resources/mapper_xml/MaterialMapper.xml b/src/main/resources/mapper_xml/MaterialMapper.xml
index da08d931..cbf48213 100644
--- a/src/main/resources/mapper_xml/MaterialMapper.xml
+++ b/src/main/resources/mapper_xml/MaterialMapper.xml
@@ -29,7 +29,7 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
+
diff --git a/src/main/resources/mapper_xml/SerialNumberMapper.xml b/src/main/resources/mapper_xml/SerialNumberMapper.xml
index ea0d1c84..a4f7d571 100644
--- a/src/main/resources/mapper_xml/SerialNumberMapper.xml
+++ b/src/main/resources/mapper_xml/SerialNumberMapper.xml
@@ -9,13 +9,14 @@
-
+
-
+
+
id, material_Id, serial_Number, is_Sell, remark, delete_Flag, create_Time, creator,
- update_Time, updater
+ update_Time, updater,depothead_Id