Commit 3129c018a2d2456408b9d10eee0e978de494895d

Authored by xqs
2 parents f8361ac0 47f5ec80

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

src/main/java/com/huaheng/pc/shipment/shipmentContainerHeader/controller/ShipmentContainerHeaderController.java
... ... @@ -68,7 +68,6 @@ public class ShipmentContainerHeaderController extends BaseController
68 68 .ge(StringUtils.isNotEmpty(createdBegin),ShipmentContainerHeader::getCreated, createdBegin)
69 69 .le(StringUtils.isNotEmpty(createdEnd), ShipmentContainerHeader::getCreated, createdEnd)
70 70 .in(ShipmentContainerHeader::getCompanyCode,ShiroUtils.getCompanyCodeList())
71   - .eq(StringUtils.isNotEmpty(shipmentContainerHeader.getShipmentCode()), ShipmentContainerHeader::getShipmentCode, shipmentContainerHeader.getShipmentCode())
72 71 .eq(StringUtils.isNotEmpty(shipmentContainerHeader.getContainerCode()), ShipmentContainerHeader::getContainerCode, shipmentContainerHeader.getContainerCode())
73 72 .eq(StringUtils.isNotEmpty(shipmentContainerHeader.getLocationCode()), ShipmentContainerHeader::getLocationCode, shipmentContainerHeader.getLocationCode())
74 73 .eq(StringUtils.isNotEmpty(shipmentContainerHeader.getCreatedBy()), ShipmentContainerHeader::getCreatedBy, shipmentContainerHeader.getCreatedBy())
... ...
src/main/java/com/huaheng/pc/shipment/shipmentContainerHeader/domain/ShipmentContainerHeader.java
... ... @@ -99,12 +99,6 @@ public class ShipmentContainerHeader implements Serializable {
99 99 private BigDecimal height;
100 100  
101 101  
102   - /**
103   - * 出库单内部号
104   - */
105   - @TableField(value = "shipmentId")
106   - @ApiModelProperty(value="出库单内部号")
107   - private Integer shipmentId;
108 102  
109 103 /**
110 104 * 货主编码
... ... @@ -141,12 +135,6 @@ public class ShipmentContainerHeader implements Serializable {
141 135 @ApiModelProperty(value="序号")
142 136 private Integer groupIndex;
143 137  
144   - /**
145   - * 波次号
146   - */
147   - @TableField(value = "waveId")
148   - @ApiModelProperty(value="波次号")
149   - private Integer waveId;
150 138  
151 139  
152 140 /**
... ... @@ -156,12 +144,7 @@ public class ShipmentContainerHeader implements Serializable {
156 144 @ApiModelProperty(value="任务已创建?")
157 145 private Integer taskCreated;
158 146  
159   - /**
160   - * 出库单号
161   - */
162   - @TableField(value = "shipmentCode")
163   - @ApiModelProperty(value="出库单号")
164   - private String shipmentCode;
  147 +
165 148  
166 149 /**
167 150 * 周转箱号
... ... @@ -316,8 +299,6 @@ public class ShipmentContainerHeader implements Serializable {
316 299  
317 300 public static final String COL_HEIGHT = "height";
318 301  
319   - public static final String COL_SHIPMENTID = "shipmentId";
320   -
321 302 public static final String COL_COMPANYCODE = "companyCode";
322 303  
323 304 public static final String COL_TOTALQTY = "totalQty";
... ... @@ -328,12 +309,8 @@ public class ShipmentContainerHeader implements Serializable {
328 309  
329 310 public static final String COL_GROUPINDEX = "groupIndex";
330 311  
331   - public static final String COL_WAVEID = "waveId";
332   -
333 312 public static final String COL_TASKCREATED = "taskCreated";
334 313  
335   - public static final String COL_SHIPMENTCODE = "shipmentCode";
336   -
337 314 public static final String COL_TRANSCONTAINERCODE = "transContainerCode";
338 315  
339 316 public static final String COL_OQCBENCH = "oqcBench";
... ... @@ -568,24 +545,6 @@ public class ShipmentContainerHeader implements Serializable {
568 545  
569 546  
570 547 /**
571   - * 获取出库单内部号
572   - *
573   - * @return shipmentId - 出库单内部号
574   - */
575   - public Integer getShipmentId() {
576   - return shipmentId;
577   - }
578   -
579   - /**
580   - * 设置出库单内部号
581   - *
582   - * @param shipmentId 出库单内部号
583   - */
584   - public void setShipmentId(Integer shipmentId) {
585   - this.shipmentId = shipmentId;
586   - }
587   -
588   - /**
589 548 * 获取货主编码
590 549 *
591 550 * @return companyCode - 货主编码
... ... @@ -665,23 +624,6 @@ public class ShipmentContainerHeader implements Serializable {
665 624 this.groupIndex = groupIndex;
666 625 }
667 626  
668   - /**
669   - * 获取波次号
670   - *
671   - * @return waveId - 波次号
672   - */
673   - public Integer getWaveId() {
674   - return waveId;
675   - }
676   -
677   - /**
678   - * 设置波次号
679   - *
680   - * @param waveId 波次号
681   - */
682   - public void setWaveId(Integer waveId) {
683   - this.waveId = waveId;
684   - }
685 627  
686 628 /**
687 629 * 获取任务已创建?
... ... @@ -701,24 +643,6 @@ public class ShipmentContainerHeader implements Serializable {
701 643 this.taskCreated = taskCreated;
702 644 }
703 645  
704   - /**
705   - * 获取出库单号
706   - *
707   - * @return shipmentCode - 出库单号
708   - */
709   - public String getShipmentCode() {
710   - return shipmentCode;
711   - }
712   -
713   - /**
714   - * 设置出库单号
715   - *
716   - * @param shipmentCode 出库单号
717   - */
718   - public void setShipmentCode(String shipmentCode) {
719   - this.shipmentCode = shipmentCode;
720   - }
721   -
722 646 public String getTransContainerCode() {
723 647 return transContainerCode;
724 648 }
... ...
src/main/java/com/huaheng/pc/shipment/shipmentContainerHeader/service/ShipmentContainerHeaderServiceImpl.java
... ... @@ -6,6 +6,8 @@ import com.huaheng.common.exception.service.ServiceException;
6 6 import com.huaheng.common.utils.security.ShiroUtils;
7 7 import com.huaheng.framework.web.domain.AjaxResult;
8 8 import com.huaheng.framework.web.domain.RetCode;
  9 +import com.huaheng.pc.config.container.domain.Container;
  10 +import com.huaheng.pc.config.container.service.ContainerService;
9 11 import com.huaheng.pc.config.location.domain.Location;
10 12 import com.huaheng.pc.config.location.service.LocationService;
11 13 import com.huaheng.pc.config.material.domain.Material;
... ... @@ -40,7 +42,6 @@ import java.util.Map;
40 42 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
41 43 import com.huaheng.pc.shipment.shipmentContainerHeader.domain.ShipmentContainerHeader;
42 44 import com.huaheng.pc.shipment.shipmentContainerHeader.mapper.ShipmentContainerHeaderMapper;
43   -import com.huaheng.pc.shipment.shipmentContainerHeader.service.ShipmentContainerHeaderService;
44 45 import org.springframework.transaction.annotation.Transactional;
45 46  
46 47 @Service
... ... @@ -70,6 +71,8 @@ public class ShipmentContainerHeaderServiceImpl extends ServiceImpl<ShipmentCont
70 71 private WaveService waveService;
71 72 @Autowired
72 73 private ShipmentPreferenceService shipmentPreferenceService;
  74 + @Autowired
  75 + private ContainerService containerService;
73 76  
74 77  
75 78 @Override
... ... @@ -80,6 +83,14 @@ public class ShipmentContainerHeaderServiceImpl extends ServiceImpl<ShipmentCont
80 83  
81 84  
82 85 /**
  86 + * 1.检查基本属性
  87 + * 2.更改库存明细
  88 + * 3.更新单据明细的已出库数量
  89 + * 4.自动判定出库任务状态,根据库存数量减去预定库存相等就是整盘出--预计任务状态
  90 + * 5.增加出库组盘头
  91 + * 6.增加出库组盘明细
  92 + * 7.更新单据状态
  93 + *
83 94 * 出库组盘单条保存
84 95 * @param shipmentCombinationModel
85 96 * @return
... ... @@ -88,6 +99,7 @@ public class ShipmentContainerHeaderServiceImpl extends ServiceImpl<ShipmentCont
88 99 @Override
89 100 public ShipmentContainerHeader combination(ShipmentCombinationModel shipmentCombinationModel) {
90 101  
  102 + //1.检查基本属性
91 103 //校验
92 104 if(shipmentCombinationModel.getShipQty().compareTo(new BigDecimal("0")) <= 0){
93 105 throw new ServiceException("出库数量必须大于0");
... ... @@ -116,8 +128,9 @@ public class ShipmentContainerHeaderServiceImpl extends ServiceImpl&lt;ShipmentCont
116 128 lambdaQueryWrapper.eq(Location::getWarehouseCode,inventoryDetail.getWarehouseCode())
117 129 .eq(Location::getCode,inventoryDetail.getLocationCode());
118 130 Location location = locationService.getOne(lambdaQueryWrapper);
119   - if (location == null)
120   - throw new ServiceException("库位 "+ inventoryDetail.getLocationCode() +" 不存在");
  131 + if (location == null) {
  132 + throw new ServiceException("库位 " + inventoryDetail.getLocationCode() + " 不存在");
  133 + }
121 134 // if (location.getStatus().equals("lock")) {
122 135 // //如果库位状态是锁定的话,就查找出库组盘表,如果存在未下发
123 136 // LambdaQueryWrapper<ShipmentContainerHeader> lam=Wrappers.lambdaQuery();
... ... @@ -130,7 +143,7 @@ public class ShipmentContainerHeaderServiceImpl extends ServiceImpl&lt;ShipmentCont
130 143 // }
131 144 // }
132 145  
133   - //更新库存分配数
  146 + //2.更新库存分配数
134 147 inventoryDetail.setTaskQty(inventoryDetail.getTaskQty().add(shipmentCombinationModel.getShipQty()));
135 148 inventoryDetailService.saveOrUpdate(inventoryDetail);
136 149 //获取库位,然后锁定
... ... @@ -138,7 +151,7 @@ public class ShipmentContainerHeaderServiceImpl extends ServiceImpl&lt;ShipmentCont
138 151 location.setStatus("lock");
139 152 locationService.saveOrUpdate(location);
140 153 }
141   - //更新单据明细的已出库数量
  154 + //3.更新单据明细的已出库数量
142 155 shipmentDetail.setRequestQty(shipmentDetail.getRequestQty().add(shipmentCombinationModel.getShipQty()));
143 156 int i = shipmentDetail.getShipQty().compareTo(shipmentDetail.getRequestQty());
144 157 if(i > 0){
... ... @@ -158,25 +171,29 @@ public class ShipmentContainerHeaderServiceImpl extends ServiceImpl&lt;ShipmentCont
158 171 shipmentCombinationModel.setTaskType(400);
159 172 }
160 173  
161   - //增加出库组盘头
162   - ShipmentContainerHeader shipmentContainerHeader = ShipmentContainerHeaderAdd(location, shipmentDetail, shipmentCombinationModel);
163   - //增加出库组盘明细
  174 + //5.增加出库组盘头
  175 + ShipmentContainerHeader shipmentContainerHeader = ShipmentContainerHeaderAdd(location, shipmentDetail);
  176 + //6.增加出库组盘明细
164 177 ShipmentContainerDetail shipmentContainerDetail = ShipmentContainerDetailAdd(shipmentDetail, shipmentContainerHeader, shipmentCombinationModel);
165   - //更新单据状态
  178 + //7.更新单据状态
166 179 shipmentHeaderService.updateShipmentStatus(shipmentDetail.getShipmentId());
167 180  
168 181 return shipmentContainerHeader;
169 182 }
170 183  
171 184 /**
172   - * 在组盘表中查找任务状态小于20的容器,如果状态为0就合并出库明细,状态大于0就提示不能组盘。如果找不到就新增一条组盘表头
  185 + * 组盘头
  186 + * 1.查看是否有状态小于等于20的组盘头,有就需新建组盘头,没有就新建
  187 + * 2.没有符合条件的组盘头,新建组盘头
  188 + *
173 189 * @param location
174   - * @param shipmentCombination
  190 + * @param shipmentDetail
175 191 * @return
176 192 */
177 193 private ShipmentContainerHeader ShipmentContainerHeaderAdd(Location location,
178   - ShipmentDetail shipmentDetail,
179   - ShipmentCombinationModel shipmentCombination) {
  194 + ShipmentDetail shipmentDetail) {
  195 +
  196 + //1.查看是否有状态小于等于20的组盘头,有就需新建组盘头,没有就新建
180 197 LambdaQueryWrapper<ShipmentContainerHeader> lambdaQueryWrapper=Wrappers.lambdaQuery();
181 198 lambdaQueryWrapper.eq(ShipmentContainerHeader::getContainerCode,location.getContainerCode())
182 199 .eq(ShipmentContainerHeader::getWarehouseCode,ShiroUtils.getWarehouseCode())
... ... @@ -186,34 +203,39 @@ public class ShipmentContainerHeaderServiceImpl extends ServiceImpl&lt;ShipmentCont
186 203 return shipmentContainerHeader;
187 204 }
188 205 else {
189   -// LambdaQueryWrapper<ShipmentContainerHeader> lam=Wrappers.lambdaQuery();
190   -// lam.eq(ShipmentContainerHeader::getContainerCode,location.getContainerCode())
191   -// .eq(ShipmentContainerHeader::getWarehouseCode,ShiroUtils.getWarehouseCode())
192   -// .eq(ShipmentContainerHeader::getTaskCreated,0)
193   -// .eq(ShipmentContainerHeader::getStatus,0);
194   -// shipmentContainerHeader = this.getOne(lam);
195   -// if (shipmentContainerHeader == null) {
  206 + // 2.没有符合条件的组盘头,新建组盘头
  207 + //找到容器类型
  208 + LambdaQueryWrapper<Container> containerLam=Wrappers.lambdaQuery();
  209 + containerLam.eq(Container::getCode,location.getContainerCode())
  210 + .eq(Container::getWarehouseCode,ShiroUtils.getWarehouseCode());
  211 + Container container = containerService.getOne(containerLam);
  212 + if(container == null){
  213 + throw new ServiceException("系统没有此容器编码");
  214 + }
196 215 shipmentContainerHeader = new ShipmentContainerHeader();
197 216 shipmentContainerHeader.setContainerCode(location.getContainerCode());
198 217 shipmentContainerHeader.setLocationCode(location.getCode());
199 218 shipmentContainerHeader.setWarehouseCode(ShiroUtils.getWarehouseCode());
200   - //赋值u8仓库
201 219 shipmentContainerHeader.setCompanyCode(shipmentDetail.getCompanyCode());
  220 + shipmentContainerHeader.setContainerType(container.getContainerType());
202 221 shipmentContainerHeader.setStatus(0);
203 222 shipmentContainerHeader.setTaskCreated(0);
204 223 shipmentContainerHeader.setCreatedBy(ShiroUtils.getLoginName());
205   - shipmentContainerHeader.setCreated(null);
206   -// Material material=new Material();
207   -// material.setCode(shipmentDetail.getMaterialCode());
208   -// shipmentContainerHeader.setZoneCode(materialService.selectFirstEntity(material).getZoneCode());
209   - this.save(shipmentContainerHeader);
  224 + Boolean flag = this.save(shipmentContainerHeader);
  225 + if(flag == false){
  226 + throw new ServiceException("新建组盘头失败,sql错误");
  227 + }
210 228 return shipmentContainerHeader;
211 229 }
212   -// }
213 230 }
214 231  
215 232 /**
216   - * 查询 容器编码、库存Id、出库明细Id 一致的组盘明细,如果存在则增加组盘数量,如果不存在就新增一条组盘明细
  233 + * 组盘明细
  234 + * 1.查看是否有同一出库明细的物料需要出库
  235 + * 2.有时修改阻盘明细的出库数量就行
  236 + * 3.没有就新建明细
  237 + * 4。查看组盘头状态,如果状态在10到20,则生成任务明细或修改任务明细的数量
  238 + *
217 239 * @param shipmentDetail
218 240 * @param shipmentContainerHeader
219 241 * @param shipmentCombinationModel
... ... @@ -222,46 +244,63 @@ public class ShipmentContainerHeaderServiceImpl extends ServiceImpl&lt;ShipmentCont
222 244 private ShipmentContainerDetail ShipmentContainerDetailAdd(ShipmentDetail shipmentDetail,
223 245 ShipmentContainerHeader shipmentContainerHeader,
224 246 ShipmentCombinationModel shipmentCombinationModel) {
  247 +
  248 + Boolean flag =true;
  249 + //1.查看是否有同一出库明细的物料需要出库
225 250 LambdaQueryWrapper<ShipmentContainerDetail> lambdaQueryWrapper=Wrappers.lambdaQuery();
226 251 lambdaQueryWrapper.eq(ShipmentContainerDetail::getShippingContainerId,shipmentContainerHeader.getId())
227 252 .eq(ShipmentContainerDetail::getShipmentDetailId,shipmentCombinationModel.getShipmentDetailId())
228 253 .eq(ShipmentContainerDetail::getWarehouseCode,ShiroUtils.getWarehouseCode());
229 254 ShipmentContainerDetail shipmentContainerDetail = shipmentContainerDetailService.getOne(lambdaQueryWrapper);
  255 + ShipmentContainerDetail shipmentContainerDetaill = new ShipmentContainerDetail();
  256 +
  257 + //2.有时修改阻盘明细的出库数量就行
230 258 if(shipmentContainerDetail != null) {
231 259 shipmentContainerDetail.setQty(shipmentContainerDetail.getQty().add(shipmentCombinationModel.getShipQty()));
232   - shipmentContainerDetailService.saveOrUpdate(shipmentContainerDetail);
  260 + flag=shipmentContainerDetailService.saveOrUpdate(shipmentContainerDetail);
  261 + if(flag == false){
  262 + throw new ServiceException("修改组盘明细失败,sql错误");
  263 + }
233 264 }
234   - else {
235   - //构建明细
  265 + else {
236 266  
  267 + //3.没有就新建明细
237 268 LambdaQueryWrapper<Material> lam=Wrappers.lambdaQuery();
238 269 lam.eq(Material::getCode,shipmentDetail.getMaterialCode())
239 270 .eq(Material::getWarehouseCode,ShiroUtils.getWarehouseCode());
240 271 Material material = materialService.getOne(lam);
241   - if (material == null)
242   - throw new ServiceException("出库单(" + shipmentDetail.getShipmentCode() + ")的物料("+ shipmentDetail.getMaterialCode() +")不存在!");
243   - shipmentContainerDetail = new ShipmentContainerDetail();
244   - shipmentContainerDetail.setWarehouseCode(shipmentContainerHeader.getWarehouseCode());
245   - shipmentContainerDetail.setCompanyCode(shipmentContainerHeader.getCompanyCode());
246   - shipmentContainerDetail.setContainerCode(shipmentContainerHeader.getContainerCode());
247   - shipmentContainerDetail.setLocationCode(shipmentContainerHeader.getLocationCode());
248   - shipmentContainerDetail.setInventoryId(shipmentCombinationModel.getInventoryDetailId());
249   - shipmentContainerDetail.setInventorySts(shipmentDetail.getInventorySts());
250   - shipmentContainerDetail.setShippingContainerId(shipmentContainerHeader.getId());
251   - shipmentContainerDetail.setShipmentCode(shipmentDetail.getShipmentCode());
252   - shipmentContainerDetail.setShipmentId(shipmentDetail.getShipmentId());
253   - shipmentContainerDetail.setShipmentDetailId(shipmentCombinationModel.getShipmentDetailId());
254   - shipmentContainerDetail.setMaterialCode(material.getCode());
255   - shipmentContainerDetail.setMaterialName(material.getName());
256   - shipmentContainerDetail.setMaterialSpec(material.getSpec());
257   - shipmentContainerDetail.setQty(shipmentCombinationModel.getShipQty());
258   - shipmentContainerDetail.setCreated(null);
259   - shipmentContainerDetail.setWaveId(shipmentDetail.getWaveId());
260   - shipmentContainerDetail.setCreatedBy(ShiroUtils.getLoginName());
261   - shipmentContainerDetailService.save(shipmentContainerDetail);
  272 + if (material == null) {
  273 + throw new ServiceException("出库单(" + shipmentDetail.getShipmentCode() + ")的物料(" + shipmentDetail.getMaterialCode() + ")不存在!");
  274 + }
  275 + shipmentContainerDetaill.setWarehouseCode(shipmentContainerHeader.getWarehouseCode());
  276 + shipmentContainerDetaill.setCompanyCode(shipmentContainerHeader.getCompanyCode());
  277 + shipmentContainerDetaill.setContainerCode(shipmentContainerHeader.getContainerCode());
  278 + shipmentContainerDetaill.setLocationCode(shipmentContainerHeader.getLocationCode());
  279 + shipmentContainerDetaill.setInventoryId(shipmentCombinationModel.getInventoryDetailId());
  280 + shipmentContainerDetaill.setInventorySts(shipmentDetail.getInventorySts());
  281 + shipmentContainerDetaill.setShippingContainerId(shipmentContainerHeader.getId());
  282 + shipmentContainerDetaill.setShipmentCode(shipmentDetail.getShipmentCode());
  283 + shipmentContainerDetaill.setShipmentId(shipmentDetail.getShipmentId());
  284 + shipmentContainerDetaill.setShipmentDetailId(shipmentDetail.getId());
  285 + shipmentContainerDetaill.setMaterialCode(shipmentDetail.getMaterialCode());
  286 + shipmentContainerDetaill.setMaterialName(shipmentDetail.getMaterialName());
  287 + shipmentContainerDetaill.setMaterialSpec(shipmentDetail.getMaterialSpec());
  288 + shipmentContainerDetaill.setMaterialUnit(shipmentDetail.getMaterialUnit());
  289 + shipmentContainerDetaill.setQty(shipmentCombinationModel.getShipQty());
  290 + shipmentContainerDetaill.setWaveId(shipmentDetail.getWaveId());
  291 + shipmentContainerDetaill.setTaskCreated(0);
  292 + shipmentContainerDetaill.setBatch(shipmentDetail.getBatch());
  293 + shipmentContainerDetaill.setLot(shipmentDetail.getLot());
  294 + shipmentContainerDetaill.setProjectNo(shipmentDetail.getProjectNo());
  295 + shipmentContainerDetaill.setCreatedBy(ShiroUtils.getLoginName());
  296 + flag = shipmentContainerDetailService.save(shipmentContainerDetail);
  297 + if(flag == false){
  298 + throw new ServiceException("新建组盘明细失败,sql错误");
  299 + }
262 300 }
263 301  
264   - //
  302 + //4.查看组盘头状态,如果状态在10到20,则生成任务明细或修改任务明细的数量
  303 + //查看任务头
265 304 if(shipmentContainerHeader.getStatus()>=10 && shipmentContainerHeader.getStatus()<30){
266 305 LambdaQueryWrapper<TaskHeader> taskHeaderLambdaQueryWrapper=Wrappers.lambdaQuery();
267 306 taskHeaderLambdaQueryWrapper.eq(TaskHeader::getWarehouseCode,shipmentContainerHeader.getWarehouseCode())
... ... @@ -271,33 +310,60 @@ public class ShipmentContainerHeaderServiceImpl extends ServiceImpl&lt;ShipmentCont
271 310 if(taskHeader==null){
272 311 throw new ServiceException("有相同的组盘头,但找不到相应的任务头");
273 312 }
274   - TaskDetail taskDetail = new TaskDetail();
275   - taskDetail.setTaskId(taskHeader.getId());
276   - taskDetail.setInternalTaskType(taskHeader.getInternalTaskType());
277   - taskDetail.setWarehouseCode(taskHeader.getWarehouseCode());
278   - taskDetail.setCompanyCode(taskHeader.getCompanyCode());
279   - taskDetail.setTaskType(taskHeader.getTaskType());
280   - taskDetail.setAllocationId(shipmentContainerDetail.getId());
281   - taskDetail.setBillCode(shipmentContainerDetail.getShipmentCode());
282   - taskDetail.setBillDetailId(shipmentContainerDetail.getShipmentDetailId());
283   - taskDetail.setMaterialCode(shipmentContainerDetail.getMaterialCode());
284   - taskDetail.setMaterialName(shipmentContainerDetail.getMaterialName());
285   - taskDetail.setMaterialSpec(shipmentContainerDetail.getMaterialSpec());
286   - taskDetail.setMaterialUnit(shipmentContainerDetail.getMaterialUnit());
287   - taskDetail.setFromInventoryId(shipmentContainerDetail.getInventoryId());
288   - taskDetail.setQty(shipmentContainerDetail.getQty());
289   - taskDetail.setContainerCode(taskHeader.getContainerCode());
290   - taskDetail.setFromLocation(taskHeader.getFromLocation());
291   - taskDetail.setToLocation(taskHeader.getToLocation());
292   - if(shipmentContainerHeader.getStatus()==10) {
293   - taskDetail.setStatus(0);
  313 +
  314 + if(shipmentContainerDetaill == null) {
  315 + //shipmentContainerDetaill为空时,说明组盘明细不是新建,so修改任务明细
  316 + //查找任务明细
  317 + LambdaQueryWrapper<TaskDetail> taskDetailLam = Wrappers.lambdaQuery();
  318 + taskDetailLam.eq(TaskDetail::getWarehouseCode,shipmentContainerDetail.getWarehouseCode())
  319 + .eq(TaskDetail::getAllocationId,shipmentContainerDetail.getId())
  320 + .eq(TaskDetail::getTaskId,taskHeader.getId())
  321 + .eq(TaskDetail::getInternalTaskType,200);
  322 + TaskDetail taskDetail = taskDetailService.getOne(taskDetailLam);
  323 + if(taskDetail == null){
  324 + throw new ServiceException("找不到对应的任务明细");
  325 + }
  326 + taskDetail.setQty(taskDetail.getQty().add(shipmentCombinationModel.getShipQty()));
  327 + flag=taskDetailService.saveOrUpdate(taskDetail);
  328 + if(flag == false){
  329 + throw new ServiceException("修改任务明细失败,sql错误");
  330 + }
294 331 }else {
295   - taskDetail.setStatus(10);
  332 + //shipmentContainerDetaill不为空时,说明组盘明细是新建,so新建任务明细
  333 + TaskDetail taskDetail = new TaskDetail();
  334 + taskDetail.setTaskId(taskHeader.getId());
  335 + taskDetail.setInternalTaskType(taskHeader.getInternalTaskType());
  336 + taskDetail.setWarehouseCode(taskHeader.getWarehouseCode());
  337 + taskDetail.setCompanyCode(taskHeader.getCompanyCode());
  338 + taskDetail.setTaskType(taskHeader.getTaskType());
  339 + taskDetail.setAllocationId(shipmentContainerDetaill.getId());
  340 + taskDetail.setBillCode(shipmentContainerDetaill.getShipmentCode());
  341 + taskDetail.setBillDetailId(shipmentContainerDetaill.getShipmentDetailId());
  342 + taskDetail.setMaterialCode(shipmentContainerDetaill.getMaterialCode());
  343 + taskDetail.setMaterialName(shipmentContainerDetaill.getMaterialName());
  344 + taskDetail.setMaterialSpec(shipmentContainerDetaill.getMaterialSpec());
  345 + taskDetail.setMaterialUnit(shipmentContainerDetaill.getMaterialUnit());
  346 + taskDetail.setFromInventoryId(shipmentContainerDetaill.getInventoryId());
  347 + taskDetail.setQty(shipmentContainerDetaill.getQty());
  348 + taskDetail.setContainerCode(taskHeader.getContainerCode());
  349 + taskDetail.setFromLocation(taskHeader.getFromLocation());
  350 + taskDetail.setToLocation(taskHeader.getToLocation());
  351 + taskDetail.setLot(shipmentContainerDetaill.getLot());
  352 + taskDetail.setWaveId(shipmentContainerDetaill.getWaveId());
  353 + taskDetail.setBatch(shipmentContainerDetaill.getBatch());
  354 + taskDetail.setProjectNo(shipmentContainerDetail.getProjectNo());
  355 + if (shipmentContainerHeader.getStatus() == 10) {
  356 + taskDetail.setStatus(0);
  357 + } else {
  358 + taskDetail.setStatus(10);
  359 + }
  360 + taskDetail.setCreatedBy(ShiroUtils.getLoginName());
  361 + taskDetail.setLastUpdatedBy(ShiroUtils.getLoginName());
  362 + flag = taskDetailService.save(taskDetail);
  363 + if(flag == false){
  364 + throw new ServiceException("新建任务明细失败,sql错误");
  365 + }
296 366 }
297   - taskDetail.setTaskType(taskHeader.getTaskType());
298   - taskDetail.setLastUpdatedBy(ShiroUtils.getLoginName());
299   - taskDetail.setLastUpdated(null);
300   - taskDetailService.save(taskDetail);
301 367 }
302 368 return shipmentContainerDetail;
303 369 }
... ...
src/main/java/com/huaheng/pc/task/taskHeader/service/TaskHeaderServiceImpl.java
... ... @@ -203,6 +203,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea
203 203 @Override
204 204 @Transactional
205 205 public AjaxResult createTaskFromShipmentContainers(ShipmentTaskCreateModel shipmentTaskCreateModel) {
  206 + Boolean flag = true;
206 207 Integer shipmentContainerHeaderId = shipmentTaskCreateModel.getShipmentContainerHeaderIds();
207 208 //获取表头
208 209 ShipmentContainerHeader shipmentContainerHeader = shipmentContainerHeaderService.getById(shipmentContainerHeaderId);
... ... @@ -235,13 +236,12 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea
235 236 task.setFromLocation(shipmentContainerHeader.getLocationCode());
236 237 task.setToLocation(shipmentContainerHeader.getLocationCode());
237 238 //判断是否整出任务,钱柜和AGV不能整出
238   - if (shipmentContainerHeader.getStatus().intValue() == 300) {
  239 +
239 240 //表示整出优先
240 241 //判断当前子货箱所有数量是否等于该托盘对应的所有库存的数量,
241 242 //这里必须与库存的在库数量对比,后期可能存在一个配盘在执行任务,后一个配盘又在配这个的情况(这个时候不能整出)
242 243 // 如果相等,则说明这个货箱包含了所有的数量,则可以整出,否则,创建拣选任务;
243 244 //查询所有库存
244   - InventoryDetail inventoryCondition = new InventoryDetail();
245 245 LambdaQueryWrapper<InventoryDetail> inventoryDetailLambdaQueryWrapper = Wrappers.lambdaQuery();
246 246 inventoryDetailLambdaQueryWrapper.eq(InventoryDetail::getLocationCode, shipmentContainerHeader.getLocationCode())
247 247 .eq(InventoryDetail::getWarehouseCode, ShiroUtils.getWarehouseCode());
... ... @@ -258,7 +258,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea
258 258 task.setTaskType(300);//整盘出库
259 259 task.setToLocation("");
260 260 }
261   - }
  261 +
262 262 task.setInternalTaskType(200);
263 263 task.setAllocationHeadId(shipmentContainerHeader.getId());
264 264 task.setWarehouseCode(shipmentContainerHeader.getWarehouseCode());
... ... @@ -293,19 +293,32 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea
293 293 taskDetail.setContainerCode(task.getContainerCode());
294 294 taskDetail.setFromLocation(task.getFromLocation());
295 295 taskDetail.setToLocation(task.getToLocation());
  296 + taskDetail.setLot(shipmentContainerDetail.getLot());
  297 + taskDetail.setBatch(shipmentContainerDetail.getBatch());
  298 + taskDetail.setProjectNo(shipmentContainerDetail.getProjectNo());
296 299 taskDetail.setStatus(0);
297 300 taskDetail.setWaveId(shipmentContainerDetail.getWaveId());
298 301 taskDetail.setInventorySts(shipmentContainerDetail.getInventorySts());
299   - taskDetail.setTaskType(task.getTaskType());
  302 + taskDetail.setCreatedBy(ShiroUtils.getLoginName());
300 303 taskDetail.setLastUpdatedBy(ShiroUtils.getLoginName());
301   - taskDetail.setLastUpdated(null);
302   - taskDetailService.save(taskDetail);
  304 + flag=taskDetailService.save(taskDetail);
  305 + if(flag == false){
  306 + throw new ServiceException("新建任务明细失败,sql报错");
  307 + }
  308 +
  309 + shipmentContainerDetail.setStatus(10);
303 310 }
304 311 //更新货位状态
305   - ShipmentContainerHeader record = new ShipmentContainerHeader();
306   - record.setId(shipmentContainerHeaderId);
307   - record.setStatus(10);
308   - shipmentContainerHeaderService.saveOrUpdate(record);
  312 + shipmentContainerHeader.setStatus(10);
  313 + flag = shipmentContainerHeaderService.updateById(shipmentContainerHeader);
  314 + if(flag == false){
  315 + throw new ServiceException("修改组盘头状态失败,sql报错");
  316 + }
  317 +
  318 + flag = shipmentContainerDetailService.updateBatchById(shipmentContainerDetails);
  319 + if(flag == false){
  320 + throw new ServiceException("修改组盘明细状态明细失败,sql报错");
  321 + }
309 322 return AjaxResult.success(task.getId());
310 323  
311 324 }
... ... @@ -1227,11 +1240,16 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea
1227 1240 inventoryTransaction.setContainerCode(inventoryDetail.getContainerCode());
1228 1241 inventoryTransaction.setTransactionType(20);
1229 1242 inventoryTransaction.setMaterialCode(shipmentDetail.getMaterialCode());
1230   - //inventory.setMaterialName(DataUtils.getString(taskDetail.getMaterialName()));//物料名称
  1243 + inventoryTransaction.setMaterialName(shipmentDetail.getMaterialName());
  1244 + inventoryTransaction.setMaterialSpec(shipmentDetail.getMaterialSpec());
  1245 + inventoryTransaction.setMaterialUnit(shipmentDetail.getMaterialUnit());
1231 1246 inventoryTransaction.setBillCode(taskDetail.getBillCode());
1232 1247 inventoryTransaction.setBillDetailId(shipmentDetail.getId());
1233 1248 inventoryTransaction.setBatch(shipmentDetail.getBatch());
1234 1249 inventoryTransaction.setLot(shipmentDetail.getLot());
  1250 + inventoryTransaction.setProjectNo(shipmentDetail.getProjectNo());
  1251 + inventoryTransaction.setQcCheck(inventoryDetail.getQcCheck());
  1252 + inventoryTransaction.setSupplierCode(inventoryDetail.getSupplierCode());
1235 1253 inventoryTransaction.setManufactureDate(shipmentDetail.getManufactureDate());
1236 1254 inventoryTransaction.setExpirationDate(shipmentDetail.getExpirationDate());
1237 1255 inventoryTransaction.setInventorySts(inventoryDetail.getInventorySts());
... ... @@ -1255,14 +1273,18 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea
1255 1273 containerService.removeByCode(task.getContainerCode());
1256 1274  
1257 1275 //将库位状态改为空闲,如果是整出的对应的容器也清空
1258   - Location locationRecord = new Location();
  1276 +
  1277 + LambdaQueryWrapper<Location> lam=Wrappers.lambdaQuery();
  1278 + lam.eq(Location::getCode,task.getToLocation());
  1279 + Location locationRecord = locationService.getOne(lam);
  1280 + if(lam == null){
  1281 + throw new ServiceException("系统没有"+task.getToLocation()+"库位");
  1282 + }
1259 1283 locationRecord.setStatus("empty");
1260 1284 if(task.getTaskType()==300) {
1261 1285 locationRecord.setContainerCode("");
1262 1286 }
1263   - LambdaUpdateWrapper<Location> locationLambdaUpdateWrapper = Wrappers.lambdaUpdate();
1264   - locationLambdaUpdateWrapper.eq(Location::getCode,task.getToLocation());
1265   - locationService.update(locationLambdaUpdateWrapper);
  1287 + locationService.updateById(locationRecord);
1266 1288 //如果是整出,删掉这个库位上的这个托盘,否则更改托盘状态
1267 1289 Container containerRecord = new Container();
1268 1290 if(task.getTaskType()==300) {
... ... @@ -1286,14 +1308,16 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea
1286 1308 }
1287 1309 }
1288 1310 //设置出库货箱状态为拣货任务完成
1289   - ShipmentContainerDetail shipmentContainerDetail = new ShipmentContainerDetail();
1290   - shipmentContainerDetail.setStatus(30);
1291   - shipmentContainerDetail.setLastUpdated(new Date());
1292   - shipmentContainerDetail.setLastUpdatedBy(ShiroUtils.getLoginName());
1293   - LambdaUpdateWrapper<ShipmentContainerDetail> shipmentContainerDetailLambdaUpdateWrapper = Wrappers.lambdaUpdate();
1294   - shipmentContainerDetailLambdaUpdateWrapper.eq(ShipmentContainerDetail::getId,task.getAllocationHeadId());
1295   - if (! shipmentContainerDetailService.update(shipmentContainerDetail, shipmentContainerDetailLambdaUpdateWrapper)){
1296   - throw new ServiceException("更新组盘明细状态失败");
  1311 + for(TaskDetail taskDetail : taskDetails) {
  1312 + ShipmentContainerDetail shipmentContainerDetail = new ShipmentContainerDetail();
  1313 + shipmentContainerDetail.setStatus(30);
  1314 + shipmentContainerDetail.setLastUpdated(new Date());
  1315 + shipmentContainerDetail.setLastUpdatedBy(ShiroUtils.getLoginName());
  1316 + LambdaUpdateWrapper<ShipmentContainerDetail> shipmentContainerDetailLambdaUpdateWrapper = Wrappers.lambdaUpdate();
  1317 + shipmentContainerDetailLambdaUpdateWrapper.eq(ShipmentContainerDetail::getId, taskDetail.getAllocationId());
  1318 + if (!shipmentContainerDetailService.update(shipmentContainerDetail, shipmentContainerDetailLambdaUpdateWrapper)) {
  1319 + throw new ServiceException("更新组盘明细状态失败");
  1320 + }
1297 1321 }
1298 1322 //设置出库货箱表头状态为拣货任务完成
1299 1323 ShipmentContainerHeader shipmentContainerHeader = new ShipmentContainerHeader();
... ...
src/main/resources/mybatis/shipment/ShipmentContainerHeaderMapper.xml
... ... @@ -14,28 +14,16 @@
14 14 <result column="length" jdbcType="DECIMAL" property="length" />
15 15 <result column="width" jdbcType="DECIMAL" property="width" />
16 16 <result column="height" jdbcType="DECIMAL" property="height" />
17   - <result column="totalValue" jdbcType="DECIMAL" property="totalValue" />
18   - <result column="shipmentId" jdbcType="INTEGER" property="shipmentId" />
19 17 <result column="companyCode" jdbcType="VARCHAR" property="companyCode" />
20 18 <result column="totalQty" jdbcType="INTEGER" property="totalQty" />
21 19 <result column="waybillCode" jdbcType="VARCHAR" property="waybillCode" />
22 20 <result column="groupNum" jdbcType="INTEGER" property="groupNum" />
23 21 <result column="groupIndex" jdbcType="INTEGER" property="groupIndex" />
24   - <result column="waveId" jdbcType="INTEGER" property="waveId" />
25   - <result column="countIndex" jdbcType="INTEGER" property="countIndex" />
26   - <result column="countTotal" jdbcType="INTEGER" property="countTotal" />
27 22 <result column="taskCreated" jdbcType="INTEGER" property="taskCreated" />
28   - <result column="shipmentCode" jdbcType="VARCHAR" property="shipmentCode" />
29   - <result column="transContCode" jdbcType="VARCHAR" property="transContCode" />
30 23 <result column="oqcBench" jdbcType="VARCHAR" property="oqcBench" />
31 24 <result column="oqcBy" jdbcType="VARCHAR" property="oqcBy" />
32 25 <result column="oqcStartAt" jdbcType="TIMESTAMP" property="oqcStartAt" />
33 26 <result column="oqcEndAt" jdbcType="TIMESTAMP" property="oqcEndAt" />
34   - <result column="loadId" jdbcType="INTEGER" property="loadId" />
35   - <result column="cageId" jdbcType="INTEGER" property="cageId" />
36   - <result column="cageCode" jdbcType="VARCHAR" property="cageCode" />
37   - <result column="stagedAt" jdbcType="TIMESTAMP" property="stagedAt" />
38   - <result column="stagedBy" jdbcType="VARCHAR" property="stagedBy" />
39 27 <result column="created" jdbcType="TIMESTAMP" property="created" />
40 28 <result column="createdBy" jdbcType="VARCHAR" property="createdBy" />
41 29 <result column="lastUpdated" jdbcType="TIMESTAMP" property="lastUpdated" />
... ... @@ -44,15 +32,7 @@
44 32 <result column="userDef1" jdbcType="VARCHAR" property="userDef1" />
45 33 <result column="userDef2" jdbcType="VARCHAR" property="userDef2" />
46 34 <result column="userDef3" jdbcType="VARCHAR" property="userDef3" />
47   - <result column="userDef4" jdbcType="VARCHAR" property="userDef4" />
48   - <result column="userDef5" jdbcType="VARCHAR" property="userDef5" />
49   - <result column="userDef6" jdbcType="VARCHAR" property="userDef6" />
50   - <result column="userDef7" jdbcType="VARCHAR" property="userDef7" />
51   - <result column="userDef8" jdbcType="VARCHAR" property="userDef8" />
52 35 <result column="carrierCode" jdbcType="VARCHAR" property="carrierCode" />
53   - <result column="scaledBy" jdbcType="VARCHAR" property="scaledBy" />
54   - <result column="scaledAt" jdbcType="TIMESTAMP" property="scaledAt" />
55   - <result column="storeCode" jdbcType="VARCHAR" property="storeCode" />
56 36 <result column="picUrls" jdbcType="VARCHAR" property="picUrls" />
57 37 <result column="pidIds" jdbcType="VARCHAR" property="pidIds" />
58 38 <result column="actualShipDateTime" jdbcType="TIMESTAMP" property="actualShipDateTime" />
... ... @@ -61,12 +41,9 @@
61 41 <sql id="Base_Column_List">
62 42 <!--@mbg.generated-->
63 43 id, containerCode, warehouseCode, containerType, `enable`, parent, totalWeight, totalVolume,
64   - `length`, width, height, totalValue, shipmentId, companyCode, totalQty, waybillCode,
65   - groupNum, groupIndex, waveId, countIndex, countTotal, taskCreated, shipmentCode,
66   - transContCode, oqcBench, oqcBy, oqcStartAt, oqcEndAt, loadId, cageId, cageCode, stagedAt,
67   - stagedBy, created, createdBy, lastUpdated, lastUpdatedBy, version, userDef1, userDef2,
68   - userDef3, userDef4, userDef5, userDef6, userDef7, userDef8, carrierCode, scaledBy,
69   - scaledAt, storeCode, picUrls, pidIds, actualShipDateTime, systemCreated
  44 + `length`, width, height, totalValue, companyCode, totalQty, waybillCode, groupNum, groupIndex, taskCreated,
  45 + transContCode, oqcBench, oqcBy, oqcStartAt, oqcEndAt, created, createdBy, lastUpdated, lastUpdatedBy, version,
  46 + userDef1, userDef2,userDef3,carrierCode,picUrls, pidIds, actualShipDateTime, systemCreated
70 47 </sql>
71 48  
72 49 <select id="getShipmentContainerMaxAndMinStatusByShipmentID" resultType="java.util.Map">
... ...