Commit e90153533bfdf19a6faf80916a61a490dc8db3d1

Authored by xqs
2 parents 7be80147 5e71560a

Merge branch 'develop' of http://172.16.29.40:8010/wms/wms2 into develop

src/main/java/com/huaheng/pc/config/FilterConfigDetail/domain/FilterConfigDetail.java
... ... @@ -78,6 +78,10 @@ public class FilterConfigDetail implements Serializable {
78 78 @ApiModelProperty(value="全SQL")
79 79 private String statement;
80 80  
  81 + @TableField(value = "sqll")
  82 + @ApiModelProperty(value="后续分组排序")
  83 + private String sqll;
  84 +
81 85 /**
82 86 * 是否系统创建
83 87 */
... ...
src/main/java/com/huaheng/pc/config/waveMaster/domain/WaveMaster.java
... ... @@ -23,13 +23,20 @@ public class WaveMaster implements Serializable {
23 23 private Integer id;
24 24  
25 25 /**
26   - * 主表名称
  26 + * 主表编码
27 27 */
28 28 @TableField(value = "code")
29   - @ApiModelProperty(value="主表名称")
  29 + @ApiModelProperty(value="主表编码")
30 30 private String code;
31 31  
32 32 /**
  33 + * 主表名称
  34 + */
  35 + @TableField(value = "name")
  36 + @ApiModelProperty(value="主表名称")
  37 + private String name;
  38 +
  39 + /**
33 40 * 仓库编码
34 41 */
35 42 @TableField(value = "warehouseCode")
... ...
src/main/java/com/huaheng/pc/inventory/inventoryDetail/service/InventoryDetailService.java
... ... @@ -14,7 +14,7 @@ public interface InventoryDetailService extends IService<InventoryDetail> {
14 14  
15 15 void detailcreateCheckOutTask (Integer id);
16 16  
17   - List<InventoryDetail> selectBysql(String sql, ShipmentDetail shipmentDetail);
  17 + List<InventoryDetail> selectBysql(String sql, ShipmentDetail shipmentDetail,String sqll);
18 18  
19 19  
20 20 AjaxResult detailCheckTask (Integer[] ids) throws InvocationTargetException, IllegalAccessException;
... ...
src/main/java/com/huaheng/pc/inventory/inventoryDetail/service/InventoryDetailServiceImpl.java
... ... @@ -128,11 +128,18 @@ public class InventoryDetailServiceImpl extends ServiceImpl&lt;InventoryDetailMappe
128 128 }
129 129  
130 130 @Override
131   - public List<InventoryDetail> selectBysql(String sql, ShipmentDetail shipmentDetail) {
132   - sql=sql+" \n" +"and warehouseCode='" + shipmentDetail.getWarehouseCode()+"' \n" +
133   - "and companyCode='" + shipmentDetail.getCompanyCode()+"' \n" +
134   - "and materialCode='" + shipmentDetail.getMaterialCode() +"' \n" +
135   - "and inventorySts='" + shipmentDetail.getInventorySts() + "'";
  131 + public List<InventoryDetail> selectBysql(String sql, ShipmentDetail shipmentDetail,String sqll) {
  132 + if(StringUtils.isEmpty(sqll)) {
  133 + sql = sql + " \n" + "and warehouseCode='" + shipmentDetail.getWarehouseCode() + "' \n" +
  134 + "and companyCode='" + shipmentDetail.getCompanyCode() + "' \n" +
  135 + "and materialCode='" + shipmentDetail.getMaterialCode() + "' \n" +
  136 + "and inventorySts='" + shipmentDetail.getInventorySts() + "'";
  137 + }else {
  138 + sql = sql + " \n" + "and warehouseCode='" + shipmentDetail.getWarehouseCode() + "' \n" +
  139 + "and companyCode='" + shipmentDetail.getCompanyCode() + "' \n" +
  140 + "and materialCode='" + shipmentDetail.getMaterialCode() + "' \n" +
  141 + "and inventorySts='" + shipmentDetail.getInventorySts() + "'"+ " \n" +sqll;
  142 + }
136 143 return inventoryDetailMapper.selectBysql(sql);
137 144 }
138 145  
... ...
src/main/java/com/huaheng/pc/shipment/shipmentDetail/service/ShipmentDetailService.java
... ... @@ -17,5 +17,8 @@ public interface ShipmentDetailService extends IService&lt;ShipmentDetail&gt;{
17 17  
18 18 Integer countUnCompleted(Integer shipmentId);
19 19  
  20 + //选中的单据加入波次
  21 + void saveWave(String ids,String code);
  22 +
20 23  
21 24 }
... ...
src/main/java/com/huaheng/pc/shipment/shipmentDetail/service/ShipmentDetailServiceImpl.java
... ... @@ -2,17 +2,25 @@ package com.huaheng.pc.shipment.shipmentDetail.service;
2 2  
3 3 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
4 4 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
  5 +import com.huaheng.common.exception.service.ServiceException;
  6 +import com.huaheng.common.support.Convert;
5 7 import com.huaheng.common.utils.DataUtils;
6 8 import com.huaheng.common.utils.StringUtils;
7 9 import com.huaheng.common.utils.security.ShiroUtils;
8 10 import com.huaheng.framework.web.domain.AjaxResult;
9 11 import com.huaheng.pc.config.material.domain.Material;
10 12 import com.huaheng.pc.config.material.service.MaterialService;
  13 +import com.huaheng.pc.config.waveMaster.domain.WaveMaster;
  14 +import com.huaheng.pc.config.waveMaster.service.WaveMasterService;
11 15 import com.huaheng.pc.shipment.shipmentHeader.domain.ShipmentHeader;
12 16 import com.huaheng.pc.shipment.shipmentHeader.service.ShipmentHeaderService;
  17 +import com.huaheng.pc.shipment.wave.domain.Wave;
  18 +import com.huaheng.pc.shipment.wave.service.WaveService;
13 19 import org.springframework.beans.factory.annotation.Autowired;
14 20 import org.springframework.stereotype.Service;
15 21 import javax.annotation.Resource;
  22 +import java.math.BigDecimal;
  23 +import java.util.ArrayList;
16 24 import java.util.List;
17 25 import java.util.Map;
18 26  
... ... @@ -31,6 +39,10 @@ public class ShipmentDetailServiceImpl extends ServiceImpl&lt;ShipmentDetailMapper,
31 39 private MaterialService materialService;
32 40 @Resource
33 41 private ShipmentDetailMapper shipmentDetailMapper;
  42 + @Autowired
  43 + private WaveMasterService waveMasterService;
  44 + @Autowired
  45 + private WaveService waveService;
34 46  
35 47 /**
36 48 * 新增出库明细
... ... @@ -137,4 +149,93 @@ public class ShipmentDetailServiceImpl extends ServiceImpl&lt;ShipmentDetailMapper,
137 149 public Integer countUnCompleted(Integer shipmentId) {
138 150 return shipmentDetailMapper.countUnCompleted(shipmentId);
139 151 }
  152 +
  153 +
  154 + //选中的单据加入波次
  155 + @Override
  156 + @Transactional
  157 + public void saveWave(String ids, String code) {
  158 + //找到波次主表,看系统是否有此波次
  159 + LambdaQueryWrapper<WaveMaster> lam=Wrappers.lambdaQuery();
  160 + lam.eq(WaveMaster::getCode,code)
  161 + .eq(WaveMaster::getWarehouseCode,ShiroUtils.getWarehouseCode());
  162 + WaveMaster waveMaster=waveMasterService.getOne(lam);
  163 + if(waveMaster == null){
  164 + throw new ServiceException("系统没有此波次");
  165 + }
  166 +
  167 + if(Convert.toIntArray(ids).length >waveMaster.getMaxShipments()){
  168 + throw new ServiceException("加入波次的单据数量超过波次的单据限制");
  169 + }
  170 +
  171 + List<ShipmentDetail> shipmentDetailList=new ArrayList<>();
  172 + BigDecimal qty=new BigDecimal(0);
  173 + //检查出库子表是否有处于波次的
  174 + for (Integer id : Convert.toIntArray(ids))
  175 + {
  176 + LambdaQueryWrapper<ShipmentDetail> lamDetail=Wrappers.lambdaQuery();
  177 + lamDetail.eq(ShipmentDetail::getWarehouseCode,ShiroUtils.getWarehouseCode())
  178 + .eq(ShipmentDetail::getShipmentId,id);
  179 + List<ShipmentDetail> shipmentDetails=this.list(lamDetail);
  180 + if(shipmentDetails == null || shipmentDetails.size() == 0){
  181 + throw new ServiceException("系统没有主单id为"+id+"的子单");
  182 + }
  183 +
  184 + //查看是否有单据处于波次中
  185 + for(ShipmentDetail shipmentDetail : shipmentDetails) {
  186 + if (shipmentDetail.getWaveId() != 0) {
  187 + throw new ServiceException("主单id为" + id + "子单id为" + shipmentDetail.getId() + "的子单已加入波次,不可再加入波次");
  188 + }
  189 + shipmentDetailList.add(shipmentDetail);
  190 + qty=qty.add(shipmentDetail.getShipQty());
  191 + }
  192 + }
  193 +
  194 + if(shipmentDetailList.size()>waveMaster.getMaxLines()){
  195 + throw new ServiceException("加入波次的总行数超过波次的行数限制");
  196 + }
  197 +
  198 + Boolean flag=false;
  199 +
  200 + //查看波次是否建成未执行
  201 + LambdaQueryWrapper<Wave> waveLam = Wrappers.lambdaQuery();
  202 + waveLam.eq(Wave::getStatus,0)
  203 + .eq(Wave::getWaveMode,code)
  204 + .eq(Wave::getWarehouseCode,ShiroUtils.getWarehouseCode());
  205 + Wave wave = waveService.getOne(waveLam);
  206 + if(wave != null && (wave.getTotalShipments()+Convert.toIntArray(ids).length)<= waveMaster.getMaxShipments()
  207 + && (wave.getTotalLines()+shipmentDetailList.size()<= waveMaster.getMaxLines())){
  208 + //修改波次
  209 + wave.setTotalShipments(Convert.toIntArray(ids).length + wave.getTotalShipments());
  210 + wave.setTotalLines(shipmentDetailList.size() + wave.getTotalLines());
  211 + wave.setTotalQty(qty.add(wave.getTotalQty()));
  212 + wave.setLastUpdatedBy(ShiroUtils.getLoginName());
  213 +
  214 + }else {
  215 + //创建波次
  216 + wave.setWarehouseCode(ShiroUtils.getWarehouseCode());
  217 + wave.setMasterCode(code);
  218 + wave.setWaveName(waveMaster.getName());
  219 + wave.setStatus(0);
  220 + wave.setCurrentWaveStep("0");
  221 + wave.setTotalShipments(Convert.toIntArray(ids).length);
  222 + wave.setTotalLines(shipmentDetailList.size());
  223 + wave.setTotalQty(qty);
  224 + wave.setCreatedBy(ShiroUtils.getLoginName());
  225 + flag = waveService.save(wave);
  226 + if (flag == false) {
  227 + throw new ServiceException("波次建立失败");
  228 + }
  229 + }
  230 +
  231 + //修改出库子单
  232 + for(ShipmentDetail shipmentDetail :shipmentDetailList){
  233 + shipmentDetail.setWaveId(wave.getId());
  234 + }
  235 +
  236 + flag = this.updateBatchById(shipmentDetailList);
  237 + if(flag == false){
  238 + throw new ServiceException("出库子单加入波次失败");
  239 + }
  240 + }
140 241 }
... ...
src/main/java/com/huaheng/pc/shipment/shipmentHeader/controller/ShipmentHeaderController.java
... ... @@ -15,6 +15,8 @@ import com.huaheng.framework.web.domain.AjaxResult;
15 15 import com.huaheng.framework.web.page.PageDomain;
16 16 import com.huaheng.framework.web.page.TableDataInfo;
17 17 import com.huaheng.framework.web.page.TableSupport;
  18 +import com.huaheng.pc.config.waveMaster.domain.WaveMaster;
  19 +import com.huaheng.pc.config.waveMaster.service.WaveMasterService;
18 20 import com.huaheng.pc.shipment.shipmentDetail.domain.ShipmentDetail;
19 21 import com.huaheng.pc.shipment.shipmentDetail.service.ShipmentDetailService;
20 22 import com.huaheng.pc.shipment.shipmentHeader.domain.ShipmentHeader;
... ... @@ -46,6 +48,9 @@ public class ShipmentHeaderController extends BaseController
46 48 private ShipmentHeaderService shipmentHeaderService;
47 49 @Autowired
48 50 private ShipmentDetailService shipmentDetailService;
  51 + @Autowired
  52 + private WaveMasterService waveMasterService;
  53 +
49 54  
50 55 @RequiresPermissions("shipment:bill:view")
51 56 @GetMapping()
... ... @@ -225,4 +230,49 @@ public class ShipmentHeaderController extends BaseController
225 230 //
226 231 // }
227 232  
  233 + /**
  234 + * 加入波次
  235 + */
  236 + @GetMapping("/wave")
  237 + public String addZoneCode()
  238 + {
  239 + return prefix + "/addWave";
  240 + }
  241 +
  242 + /**
  243 + * 查询波次列表
  244 + */
  245 + @RequiresPermissions("shipment:bill:list")
  246 + @Log(title = "出库-出库单", operating = "查询库区列表", action = BusinessType.GRANT)
  247 + @PostMapping("/waveList")
  248 + @ResponseBody
  249 + public TableDataInfo waveList()
  250 + {
  251 + LambdaQueryWrapper<WaveMaster> lam = Wrappers.lambdaQuery();
  252 + lam.eq(WaveMaster::getWarehouseCode,ShiroUtils.getWarehouseCode());
  253 + List<WaveMaster> waveMasters = waveMasterService.list(lam);
  254 + return getDataTable(waveMasters);
  255 + }
  256 +
  257 +
  258 +
  259 + /**
  260 + * 波次
  261 + */
  262 + @RequiresPermissions("shipment:bill:wave")
  263 + @Log(title = "出库-出库单", operating="波次", action = BusinessType.OTHER)
  264 + @PostMapping( "/addWave")
  265 + @ResponseBody
  266 + @Transactional
  267 + public AjaxResult analysis(String ids,String code){
  268 + if (StringUtils.isEmpty(ids))
  269 + throw new ServiceException("id不能为空");
  270 + if(StringUtils.isEmpty(code)){
  271 + throw new ServiceException("波次不能为空");
  272 + }
  273 +
  274 + shipmentDetailService.saveWave(ids,code);
  275 + return AjaxResult.success("加入波次成功");
  276 + }
  277 +
228 278 }
... ...
src/main/java/com/huaheng/pc/shipment/shippingCombination/service/ShippingCombinationService.java
... ... @@ -61,7 +61,7 @@ public class ShippingCombinationService {
61 61  
62 62 //根据sql查库存
63 63 try {
64   - list = inventoryDetailService.selectBysql(filterConfigDetail.getStatement(),shipmentDetail);
  64 + list = inventoryDetailService.selectBysql(filterConfigDetail.getStatement(),shipmentDetail,filterConfigDetail.getSqll());
65 65 }catch (Exception e){
66 66 throw new ServiceException("sql错误");
67 67 }
... ... @@ -81,7 +81,7 @@ public class ShippingCombinationService {
81 81 }
82 82  
83 83 //根据sql查库存
84   - list=inventoryDetailService.selectBysql(filterConfigDetail.getStatement(),shipmentDetail);
  84 + list=inventoryDetailService.selectBysql(filterConfigDetail.getStatement(),shipmentDetail,filterConfigDetail.getSqll());
85 85 return list;
86 86 }
87 87  
... ... @@ -110,7 +110,7 @@ public class ShippingCombinationService {
110 110 }
111 111  
112 112 //根据sql查库存
113   - list=inventoryDetailService.selectBysql(filterConfigDetail.getStatement(),shipmentDetail);
  113 + list=inventoryDetailService.selectBysql(filterConfigDetail.getStatement(),shipmentDetail,filterConfigDetail.getSqll());
114 114 return list;
115 115 }
116 116  
... ...
src/main/java/com/huaheng/pc/shipment/wave/domain/Wave.java
... ... @@ -9,6 +9,7 @@ import io.swagger.annotations.ApiModelProperty;
9 9 import lombok.Data;
10 10  
11 11 import java.io.Serializable;
  12 +import java.math.BigDecimal;
12 13 import java.util.Date;
13 14  
14 15 @ApiModel(value="com.huaheng.pc.shipment.wave.domain.Wave")
... ... @@ -83,7 +84,7 @@ public class Wave implements Serializable {
83 84 */
84 85 @TableField(value = "totalQty")
85 86 @ApiModelProperty(value="总数量")
86   - private Integer totalQty;
  87 + private BigDecimal totalQty;
87 88  
88 89 /**
89 90 * 波次开始时间
... ...
src/main/resources/application-druid.properties
... ... @@ -2,14 +2,14 @@
2 2 spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
3 3 spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
4 4 # \u4E3B\u5E93
5   -#spring.datasource.druid.master.url=jdbc:mysql://172.16.29.45:3306/wms_v2?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false
  5 +spring.datasource.druid.master.url=jdbc:mysql://172.16.29.45:3306/wms_v2?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false
6 6 #spring.datasource.druid.master.url=jdbc:mysql://172.16.29.45:3306/huahengExample?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false
7   -spring.datasource.druid.master.url=jdbc:mysql://localhost:3306/wms2.0?characterEncoding=utf8&serverTimezone=GMT%2b8
  7 +#spring.datasource.druid.master.url=jdbc:mysql://localhost:3306/wms2.0?characterEncoding=utf8&serverTimezone=GMT%2b8
8 8  
9   -#spring.datasource.druid.master.username=softhuaheng
10   -#spring.datasource.druid.master.password=HHrobot123.
11   -spring.datasource.druid.master.username=root
12   -spring.datasource.druid.master.password=123456
  9 +spring.datasource.druid.master.username=softhuaheng
  10 +spring.datasource.druid.master.password=HHrobot123.
  11 +#spring.datasource.druid.master.username=root
  12 +#spring.datasource.druid.master.password=123456
13 13 # \u4ECE\u5E93
14 14 #spring.datasource.druid.slave.open = true
15 15 #spring.datasource.druid.slave.url=jdbc:mysql://172.16.29.45:3306/huaheng?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false
... ...
src/main/resources/templates/config/configValue/add.html
... ... @@ -64,7 +64,7 @@
64 64 </div>
65 65 <div th:include="include::footer"></div>
66 66 <script type="text/javascript">
67   - var prefix = ctx + "config/company"
  67 + var prefix = ctx + "config/configValue"
68 68 $("#form-configValue-add").validate({
69 69 rules:{
70 70 moduleType:{
... ...
src/main/resources/templates/shipment/shipmentHeader/addWave.html 0 → 100644
  1 +<!DOCTYPE HTML>
  2 +<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
  3 +<meta charset="utf-8">
  4 +<head th:include="include :: header"></head>
  5 +<body>
  6 +<div class="wrapper wrapper-content animated fadeInRight ibox-content">
  7 + <form class="form-horizontal m">
  8 + <div class="form-group">
  9 + <label class="col-sm-3 control-label">请选择:</label>
  10 + <div class="col-sm-8">
  11 + <select id="code" class="form-control"></select>
  12 + </div>
  13 + </div>
  14 + <div class="form-group">
  15 + <div class="form-control-static col-sm-offset-9">
  16 + <input type="button" onclick="reSubmit()" class="btn btn-primary" value="提交">
  17 + <button onclick="$.modal.close()" class="btn btn-danger" type="button">关闭</button>
  18 + </div>
  19 + </div>
  20 + </form>
  21 +</div>
  22 +
  23 +<div th:include="include :: footer"></div>
  24 +</body>
  25 +<script type="text/javascript">
  26 + let prefix = ctx + "shipment/shipmentHeader";
  27 + let url = location.search;
  28 + if (url.indexOf("?") !== -1){
  29 + var ids=url.substr(url.indexOf("?")+5);
  30 + }
  31 + $(function () {
  32 + $.ajax({
  33 + url:prefix+'/waveList',
  34 + type:'post',
  35 + success:function (res) {
  36 + if (res.code === 200) {
  37 + $("#code").children().remove();
  38 + for (let i = 0; i < res.data.length; i++) {
  39 + $("#code").append("<option value='"+res.data[i].code+"'>"+res.data[i].name+"</option>")
  40 + }
  41 + }
  42 + else {
  43 + $.modal.msgError(res.msg);
  44 + }
  45 + }
  46 + })
  47 + });
  48 + function reSubmit() {
  49 + let code=$("#code option:selected").val();
  50 + $.ajax({
  51 + url:prefix+'/addWave',
  52 + type:'post',
  53 + data:{
  54 + ids:ids,
  55 + code:code
  56 + },
  57 + success:function (res) {
  58 + if (res.code === 200) {
  59 + $.modal.msgSuccess("成功!");
  60 + $.modal.close();
  61 + window.parent.loadDetail();
  62 + }
  63 + else {
  64 + $.modal.msgError(res.msg);
  65 + }
  66 + }
  67 + })
  68 + }
  69 +</script>
  70 +</html>
0 71 \ No newline at end of file
... ...
src/main/resources/templates/shipment/shipmentHeader/shipmentHeader.html
... ... @@ -91,10 +91,10 @@
91 91 <!--shiro:hasPermission="shipment:bill:analysis">-->
92 92 <!--<i class="fa fa-plus"></i> 订单分析-->
93 93 <!--</a>-->
94   - <!--<a class="btn btn-outline btn-success btn-rounded" onclick="wave()"-->
95   - <!--shiro:hasPermission="shipment:bill:analysis">-->
96   - <!--<i class="fa fa-plus"></i> 加入波次-->
97   - <!--</a>-->
  94 + <a class="btn btn-outline btn-success btn-rounded" onclick="wave()"
  95 + shiro:hasPermission="shipment:bill:wave">
  96 + <i class="fa fa-plus"></i> 加入波次
  97 + </a>
98 98 </div>
99 99 <table id="bootstrap-table" data-mobile-responsive="true" class="table table-bordered table-hover"></table>
100 100 </div>
... ... @@ -705,23 +705,23 @@
705 705 })
706 706 });
707 707  
708   - // function addzone() {
709   - // let url=prefix_detail+'/addZoneCode?ids=';
710   - // let rows=$("#bootstrap-table-detail").bootstrapTable('getSelections');
711   - // if (rows.length === 0) {
712   - // $.modal.msgWarning("请至少选择一条记录");
713   - // }
714   - // else {
715   - // let ids = "";
716   - // for(let i=0; i<rows.length; i++) {
717   - // ids = ids + rows[i].id + ","
718   - // }
719   - // ids = ids.substring(0, ids.length-1);
720   - // url=url+ids;
721   - // $.modal.open("分配库区",url,800,250)
722   - // }
723   - // }
724   - //
  708 + function wave() {
  709 + let url=prefix+'/wave?ids=';
  710 + let rows=$("#bootstrap-table").bootstrapTable('getSelections');
  711 + if (rows.length === 0) {
  712 + $.modal.msgWarning("请至少选择一条记录");
  713 + }
  714 + else {
  715 + let ids = "";
  716 + for(let i=0; i<rows.length; i++) {
  717 + ids = ids + rows[i].id + ","
  718 + }
  719 + ids = ids.substring(0, ids.length-1);
  720 + url=url+ids;
  721 + $.modal.open("加入波次",url,800,250)
  722 + }
  723 + }
  724 +
725 725 // //自动分配库区
726 726 // function autoZone() {
727 727 // let code=$("#shipmentCode").val();
... ...