From b3e32de3f9bf6eff94dcc4638307ffd914b5aeec Mon Sep 17 00:00:00 2001 From: cjl Date: Thu, 31 Jan 2019 10:05:05 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=9C=AA=E5=BC=80?= =?UTF-8?q?=E5=90=AF=E5=BA=8F=E5=88=97=E5=8F=B7=E7=9A=84=E5=95=86=E5=93=81?= =?UTF-8?q?=E4=B9=9F=E5=BC=BA=E5=88=B6=E4=BD=BF=E7=94=A8=E5=BA=8F=E5=88=97?= =?UTF-8?q?=E5=8F=B7=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/depotItem/DepotItemService.java | 64 ++++++++++++++++--- 1 file changed, 56 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/jsh/erp/service/depotItem/DepotItemService.java b/src/main/java/com/jsh/erp/service/depotItem/DepotItemService.java index 63b5dfac..e63664d2 100644 --- a/src/main/java/com/jsh/erp/service/depotItem/DepotItemService.java +++ b/src/main/java/com/jsh/erp/service/depotItem/DepotItemService.java @@ -246,8 +246,20 @@ public class DepotItemService { 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()); + if(depotItem==null){ + continue; + } + /** + * 判断商品是否开启序列号,开启的收回序列号,未开启的跳过 + * */ + Material material= materialService.getMaterial(depotItem.getMaterialid()); + if(material==null){ + continue; + } + if(BusinessConstants.ENABLE_SERIAL_NUMBER_ENABLED.equals(material.getEnableSerialNumber())){ + serialNumberMapperEx.cancelSerialNumber(depotItem.getMaterialid(),depotItem.getHeaderid(),depotItem.getOpernumber().intValue(), + new Date(),userInfo==null?null:userInfo.getId()); + } } this.deleteDepotItem(tempDeletedJson.getLong("Id")); } @@ -332,8 +344,20 @@ public class DepotItemService { /**出库时处理序列号*/ if(BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType()) &&!BusinessConstants.SUB_TYPE_TRANSFER.equals(depotHead.getSubtype())){ - //查询单据子表中开启序列号的数据列表 - serialNumberService.checkAndUpdateSerialNumber(depotItem,userInfo); + if(depotItem==null){ + continue; + } + /** + * 判断商品是否开启序列号,开启的收回序列号,未开启的跳过 + * */ + Material material= materialService.getMaterial(depotItem.getMaterialid()); + if(material==null){ + continue; + } + if(BusinessConstants.ENABLE_SERIAL_NUMBER_ENABLED.equals(material.getEnableSerialNumber())) { + //查询单据子表中开启序列号的数据列表 + serialNumberService.checkAndUpdateSerialNumber(depotItem, userInfo); + } } } } @@ -345,8 +369,20 @@ public class DepotItemService { //首先回收序列号 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()); + if(depotItem==null){ + continue; + } + /** + * 判断商品是否开启序列号,开启的收回序列号,未开启的跳过 + * */ + Material material= materialService.getMaterial(depotItem.getMaterialid()); + if(material==null){ + continue; + } + if(BusinessConstants.ENABLE_SERIAL_NUMBER_ENABLED.equals(material.getEnableSerialNumber())) { + 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")); @@ -412,8 +448,20 @@ public class DepotItemService { /**出库时处理序列号*/ if(BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType()) &&!BusinessConstants.SUB_TYPE_TRANSFER.equals(depotHead.getSubtype())){ - //查询单据子表中开启序列号的数据列表 - serialNumberService.checkAndUpdateSerialNumber(depotItem,userInfo); + if(depotItem==null){ + continue; + } + /** + * 判断商品是否开启序列号,开启的收回序列号,未开启的跳过 + * */ + Material material= materialService.getMaterial(depotItem.getMaterialid()); + if(material==null){ + continue; + } + if(BusinessConstants.ENABLE_SERIAL_NUMBER_ENABLED.equals(material.getEnableSerialNumber())) { + //查询单据子表中开启序列号的数据列表 + serialNumberService.checkAndUpdateSerialNumber(depotItem, userInfo); + } } } } From 109ca8d2edd279ee8a3f08199f9dedb164aaee01 Mon Sep 17 00:00:00 2001 From: cjl Date: Thu, 31 Jan 2019 10:56:27 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=95=86=E5=93=81?= =?UTF-8?q?=E5=BA=93=E5=AD=98=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jsh/erp/constants/ExceptionConstants.java | 7 +- .../service/depotItem/DepotItemService.java | 104 +++++++++++------- 2 files changed, 72 insertions(+), 39 deletions(-) diff --git a/src/main/java/com/jsh/erp/constants/ExceptionConstants.java b/src/main/java/com/jsh/erp/constants/ExceptionConstants.java index 6e795ca1..8056ad58 100644 --- a/src/main/java/com/jsh/erp/constants/ExceptionConstants.java +++ b/src/main/java/com/jsh/erp/constants/ExceptionConstants.java @@ -32,10 +32,10 @@ public class ExceptionConstants { public static final int SERIAL_NUMBERE_ALREADY_EXISTS_CODE = 10500000; public static final String SERIAL_NUMBERE_ALREADY_EXISTS_MSG = "序列号已存在"; /**序列号不能为为空*/ - public static final int SERIAL_NUMBERE_NOT_BE_EMPTY_CODE = 10500000; + public static final int SERIAL_NUMBERE_NOT_BE_EMPTY_CODE = 10500001; 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 int MATERIAL_SERIAL_NUMBERE_NOT_ENOUGH_CODE = 10500002; public static final String MATERIAL_SERIAL_NUMBERE_NOT_ENOUGH_MSG = "商品:%s下序列号不充足,请补充后重试"; @@ -56,6 +56,9 @@ public class ExceptionConstants { //该商品已绑定序列号数量小于等于商品现有库存 public static final int MATERIAL_SERIAL_NUMBERE_NOT_MORE_THAN_STORAGE_CODE = 8000003; public static final String MATERIAL_SERIAL_NUMBERE_NOT_MORE_THAN_STORAGE_MSG = "该商品已绑定序列号数量大于等于商品现有库存"; + //商品库存不足 + public static final int MATERIAL_STOCK_NOT_ENOUGH_CODE = 8000004; + public static final String MATERIAL_STOCK_NOT_ENOUGH_MSG = "商品:%s库存不足"; /** * 标准正常返回/操作成功返回 diff --git a/src/main/java/com/jsh/erp/service/depotItem/DepotItemService.java b/src/main/java/com/jsh/erp/service/depotItem/DepotItemService.java index e63664d2..f9b7b21f 100644 --- a/src/main/java/com/jsh/erp/service/depotItem/DepotItemService.java +++ b/src/main/java/com/jsh/erp/service/depotItem/DepotItemService.java @@ -3,11 +3,13 @@ package com.jsh.erp.service.depotItem; import com.alibaba.fastjson.JSONArray; 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.DepotHeadMapper; import com.jsh.erp.datasource.mappers.DepotItemMapper; import com.jsh.erp.datasource.mappers.DepotItemMapperEx; import com.jsh.erp.datasource.mappers.SerialNumberMapperEx; +import com.jsh.erp.exception.BusinessRunTimeException; import com.jsh.erp.service.material.MaterialService; import com.jsh.erp.service.serialNumber.SerialNumberService; import com.jsh.erp.service.user.UserService; @@ -341,24 +343,39 @@ 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())){ - if(depotItem==null){ - continue; - } - /** - * 判断商品是否开启序列号,开启的收回序列号,未开启的跳过 - * */ - Material material= materialService.getMaterial(depotItem.getMaterialid()); - if(material==null){ - continue; - } - if(BusinessConstants.ENABLE_SERIAL_NUMBER_ENABLED.equals(material.getEnableSerialNumber())) { - //查询单据子表中开启序列号的数据列表 - serialNumberService.checkAndUpdateSerialNumber(depotItem, userInfo); - } + + /** + * 出库时判断库存是否充足 + * */ + if(!BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())){ + //非出库,可以直接跳过下面的操作 + continue; } + if(depotItem==null){ + continue; + } + Material material= materialService.getMaterial(depotItem.getMaterialid()); + if(material==null){ + continue; + } + if(getCurrentInStock(depotItem.getMaterialid()) Date: Thu, 31 Jan 2019 11:47:39 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=8D=95=E6=8D=AE?= =?UTF-8?q?=E7=BC=96=E5=8F=B7=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- erp_web/pages/manage/serialNumber.html | 18 ++-- .../datasource/entities/SerialNumberEx.java | 10 +++ .../service/depotItem/DepotItemService.java | 86 ++++++++----------- .../mapper_xml/SerialNumberMapperEx.xml | 6 +- 4 files changed, 62 insertions(+), 58 deletions(-) diff --git a/erp_web/pages/manage/serialNumber.html b/erp_web/pages/manage/serialNumber.html index 83df0f76..88152f4b 100644 --- a/erp_web/pages/manage/serialNumber.html +++ b/erp_web/pages/manage/serialNumber.html @@ -188,30 +188,32 @@ pageList: initPageNum, columns: [[ {field: 'id', width: 35, align: "center", checkbox: true}, + {field: 'depotheadId', hidden: true}, { title: '操作', field: 'op', align: "center", width: 60, formatter: function (value, rec) { var str = ''; var rowInfo = rec.id + 'AaBb' + rec.materialId + 'AaBb' + rec.materialName + 'AaBb' + rec.serialNumber + 'AaBb' + rec.isSell + 'AaBb' + rec.remark + 'AaBb' + rec.deleteFlag + 'AaBb' + rec.createTime + 'AaBb' + rec.updateTime + 'AaBb' + rec.creator + 'AaBb' + rec.updater - + 'AaBb' + rec.creatorName + 'AaBb' + rec.updaterName; + + 'AaBb' + rec.creatorName + 'AaBb' + rec.updaterName +'AaBb' + rec.depotheadId+'AaBb' + rec.depotHeadNumber; str += '   '; str += ''; return str; } }, - {title: '商品名称', field: 'materialName', width: 100}, - {title: '序列号', field: 'serialNumber', width: 200}, - {title: '已卖出', field: 'isSell', width: 60 , formatter: function (value) { + {title: '商品名称', align: "center",field: 'materialName', width: 100}, + {title: '序列号',align: "center", field: 'serialNumber', width: 200}, + {title: '单据编号', align: "center", field: 'depotHeadNumber', width: 200}, + {title: '已卖出', align: "center", field: 'isSell', width: 60 , formatter: function (value) { return value=='1' ? "是" : "否"; } }, - {title: '已删除', field: 'deleteFlag', width: 60, formatter: function (value) { + {title: '已删除', align: "center", field: 'deleteFlag', width: 60, formatter: function (value) { return value=='1' ? "是" : "否"; } }, - {title: '创建时间', field: 'createTime', width: 140,formatter: formatDatebox}, - {title: '更新时间', field: 'updateTime', width: 140,formatter: formatDatebox}, - {title: '备注', field: 'remark',width: 300} + {title: '创建时间',align: "center", field: 'createTime', width: 140,formatter: formatDatebox}, + {title: '更新时间', align: "center", field: 'updateTime', width: 140,formatter: formatDatebox}, + {title: '备注',align: "center", field: 'remark',width: 200} ]], toolbar: [ { diff --git a/src/main/java/com/jsh/erp/datasource/entities/SerialNumberEx.java b/src/main/java/com/jsh/erp/datasource/entities/SerialNumberEx.java index bd29dff4..4077e9b9 100644 --- a/src/main/java/com/jsh/erp/datasource/entities/SerialNumberEx.java +++ b/src/main/java/com/jsh/erp/datasource/entities/SerialNumberEx.java @@ -19,6 +19,8 @@ public class SerialNumberEx extends SerialNumber{ * 更新者名称 * */ private String updaterName; + /**单据编号*/ + private String depotHeadNumber; public String getMaterialName() { return materialName; @@ -43,4 +45,12 @@ public class SerialNumberEx extends SerialNumber{ public void setUpdaterName(String updaterName) { this.updaterName = updaterName; } + + public String getDepotHeadNumber() { + return depotHeadNumber; + } + + public void setDepotHeadNumber(String depotHeadNumber) { + this.depotHeadNumber = depotHeadNumber; + } } diff --git a/src/main/java/com/jsh/erp/service/depotItem/DepotItemService.java b/src/main/java/com/jsh/erp/service/depotItem/DepotItemService.java index f9b7b21f..3b8e0651 100644 --- a/src/main/java/com/jsh/erp/service/depotItem/DepotItemService.java +++ b/src/main/java/com/jsh/erp/service/depotItem/DepotItemService.java @@ -342,40 +342,34 @@ public class DepotItemService { if (tempInsertedJson.get("MType") != null) { depotItem.setMtype(tempInsertedJson.getString("MType")); } - this.insertDepotItemWithObj(depotItem); - /** * 出库时判断库存是否充足 * */ - if(!BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())){ - //非出库,可以直接跳过下面的操作 - continue; - } - if(depotItem==null){ - continue; - } - Material material= materialService.getMaterial(depotItem.getMaterialid()); - if(material==null){ - continue; - } - if(getCurrentInStock(depotItem.getMaterialid()) + select ser.id, ser.material_Id, ser.serial_Number, ser.is_Sell, ser.remark, ser.delete_Flag, ser.create_Time, ser.update_Time,mat.name as materialName,null as creator,null as updater,null as creatorName, - null as updaterName,ser.depothead_Id, dh.number as depotHeadNumber + null as updaterName,ser.depothead_Id, dh.number as depotHeadNumber,concat(dh.SubType,dh.Type) as depotHeadType FROM jsh_serial_number ser left join jsh_material mat on mat.id = ser.material_Id left join jsh_depothead dh on dh.id= ser.depothead_Id From 9ba3ef343eaf54435fc3c5fbe0225a67447d5b45 Mon Sep 17 00:00:00 2001 From: cjl Date: Thu, 31 Jan 2019 15:52:05 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=98=BE=E7=A4=BAundefin?= =?UTF-8?q?ed=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- erp_web/js/pages/materials/in_out.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erp_web/js/pages/materials/in_out.js b/erp_web/js/pages/materials/in_out.js index d9c9d249..a92bf39b 100644 --- a/erp_web/js/pages/materials/in_out.js +++ b/erp_web/js/pages/materials/in_out.js @@ -1737,7 +1737,7 @@ $("#ProjectIdShow").text(depotHeadInfo[10]); $("#NumberShow").text(depotHeadInfo[2]); $("#OperTimeShow").text(depotHeadInfo[4]); - $('#OrganIdShow').text(depotHeadInfo[11]); + $('#OrganIdShow').text(depotHeadInfo[11]=="undefined"?'':depotHeadInfo[11]); $("#HandsPersonIdShow").text(depotHeadInfo[12]); if(depotHeadInfo[13] && depotHeadInfo[13]!="undefined"){ $("#AccountIdShow").text(depotHeadInfo[13]); //结算账户 From 5bde2843e660636c666deb6c477e9dceaf6a723f Mon Sep 17 00:00:00 2001 From: cjl Date: Thu, 31 Jan 2019 16:24:53 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E5=8D=95=E6=8D=AE=E7=BC=96=E5=8F=B7?= =?UTF-8?q?=E4=B8=BA=E7=A9=BA=E6=97=B6=E4=B8=8D=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- erp_web/pages/manage/serialNumber.html | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/erp_web/pages/manage/serialNumber.html b/erp_web/pages/manage/serialNumber.html index b586e8d7..903f49a3 100644 --- a/erp_web/pages/manage/serialNumber.html +++ b/erp_web/pages/manage/serialNumber.html @@ -205,8 +205,12 @@ {title: '序列号',align: "center", field: 'serialNumber', width: 200}, {title: '单据编号', align: "center", field: 'depotHeadNumber', width: 140, formatter: function (value, row) { - return "" - + row.depotHeadNumber + ""; + if(row.depotHeadNumber){ + + return "" + + row.depotHeadNumber + ""; + } + return ''; } }, {title: '已卖出', align: "center", field: 'isSell', width: 60 , formatter: function (value) {