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/pages/manage/serialNumber.html b/erp_web/pages/manage/serialNumber.html index 5b19750b..83df0f76 100644 --- a/erp_web/pages/manage/serialNumber.html +++ b/erp_web/pages/manage/serialNumber.html @@ -87,12 +87,59 @@ -
保存 取消
+
+
+
+
+ + + + + + + + + + + + + + + + + + +
商品名称 + + 序列号前缀 + +
序列号数量 + +
备注 + +
+
+
+
+
+
+ 保存 + 取消 +
diff --git a/src/main/java/com/jsh/erp/constants/BusinessConstants.java b/src/main/java/com/jsh/erp/constants/BusinessConstants.java index 789a9590..557355b6 100644 --- a/src/main/java/com/jsh/erp/constants/BusinessConstants.java +++ b/src/main/java/com/jsh/erp/constants/BusinessConstants.java @@ -57,6 +57,10 @@ public class BusinessConstants { 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/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/datasource/mappers/SerialNumberMapperEx.java b/src/main/java/com/jsh/erp/datasource/mappers/SerialNumberMapperEx.java index 05621c9b..d45532a4 100644 --- a/src/main/java/com/jsh/erp/datasource/mappers/SerialNumberMapperEx.java +++ b/src/main/java/com/jsh/erp/datasource/mappers/SerialNumberMapperEx.java @@ -56,5 +56,8 @@ public interface SerialNumberMapperEx { * 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/serialNumber/SerialNumberService.java b/src/main/java/com/jsh/erp/service/serialNumber/SerialNumberService.java index d87ba48f..2b57f175 100644 --- a/src/main/java/com/jsh/erp/service/serialNumber/SerialNumberService.java +++ b/src/main/java/com/jsh/erp/service/serialNumber/SerialNumberService.java @@ -17,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; @@ -207,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: @@ -219,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.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); - } + 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); @@ -316,6 +331,47 @@ public class SerialNumberService { 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 + */ + 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 = new Date(); + Long 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/resources/mapper_xml/SerialNumberMapperEx.xml b/src/main/resources/mapper_xml/SerialNumberMapperEx.xml index ab4b5217..af8a6f19 100644 --- a/src/main/resources/mapper_xml/SerialNumberMapperEx.xml +++ b/src/main/resources/mapper_xml/SerialNumberMapperEx.xml @@ -204,6 +204,18 @@ ) + + insert into jsh_serial_number + (material_Id, serial_Number, is_Sell, remark,delete_Flag, + create_Time, creator,update_Time, updater) + values + + (#{each.materialId},#{each.serialNumber},'0',#{each.remark},'0', + #{each.createTime},#{each.creator},#{each.updateTime},#{each.updater} + ) + +