Commit fd25da37a1ed46f9a284c3f5c444b96e9d85d91a
1 parent
927652c5
新增越库
Showing
13 changed files
with
270 additions
and
80 deletions
src/main/java/com/huaheng/common/constant/QuantityConstant.java
... | ... | @@ -17,7 +17,7 @@ public class QuantityConstant { |
17 | 17 | * 8、波次状态 |
18 | 18 | * 9、质检状态 |
19 | 19 | * 10、盘点状态 |
20 | - * 11、库存交易类型 | |
20 | + * 11、INVENTORY_TRANSACTION_RECEIPT | |
21 | 21 | * 12、调整单状态 |
22 | 22 | * 13、任务内部类型 |
23 | 23 | * 14、质检单类型 |
... | ... | @@ -61,10 +61,10 @@ public class QuantityConstant { |
61 | 61 | /** 上架 */ |
62 | 62 | public static final Integer RECEIPT_HEADER_SHELF = 300; |
63 | 63 | |
64 | - //过账 | |
64 | + /** 过账*/ | |
65 | 65 | public static final Integer RECEIPT_HEADER_POSTING = 800; |
66 | 66 | |
67 | - //回传 | |
67 | + /** 回传 */ | |
68 | 68 | public static final Integer RECEIPT_HEADER_RETURN = 900; |
69 | 69 | |
70 | 70 | |
... | ... | @@ -274,28 +274,28 @@ public class QuantityConstant { |
274 | 274 | |
275 | 275 | //11、库存交易类型 |
276 | 276 | |
277 | - //入库 | |
277 | + /** 入库 */ | |
278 | 278 | public static final Integer INVENTORY_TRANSACTION_RECEIPT = 10; |
279 | 279 | |
280 | - //出库 | |
280 | + /** 出库 */ | |
281 | 281 | public static final Integer INVENTORY_TRANSACTION_SHIPMENT = 20; |
282 | 282 | |
283 | - //调整入 | |
283 | + /** 调整入 */ | |
284 | 284 | public static final Integer INVENTORY_TRANSACTION_ADJUSTINTO = 30; |
285 | 285 | |
286 | - //调整出 | |
286 | + /** 调整出 */ | |
287 | 287 | public static final Integer INVENTORY_TRANSACTION_ADJUSTOUT = 40; |
288 | 288 | |
289 | - //调整属性 | |
289 | + /** 调整属性 */ | |
290 | 290 | public static final Integer INVENTORY_TRANSACTION_ADJUSTPROPERTIES = 50; |
291 | 291 | |
292 | - //盘点 | |
292 | + /** 盘点 */ | |
293 | 293 | public static final Integer INVENTORY_TRANSACTION_CYCLECOUNT = 60; |
294 | 294 | |
295 | - //移库入 | |
295 | + /** 移库入 */ | |
296 | 296 | public static final Integer INVENTORY_TRANSACTION_TRANSFERINTO = 70; |
297 | 297 | |
298 | - //移库出 | |
298 | + /** 移库出 */ | |
299 | 299 | public static final Integer INVENTORY_TRANSACTION_TRANSFEROUT = 80; |
300 | 300 | |
301 | 301 | |
... | ... |
src/main/java/com/huaheng/pc/config/container/mapper/ContainerMapper.java
... | ... | @@ -18,7 +18,12 @@ public interface ContainerMapper extends BaseMapper<Container> { |
18 | 18 | |
19 | 19 | int addList(@Param("containers") List<Container> containers); |
20 | 20 | |
21 | - | |
22 | 21 | //获得空货架编号 |
23 | 22 | List<Container> selectListShelf(); |
23 | + | |
24 | + /** | |
25 | + * 获取空容器 | |
26 | + * @return | |
27 | + */ | |
28 | + Container emptyContainer(); | |
24 | 29 | } |
25 | 30 | \ No newline at end of file |
... | ... |
src/main/java/com/huaheng/pc/config/container/service/ContainerService.java
src/main/java/com/huaheng/pc/config/container/service/ContainerServiceImpl.java
... | ... | @@ -165,4 +165,9 @@ public class ContainerServiceImpl extends ServiceImpl<ContainerMapper, Container |
165 | 165 | public List<Container> selectListShelf() { |
166 | 166 | return containerMapper.selectListShelf(); |
167 | 167 | } |
168 | + | |
169 | + @Override | |
170 | + public Container emptyContainer() { | |
171 | + return containerMapper.emptyContainer(); | |
172 | + } | |
168 | 173 | } |
... | ... |
src/main/java/com/huaheng/pc/receipt/receiptDetail/service/ReceiptDetailService.java
... | ... | @@ -52,4 +52,11 @@ public interface ReceiptDetailService extends IService<ReceiptDetail>{ |
52 | 52 | List<Integer> insertTodayReceiptDetail(int headerId, List<ReceiptBill> receiptBills, boolean isCompletedQty, String companyCode); |
53 | 53 | |
54 | 54 | AjaxResult updateReceiptHeader(ReceiptHeader receiptHeader); |
55 | + | |
56 | + /** | |
57 | + * 根据入库单头表id查询入库单明细 | |
58 | + * @param id | |
59 | + * @return | |
60 | + */ | |
61 | + List<ReceiptDetail> findByReceiptId(Integer id); | |
55 | 62 | } |
... | ... |
src/main/java/com/huaheng/pc/receipt/receiptDetail/service/ReceiptDetailServiceImpl.java
... | ... | @@ -198,6 +198,13 @@ public class ReceiptDetailServiceImpl extends ServiceImpl<ReceiptDetailMapper, R |
198 | 198 | return AjaxResult.success("入库头表更新成功"); |
199 | 199 | } |
200 | 200 | |
201 | + @Override | |
202 | + public List<ReceiptDetail> findByReceiptId(Integer id) { | |
203 | + LambdaQueryWrapper<ReceiptDetail> queryWrapper = Wrappers.lambdaQuery(); | |
204 | + queryWrapper.eq(ReceiptDetail::getReceiptId, id); | |
205 | + return list(queryWrapper); | |
206 | + } | |
207 | + | |
201 | 208 | /** |
202 | 209 | * 根据流程配置更新入库明细下一流程 |
203 | 210 | * @param receiptDetail |
... | ... |
src/main/java/com/huaheng/pc/receipt/receiptHeader/controller/ReceiptHeaderController.java
... | ... | @@ -313,7 +313,7 @@ public class ReceiptHeaderController extends BaseController { |
313 | 313 | */ |
314 | 314 | @ApiOperation(value="加入订单池 ", notes="加入订单池 ", httpMethod = "POST") |
315 | 315 | @RequiresPermissions("receipt:receiptHeader:addPool") |
316 | - @Log(title = "入库-入库单 ",operating = "加入订单池 ", action = BusinessType.OTHER) | |
316 | + @Log(title = "入库-入库单",operating = "加入订单池 ", action = BusinessType.OTHER) | |
317 | 317 | @PostMapping("/addPool") |
318 | 318 | @ResponseBody |
319 | 319 | public AjaxResult addPool(String ids) { |
... | ... | @@ -322,4 +322,13 @@ public class ReceiptHeaderController extends BaseController { |
322 | 322 | } |
323 | 323 | return AjaxResult.success(receiptHeaderService.addPool(ids)); |
324 | 324 | } |
325 | + | |
326 | + @ApiOperation(value = "越库", notes = "越库", httpMethod = "POST") | |
327 | + @RequiresPermissions("receipt:receiptHeader:cross") | |
328 | + @Log(title = "入库-入库单", operating = "越库", action = BusinessType.OTHER) | |
329 | + @PostMapping("/crossLocation") | |
330 | + @ResponseBody | |
331 | + public AjaxResult crossLocation(String ids) { | |
332 | + return AjaxResult.success(receiptHeaderService.crossLocation(ids)); | |
333 | + } | |
325 | 334 | } |
... | ... |
src/main/java/com/huaheng/pc/receipt/receiptHeader/service/ReceiptHeaderService.java
... | ... | @@ -14,18 +14,32 @@ import com.huaheng.pc.check.checkDetail.service.CheckDetailService; |
14 | 14 | import com.huaheng.pc.check.checkHeader.domain.CheckHeader; |
15 | 15 | import com.huaheng.pc.check.checkHeader.service.CheckHeaderService; |
16 | 16 | import com.huaheng.pc.config.company.service.CompanyService; |
17 | +import com.huaheng.pc.config.container.domain.Container; | |
18 | +import com.huaheng.pc.config.container.service.ContainerService; | |
17 | 19 | import com.huaheng.pc.config.material.service.MaterialService; |
18 | 20 | import com.huaheng.pc.config.receiptType.domain.ReceiptType; |
19 | 21 | import com.huaheng.pc.config.receiptType.service.ReceiptTypeService; |
20 | 22 | import com.huaheng.pc.config.sendMail.service.SendMailService; |
23 | +import com.huaheng.pc.inventory.inventoryDetail.domain.InventoryDetail; | |
24 | +import com.huaheng.pc.inventory.inventoryDetail.service.InventoryDetailService; | |
25 | +import com.huaheng.pc.inventory.inventoryHeader.domain.InventoryHeader; | |
26 | +import com.huaheng.pc.inventory.inventoryHeader.service.InventoryHeaderService; | |
27 | +import com.huaheng.pc.inventory.inventoryTransaction.domain.InventoryTransaction; | |
28 | +import com.huaheng.pc.inventory.inventoryTransaction.service.InventoryTransactionService; | |
21 | 29 | import com.huaheng.pc.receipt.receiptDetail.domain.ReceiptDetail; |
22 | 30 | import com.huaheng.pc.receipt.receiptDetail.service.ReceiptDetailService; |
23 | 31 | import com.huaheng.pc.receipt.receiptHeader.domain.ReceiptHeader; |
24 | 32 | import com.huaheng.pc.receipt.receiptHeader.mapper.ReceiptHeaderMapper; |
33 | +import com.huaheng.pc.shipment.shipmentDetail.domain.ShipmentDetail; | |
34 | +import com.huaheng.pc.shipment.shipmentDetail.service.ShipmentDetailService; | |
35 | +import com.huaheng.pc.shipment.shipmentHeader.domain.ShipmentHeader; | |
36 | +import com.huaheng.pc.shipment.shipmentHeader.service.ShipmentHeaderService; | |
37 | +import org.aspectj.weaver.loadtime.Aj; | |
25 | 38 | import org.springframework.stereotype.Service; |
26 | 39 | import org.springframework.transaction.annotation.Transactional; |
27 | 40 | |
28 | 41 | import javax.annotation.Resource; |
42 | +import java.math.BigDecimal; | |
29 | 43 | import java.text.SimpleDateFormat; |
30 | 44 | import java.util.Arrays; |
31 | 45 | import java.util.Date; |
... | ... | @@ -43,34 +57,39 @@ public class ReceiptHeaderService extends ServiceImpl<ReceiptHeaderMapper, Recei |
43 | 57 | @Resource |
44 | 58 | private CheckDetailService checkDetailService; |
45 | 59 | @Resource |
46 | - private SendMailService sendMailService; | |
60 | + private ShipmentHeaderService shipmentHeaderService; | |
47 | 61 | @Resource |
48 | 62 | private ReceiptHeaderMapper receiptHeaderMapper; |
49 | 63 | @Resource |
50 | - private CompanyService companyService; | |
64 | + private InventoryHeaderService inventoryHeaderService; | |
51 | 65 | @Resource |
52 | - private MaterialService materialService; | |
66 | + private InventoryDetailService inventoryDetailService; | |
67 | + @Resource | |
68 | + private ShipmentDetailService shipmentDetailService; | |
69 | + @Resource | |
70 | + private InventoryTransactionService inventoryTransactionService; | |
53 | 71 | |
54 | 72 | /** |
55 | 73 | * 保存入库单 |
74 | + * | |
56 | 75 | * @param receiptHeader |
57 | 76 | * @return |
58 | 77 | */ |
59 | - public AjaxResult saveReceiptHeader(ReceiptHeader receiptHeader){ | |
78 | + public AjaxResult saveReceiptHeader(ReceiptHeader receiptHeader) { | |
60 | 79 | //根据仓库和货主以及传入单据类型编码判断单据类型是否存在 |
61 | 80 | LambdaQueryWrapper<ReceiptType> lambdaQueryWrapper = Wrappers.lambdaQuery(); |
62 | 81 | lambdaQueryWrapper.eq(ReceiptType::getCode, receiptHeader.getReceiptType()) |
63 | - .eq(ReceiptType::getWarehouseCode,ShiroUtils.getWarehouseCode()) | |
64 | - .eq(ReceiptType::getCompanyCode, receiptHeader.getCompanyCode()); | |
82 | + .eq(ReceiptType::getWarehouseCode, ShiroUtils.getWarehouseCode()) | |
83 | + .eq(ReceiptType::getCompanyCode, receiptHeader.getCompanyCode()); | |
65 | 84 | ReceiptType receiptType = receiptTypeService.getOne(lambdaQueryWrapper); |
66 | - if(receiptType == null) { | |
67 | - throw new ServiceException(ShiroUtils.getWarehouseCode(),receiptHeader.getCompanyCode(),"没有对应的入库单类型"); | |
85 | + if (receiptType == null) { | |
86 | + throw new ServiceException(ShiroUtils.getWarehouseCode(), receiptHeader.getCompanyCode(), "没有对应的入库单类型"); | |
68 | 87 | } |
69 | 88 | |
70 | 89 | //根据单据类型生成单号 |
71 | 90 | String code = createCode(receiptHeader.getReceiptType()); |
72 | - if(StringUtils.isEmpty(code)){ | |
73 | - throw new ServiceException("根据单据类型"+receiptHeader.getReceiptType()+"生成单号失败"); | |
91 | + if (StringUtils.isEmpty(code)) { | |
92 | + throw new ServiceException("根据单据类型" + receiptHeader.getReceiptType() + "生成单号失败"); | |
74 | 93 | } |
75 | 94 | receiptHeader.setCode(code); |
76 | 95 | receiptHeader.setFirstStatus(QuantityConstant.RECEIPT_HEADER_BUILD); |
... | ... | @@ -81,6 +100,7 @@ public class ReceiptHeaderService extends ServiceImpl<ReceiptHeaderMapper, Recei |
81 | 100 | |
82 | 101 | /** |
83 | 102 | * 根据单据类型生成单号 规则:入库单类型 + 年月日 + 5位(排序号 + 1) |
103 | + * | |
84 | 104 | * @param receiptType |
85 | 105 | * @return |
86 | 106 | */ |
... | ... | @@ -91,11 +111,11 @@ public class ReceiptHeaderService extends ServiceImpl<ReceiptHeaderMapper, Recei |
91 | 111 | SimpleDateFormat df = new SimpleDateFormat("yyyyMMdd"); |
92 | 112 | LambdaQueryWrapper<ReceiptHeader> lambda = Wrappers.lambdaQuery(); |
93 | 113 | lambda.select(ReceiptHeader::getCode).eq(ReceiptHeader::getReceiptType, receiptType) |
94 | - .orderByDesc(ReceiptHeader::getId).last("Limit 1"); | |
114 | + .orderByDesc(ReceiptHeader::getId).last("Limit 1"); | |
95 | 115 | //如果指定类型的最后的code存在,并且日期一致。那么 code = 入库单类型 + 年月日 + (排序号 + 1) |
96 | 116 | String maxCode = null; |
97 | 117 | ReceiptHeader receiptHeader = this.getOne(lambda); |
98 | - if ( receiptHeader != null){ | |
118 | + if (receiptHeader != null) { | |
99 | 119 | maxCode = this.getOne(lambda).getCode(); |
100 | 120 | } |
101 | 121 | //todo:隐藏了BUG,请修正。 修改好 去掉todo |
... | ... | @@ -110,6 +130,7 @@ public class ReceiptHeaderService extends ServiceImpl<ReceiptHeaderMapper, Recei |
110 | 130 | |
111 | 131 | /** |
112 | 132 | * 入库预约 |
133 | + * | |
113 | 134 | * @param receiptHeader |
114 | 135 | * @return |
115 | 136 | */ |
... | ... | @@ -120,17 +141,17 @@ public class ReceiptHeaderService extends ServiceImpl<ReceiptHeaderMapper, Recei |
120 | 141 | //更新入库明细流程 |
121 | 142 | for (ReceiptDetail receiptDetail : receiptDetails) { |
122 | 143 | receiptDetail.setProcessStamp(QuantityConstant.RECEIPT_HEADER_RESERVATION.toString()); |
123 | - if (!receiptDetailService.updateById(receiptDetail)){ | |
144 | + if (!receiptDetailService.updateById(receiptDetail)) { | |
124 | 145 | throw new ServiceException("更新入库明细处理标记失败"); |
125 | 146 | } |
126 | 147 | receiptDetail = receiptDetailService.queryflow(receiptDetail); |
127 | - if (!receiptDetailService.updateById(receiptDetail)){ | |
128 | - throw new ServiceException("更新入库明细流程失败"); | |
129 | - } | |
148 | + if (!receiptDetailService.updateById(receiptDetail)) { | |
149 | + throw new ServiceException("更新入库明细流程失败"); | |
150 | + } | |
130 | 151 | } |
131 | 152 | receiptHeader.setLastUpdatedBy(ShiroUtils.getLoginName()); |
132 | 153 | //更新入库单预约时间 |
133 | - if (!this.updateById(receiptHeader)){ | |
154 | + if (!this.updateById(receiptHeader)) { | |
134 | 155 | throw new ServiceException("更新入库单预约时间失败"); |
135 | 156 | } |
136 | 157 | receiptDetailService.updateReceiptHeaderLastStatus(receiptHeader.getId()); |
... | ... | @@ -139,6 +160,7 @@ public class ReceiptHeaderService extends ServiceImpl<ReceiptHeaderMapper, Recei |
139 | 160 | |
140 | 161 | /** |
141 | 162 | * 入库到货 |
163 | + * | |
142 | 164 | * @param id |
143 | 165 | * @return |
144 | 166 | */ |
... | ... | @@ -159,7 +181,7 @@ public class ReceiptHeaderService extends ServiceImpl<ReceiptHeaderMapper, Recei |
159 | 181 | /** |
160 | 182 | * 入库质检 |
161 | 183 | */ |
162 | - public AjaxResult check(Integer id){ | |
184 | + public AjaxResult check(Integer id) { | |
163 | 185 | |
164 | 186 | ReceiptHeader receiptHeader = this.getById(id); |
165 | 187 | LambdaQueryWrapper<ReceiptDetail> receiptDetailLambda = Wrappers.lambdaQuery(); |
... | ... | @@ -170,7 +192,7 @@ public class ReceiptHeaderService extends ServiceImpl<ReceiptHeaderMapper, Recei |
170 | 192 | LambdaQueryWrapper<CheckHeader> checkHeaderLambdaQueryWrapper = Wrappers.lambdaQuery(); |
171 | 193 | checkHeaderLambdaQueryWrapper.eq(CheckHeader::getCode, receiptHeader.getCode()); |
172 | 194 | CheckHeader checkHeaderQuery = checkHeaderService.getOne(checkHeaderLambdaQueryWrapper); |
173 | - if (checkHeaderQuery != null){ | |
195 | + if (checkHeaderQuery != null) { | |
174 | 196 | throw new ServiceException("质检单已生成"); |
175 | 197 | } |
176 | 198 | //创建质检头表 |
... | ... | @@ -184,7 +206,7 @@ public class ReceiptHeaderService extends ServiceImpl<ReceiptHeaderMapper, Recei |
184 | 206 | checkHeader.setCreatedBy(ShiroUtils.getLoginName()); |
185 | 207 | checkHeader.setLastUpdatedBy(ShiroUtils.getLoginName()); |
186 | 208 | |
187 | - if (!checkHeaderService.save(checkHeader)){ | |
209 | + if (!checkHeaderService.save(checkHeader)) { | |
188 | 210 | throw new ServiceException("添加质检头表错误"); |
189 | 211 | } |
190 | 212 | |
... | ... | @@ -211,7 +233,7 @@ public class ReceiptHeaderService extends ServiceImpl<ReceiptHeaderMapper, Recei |
211 | 233 | checkDetail.setCheckBy(ShiroUtils.getLoginName()); |
212 | 234 | checkDetail.setCreatedBy(ShiroUtils.getLoginName()); |
213 | 235 | checkDetail.setLastUpdatedBy(ShiroUtils.getLoginName()); |
214 | - if ( !checkDetailService.save(checkDetail) ){ | |
236 | + if (!checkDetailService.save(checkDetail)) { | |
215 | 237 | throw new ServiceException("保存质检明细失败"); |
216 | 238 | } |
217 | 239 | } |
... | ... | @@ -222,46 +244,47 @@ public class ReceiptHeaderService extends ServiceImpl<ReceiptHeaderMapper, Recei |
222 | 244 | * 提交审核入库单 |
223 | 245 | */ |
224 | 246 | @Transactional |
225 | - public AjaxResult submitReview(String ids){ | |
226 | - String warehouseCode=ShiroUtils.getWarehouseCode(); | |
227 | - if (StringUtils.isEmpty(ids)){ | |
228 | - return AjaxResult.error("仓库:"+warehouseCode+",提交入库单审核,id不能为空"); | |
247 | + public AjaxResult submitReview(String ids) { | |
248 | + String warehouseCode = ShiroUtils.getWarehouseCode(); | |
249 | + if (StringUtils.isEmpty(ids)) { | |
250 | + return AjaxResult.error("仓库:" + warehouseCode + ",提交入库单审核,id不能为空"); | |
229 | 251 | } |
230 | 252 | Integer[] idArray = Convert.toIntArray(ids); |
231 | - for (int i = 0; i<idArray.length; i++){ | |
253 | + for (int i = 0; i < idArray.length; i++) { | |
232 | 254 | ReceiptHeader receiptHeader = this.getById(idArray[i]); |
233 | - if (receiptHeader.getFirstStatus()>QuantityConstant.RECEIPT_HEADER_VERIFYING | |
234 | - ||receiptHeader.getLastStatus()>QuantityConstant.RECEIPT_HEADER_VERIFYING){ | |
235 | - return AjaxResult.error("仓库:"+warehouseCode+",单据号:"+receiptHeader.getCode()+"入库单不需要审核"); | |
255 | + if (receiptHeader.getFirstStatus() > QuantityConstant.RECEIPT_HEADER_VERIFYING | |
256 | + || receiptHeader.getLastStatus() > QuantityConstant.RECEIPT_HEADER_VERIFYING) { | |
257 | + return AjaxResult.error("仓库:" + warehouseCode + ",单据号:" + receiptHeader.getCode() + "入库单不需要审核"); | |
236 | 258 | } |
237 | 259 | LambdaQueryWrapper<ReceiptDetail> lambdaQueryWrapper = Wrappers.lambdaQuery(); |
238 | 260 | lambdaQueryWrapper.eq(ReceiptDetail::getReceiptId, idArray[i]); |
239 | 261 | List<ReceiptDetail> receiptDetailList = receiptDetailService.list(lambdaQueryWrapper); |
240 | - if (receiptDetailList.isEmpty()){ | |
241 | - return AjaxResult.error("仓库:"+warehouseCode+",单据号:"+receiptHeader.getCode()+"入库单没有明细"); | |
262 | + if (receiptDetailList.isEmpty()) { | |
263 | + return AjaxResult.error("仓库:" + warehouseCode + ",单据号:" + receiptHeader.getCode() + "入库单没有明细"); | |
242 | 264 | } |
243 | 265 | receiptHeader.setFirstStatus(QuantityConstant.RECEIPT_HEADER_VERIFYING); |
244 | 266 | receiptHeader.setLastStatus(QuantityConstant.RECEIPT_HEADER_VERIFYING); |
245 | - if (!this.updateById(receiptHeader)){ | |
246 | - throw new ServiceException("仓库:"+warehouseCode+",单据号:"+receiptHeader.getCode()+" 失败"); | |
267 | + if (!this.updateById(receiptHeader)) { | |
268 | + throw new ServiceException("仓库:" + warehouseCode + ",单据号:" + receiptHeader.getCode() + " 失败"); | |
247 | 269 | } |
248 | 270 | } |
249 | - return AjaxResult.success("仓库:"+warehouseCode+",提交审核成功"); | |
271 | + return AjaxResult.success("仓库:" + warehouseCode + ",提交审核成功"); | |
250 | 272 | } |
251 | 273 | |
252 | 274 | /** |
253 | 275 | * 到货通知 |
276 | + * | |
254 | 277 | * @param id |
255 | 278 | * @return |
256 | 279 | */ |
257 | - public AjaxResult arrivalNotice(String id){ | |
280 | + public AjaxResult arrivalNotice(String id) { | |
258 | 281 | LambdaQueryWrapper<ReceiptDetail> lambda = Wrappers.lambdaQuery(); |
259 | 282 | lambda.eq(ReceiptDetail::getReceiptId, id); |
260 | 283 | List<ReceiptDetail> receiptDetails = receiptDetailService.list(lambda); |
261 | 284 | for (ReceiptDetail receiptDetail : receiptDetails) { |
262 | 285 | receiptDetail.setProcessStamp(QuantityConstant.RECEIPT_HEADER_ARRIVAL.toString()); |
263 | 286 | receiptDetailService.updateById(receiptDetail); |
264 | - if (!receiptDetailService.updateById(receiptDetailService.queryflow(receiptDetail))){ | |
287 | + if (!receiptDetailService.updateById(receiptDetailService.queryflow(receiptDetail))) { | |
265 | 288 | throw new ServiceException("更新入库明细处理标记出错"); |
266 | 289 | } |
267 | 290 | receiptDetailService.updateReceiptHeaderLastStatus(receiptDetail.getReceiptId()); |
... | ... | @@ -271,28 +294,29 @@ public class ReceiptHeaderService extends ServiceImpl<ReceiptHeaderMapper, Recei |
271 | 294 | |
272 | 295 | /** |
273 | 296 | * 加入订单池 |
297 | + * | |
274 | 298 | * @param ids 头表id字符串 |
275 | 299 | * @return |
276 | 300 | */ |
277 | 301 | @Transactional |
278 | - public AjaxResult addPool(String ids){ | |
302 | + public AjaxResult addPool(String ids) { | |
279 | 303 | List<Integer> idList = Arrays.asList(Convert.toIntArray(ids)); |
280 | - for (Integer id : idList){ | |
304 | + for (Integer id : idList) { | |
281 | 305 | LambdaQueryWrapper<ReceiptDetail> lambdaQueryWrapper = Wrappers.lambdaQuery(); |
282 | 306 | lambdaQueryWrapper.eq(ReceiptDetail::getReceiptId, id); |
283 | 307 | List<ReceiptDetail> list = receiptDetailService.list(lambdaQueryWrapper); |
284 | - if (list.size() != 0){ | |
285 | - for (ReceiptDetail receiptDetail : list){ | |
286 | - if (Integer.parseInt(receiptDetail.getProcessStamp()) < QuantityConstant.RECEIPT_HEADER_POOL){ | |
308 | + if (list.size() != 0) { | |
309 | + for (ReceiptDetail receiptDetail : list) { | |
310 | + if (Integer.parseInt(receiptDetail.getProcessStamp()) < QuantityConstant.RECEIPT_HEADER_POOL) { | |
287 | 311 | //判断入库明细是否需要审核 |
288 | 312 | ReceiptDetail beforeReceiptDetail = receiptDetailService.queryflow(receiptDetail); |
289 | - if (Integer.parseInt(beforeReceiptDetail.getProcessStamp()) == 5 || Integer.parseInt(beforeReceiptDetail.getProcessStamp()) == 100){ | |
313 | + if (Integer.parseInt(beforeReceiptDetail.getProcessStamp()) == 5 || Integer.parseInt(beforeReceiptDetail.getProcessStamp()) == 100) { | |
290 | 314 | throw new ServiceException("请先提交审核"); |
291 | 315 | } |
292 | 316 | //加入订单池 |
293 | 317 | receiptDetail.setProcessStamp(QuantityConstant.RECEIPT_HEADER_POOL.toString()); |
294 | 318 | ReceiptDetail receiptDetail1 = receiptDetailService.queryflow(receiptDetail); |
295 | - if (!receiptDetailService.updateById(receiptDetail1)){ | |
319 | + if (!receiptDetailService.updateById(receiptDetail1)) { | |
296 | 320 | throw new ServiceException("更新入库明细状态失败"); |
297 | 321 | } |
298 | 322 | } else { |
... | ... | @@ -320,13 +344,10 @@ public class ReceiptHeaderService extends ServiceImpl<ReceiptHeaderMapper, Recei |
320 | 344 | SimpleDateFormat df = new SimpleDateFormat("yyyyMMdd"); |
321 | 345 | String maxCode = receiptHeaderMapper.createCode(receiptType); |
322 | 346 | //如果指定类型的最后的code存在,并且日期一致。那么 code = 入库单类型 + 年月日 + (排序号 + 1) |
323 | - if (maxCode != null && maxCode.substring(maxCode.length() - 13, maxCode.length() - 5).equals(df.format(now))) | |
324 | - { | |
347 | + if (maxCode != null && maxCode.substring(maxCode.length() - 13, maxCode.length() - 5).equals(df.format(now))) { | |
325 | 348 | Integer Count = Integer.valueOf(maxCode.substring(maxCode.length() - 5, maxCode.length())); |
326 | 349 | code = receiptType + df.format(now) + String.format("%05d", Count + 1); |
327 | - } | |
328 | - else | |
329 | - { | |
350 | + } else { | |
330 | 351 | code = receiptType + df.format(now) + "00001"; |
331 | 352 | } |
332 | 353 | ReceiptHeader receiptHeader = new ReceiptHeader(); |
... | ... | @@ -352,6 +373,7 @@ public class ReceiptHeaderService extends ServiceImpl<ReceiptHeaderMapper, Recei |
352 | 373 | |
353 | 374 | /** |
354 | 375 | * 修改回传后状态 |
376 | + * | |
355 | 377 | * @param id |
356 | 378 | * @return |
357 | 379 | */ |
... | ... | @@ -375,4 +397,105 @@ public class ReceiptHeaderService extends ServiceImpl<ReceiptHeaderMapper, Recei |
375 | 397 | } |
376 | 398 | return AjaxResult.success(""); |
377 | 399 | } |
378 | -} | |
400 | + | |
401 | + public AjaxResult crossLocation(String ids) { | |
402 | + String containerCode = "YKR01"; | |
403 | + String locationCode = "YRL01"; | |
404 | + for (Integer id : Convert.toIntArray(ids)) { | |
405 | + ReceiptHeader receiptHeader = this.getById(id); | |
406 | + /* 创建出库单*/ | |
407 | + ShipmentHeader shipmentHeader = new ShipmentHeader(); | |
408 | + shipmentHeader.setWarehouseCode(receiptHeader.getWarehouseCode()); | |
409 | + shipmentHeader.setCompanyCode(receiptHeader.getCompanyCode()); | |
410 | + shipmentHeader.setCode(receiptHeader.getCode()); | |
411 | + shipmentHeader.setFirstStatus(QuantityConstant.SHIPMENT_CONTAINER_BUILD); | |
412 | + shipmentHeader.setLastStatus(QuantityConstant.SHIPMENT_CONTAINER_BUILD); | |
413 | + shipmentHeader.setShipmentType("YK"); | |
414 | + shipmentHeader.setTotalQty(receiptHeader.getTotalQty()); | |
415 | + shipmentHeader.setTotalLines(receiptHeader.getTotalLines()); | |
416 | + if (!shipmentHeaderService.save(shipmentHeader)) { | |
417 | + throw new ServiceException("创建出库单失败"); | |
418 | + } | |
419 | + | |
420 | + List<ReceiptDetail> receiptDetailList = receiptDetailService.findByReceiptId(id); | |
421 | + /* 遍历入库单明细生成出库单与库存交易记录*/ | |
422 | + for (ReceiptDetail receiptDetail : receiptDetailList) { | |
423 | + | |
424 | + /* 创建出库明细*/ | |
425 | + ShipmentDetail shipmentDetail = new ShipmentDetail(); | |
426 | + shipmentDetail.setShipmentId(shipmentHeader.getId()); | |
427 | + shipmentDetail.setWarehouseCode(shipmentHeader.getWarehouseCode()); | |
428 | + shipmentDetail.setCompanyCode(shipmentHeader.getCompanyCode()); | |
429 | + shipmentDetail.setShipmentCode(shipmentHeader.getCode()); | |
430 | + shipmentDetail.setMaterialCode(receiptDetail.getMaterialCode()); | |
431 | + shipmentDetail.setMaterialName(receiptDetail.getMaterialName()); | |
432 | + shipmentDetail.setMaterialSpec(receiptDetail.getMaterialSpec()); | |
433 | + shipmentDetail.setMaterialUnit(receiptDetail.getMaterialUnit()); | |
434 | + shipmentDetail.setShipQty(receiptDetail.getTotalQty()); | |
435 | + shipmentDetail.setRequestQty(BigDecimal.ZERO); | |
436 | + shipmentDetail.setBatch(receiptDetail.getBatch()); | |
437 | + shipmentDetail.setLot(receiptDetail.getLot()); | |
438 | + shipmentDetail.setProjectNo(receiptDetail.getProjectNo()); | |
439 | + shipmentDetail.setManufactureDate(receiptDetail.getManufactureDate()); | |
440 | + shipmentDetail.setExpirationDate(receiptDetail.getExpirationDate()); | |
441 | + shipmentDetail.setAgingDate(receiptDetail.getAgingDate()); | |
442 | + shipmentDetail.setInventorySts(receiptDetail.getInventorySts()); | |
443 | + shipmentDetail.setStatus(QuantityConstant.TASK_STATUS_BUILD); | |
444 | + if (!shipmentDetailService.save(shipmentDetail)) { | |
445 | + throw new ServiceException("创建出库单明细失败"); | |
446 | + } | |
447 | + | |
448 | + InventoryTransaction inventoryTransaction = new InventoryTransaction(); | |
449 | + inventoryTransaction.setWarehouseCode(receiptHeader.getWarehouseCode()); | |
450 | + inventoryTransaction.setCompanyCode(receiptHeader.getCompanyCode()); | |
451 | + inventoryTransaction.setLocationCode(locationCode); | |
452 | + inventoryTransaction.setContainerCode(containerCode); | |
453 | + inventoryTransaction.setTransactionType(QuantityConstant.INVENTORY_TRANSACTION_RECEIPT); | |
454 | + inventoryTransaction.setMaterialCode(receiptDetail.getMaterialCode()); | |
455 | + inventoryTransaction.setMaterialName(receiptDetail.getMaterialName()); | |
456 | + inventoryTransaction.setMaterialSpec(receiptDetail.getMaterialSpec()); | |
457 | + inventoryTransaction.setMaterialUnit(receiptDetail.getMaterialUnit()); | |
458 | + inventoryTransaction.setTaskQty(receiptDetail.getTotalQty()); | |
459 | + inventoryTransaction.setInventorySts(receiptDetail.getInventorySts()); | |
460 | + inventoryTransaction.setReferCode(receiptDetail.getReferCode()); | |
461 | + inventoryTransaction.setReferDetailId(receiptDetail.getReferLineNum()); | |
462 | + inventoryTransaction.setBatch(receiptDetail.getBatch()); | |
463 | + inventoryTransaction.setLot(receiptDetail.getLot()); | |
464 | + inventoryTransaction.setProjectNo(receiptDetail.getProjectNo()); | |
465 | + inventoryTransaction.setQcCheck(receiptDetail.getQcCheck()); | |
466 | + inventoryTransaction.setManufactureDate(receiptDetail.getManufactureDate()); | |
467 | + inventoryTransaction.setExpirationDate(receiptDetail.getExpirationDate()); | |
468 | + inventoryTransaction.setAgingDate(receiptDetail.getAgingDate()); | |
469 | + inventoryTransaction.setAttribute1(receiptDetail.getAttribute1()); | |
470 | + inventoryTransaction.setAttribute2(receiptDetail.getAttribute2()); | |
471 | + inventoryTransaction.setAttribute3(receiptDetail.getAttribute3()); | |
472 | + inventoryTransaction.setBillCode(receiptHeader.getCode()); | |
473 | + inventoryTransaction.setBillDetailId(receiptDetail.getId()); | |
474 | + inventoryTransaction.setSupplierCode(receiptDetail.getSupplierCode()); | |
475 | + if (!inventoryTransactionService.save(inventoryTransaction)) { | |
476 | + throw new ServiceException("保存库存交易记录失败"); | |
477 | + } | |
478 | + inventoryTransaction.setTransactionType(QuantityConstant.INVENTORY_TRANSACTION_SHIPMENT); | |
479 | + inventoryTransaction.setBillCode(shipmentHeader.getCode()); | |
480 | + inventoryTransaction.setBillDetailId(shipmentDetail.getId()); | |
481 | + if (!inventoryTransactionService.save(inventoryTransaction)) { | |
482 | + throw new ServiceException("保存库存交易记录失败"); | |
483 | + } | |
484 | + } | |
485 | + | |
486 | + receiptHeader.setFirstStatus(QuantityConstant.RECEIPT_HEADER_POSTING); | |
487 | + receiptHeader.setLastStatus(QuantityConstant.RECEIPT_HEADER_POSTING); | |
488 | + if (!this.updateById(receiptHeader)) { | |
489 | + throw new ServiceException("更新入库单状态失败"); | |
490 | + } | |
491 | + shipmentHeader.setFirstStatus(QuantityConstant.SHIPMENT_HEADER_COMPLETED); | |
492 | + shipmentHeader.setLastStatus(QuantityConstant.SHIPMENT_HEADER_COMPLETED); | |
493 | + if (!shipmentHeaderService.updateById(shipmentHeader)) { | |
494 | + throw new ServiceException("更新入库单状态失败"); | |
495 | + } | |
496 | + | |
497 | + } | |
498 | + | |
499 | + return AjaxResult.success(); | |
500 | + } | |
501 | +} | |
379 | 502 | \ No newline at end of file |
... | ... |
src/main/java/com/huaheng/pc/shipment/shipmentHeader/domain/ShipmentHeader.java
1 | 1 | package com.huaheng.pc.shipment.shipmentHeader.domain; |
2 | 2 | |
3 | -import com.baomidou.mybatisplus.annotation.IdType; | |
4 | -import com.baomidou.mybatisplus.annotation.TableField; | |
5 | -import com.baomidou.mybatisplus.annotation.TableId; | |
6 | -import com.baomidou.mybatisplus.annotation.TableName; | |
3 | +import com.baomidou.mybatisplus.annotation.*; | |
7 | 4 | import io.swagger.annotations.ApiModel; |
8 | 5 | import io.swagger.annotations.ApiModelProperty; |
9 | 6 | import java.io.Serializable; |
... | ... | @@ -313,28 +310,28 @@ public class ShipmentHeader implements Serializable { |
313 | 310 | /** |
314 | 311 | * 创建时间 |
315 | 312 | */ |
316 | - @TableField(value = "created") | |
313 | + @TableField(value = "created", fill = FieldFill.INSERT) | |
317 | 314 | @ApiModelProperty(value = "创建时间") |
318 | 315 | private Date created; |
319 | 316 | |
320 | 317 | /** |
321 | 318 | * 创建用户 |
322 | 319 | */ |
323 | - @TableField(value = "createdBy") | |
320 | + @TableField(value = "createdBy", fill = FieldFill.INSERT) | |
324 | 321 | @ApiModelProperty(value = "创建用户") |
325 | 322 | private String createdBy; |
326 | 323 | |
327 | 324 | /** |
328 | 325 | * 创建时间 |
329 | 326 | */ |
330 | - @TableField(value = "lastUpdated") | |
327 | + @TableField(value = "lastUpdated", fill = FieldFill.INSERT_UPDATE) | |
331 | 328 | @ApiModelProperty(value = "创建时间") |
332 | 329 | private Date lastUpdated; |
333 | 330 | |
334 | 331 | /** |
335 | 332 | * 更新用户 |
336 | 333 | */ |
337 | - @TableField(value = "lastUpdatedBy") | |
334 | + @TableField(value = "lastUpdatedBy", fill = FieldFill.INSERT_UPDATE) | |
338 | 335 | @ApiModelProperty(value = "更新用户") |
339 | 336 | private String lastUpdatedBy; |
340 | 337 | |
... | ... |
src/main/resources/mybatis/config/ContainerMapper.xml
... | ... | @@ -117,4 +117,8 @@ |
117 | 117 | INNER JOIN ( SELECT DISTINCT ( goodsShelfNo ) goodsShelfNo, COUNT( * ) cunt FROM container WHERE type = 'A' GROUP BY goodsShelfNo ) s ON g.goodsShelfNo = s.goodsShelfNo |
118 | 118 | AND g.cunt = s.cunt |
119 | 119 | </select> |
120 | + | |
121 | + <select id="emptyContainer" resultMap="BaseResultMap"> | |
122 | + select * from container where `status` = "empty" and (locationCode IS NOT NULL OR locationCode = "") ORDER BY id DESC limit 1 | |
123 | + </select> | |
120 | 124 | </mapper> |
121 | 125 | \ No newline at end of file |
... | ... |
src/main/resources/static/huaheng/js/huahengUI.js
... | ... | @@ -66,6 +66,7 @@ var table = { |
66 | 66 | fixedNumber: 0, |
67 | 67 | rightFixedColumns: false, |
68 | 68 | rightFixedNumber: 0, |
69 | + uniqueId: "id", | |
69 | 70 | queryParams: $.table.queryParams, |
70 | 71 | rowStyle: {}, |
71 | 72 | }; |
... | ... | @@ -81,6 +82,7 @@ var table = { |
81 | 82 | cache: false, // 是否使用缓存 |
82 | 83 | height: options.height, // 表格的高度 |
83 | 84 | striped: options.striped, // 是否显示行间隔色 |
85 | + modalName: "", | |
84 | 86 | createUrl: options.createUrl, |
85 | 87 | updateUrl: options.updateUrl, |
86 | 88 | removeUrl: options.removeUrl, |
... | ... | @@ -757,7 +759,7 @@ var table = { |
757 | 759 | parent.layer.close(index); |
758 | 760 | }, |
759 | 761 | // 确认窗体 |
760 | - confirm: function (content, callBack) { | |
762 | + confirm: function (content, callback) { | |
761 | 763 | layer.confirm(content, { |
762 | 764 | icon: 3, |
763 | 765 | title: "系统提示", |
... | ... | @@ -765,11 +767,11 @@ var table = { |
765 | 767 | btnclass: ['btn btn-primary', 'btn btn-danger'], |
766 | 768 | }, function (index) { |
767 | 769 | layer.close(index); |
768 | - callBack(true); | |
770 | + callback(true); | |
769 | 771 | }); |
770 | 772 | }, |
771 | 773 | // 弹出层指定宽度 |
772 | - open: function (title, url, width, height) { | |
774 | + open: function (title, url, width, height, callback) { | |
773 | 775 | //如果是移动端,就使用自适应大小弹窗 |
774 | 776 | if (navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)) { |
775 | 777 | width = 'auto'; |
... | ... | @@ -787,6 +789,12 @@ var table = { |
787 | 789 | if ($.common.isEmpty(height)) { |
788 | 790 | height = ($(window).height() - 50); |
789 | 791 | }; |
792 | + if ($.common.isEmpty(callback)) { | |
793 | + callback = function(index, layero) { | |
794 | + var iframeWin = layero.find('iframe')[0]; | |
795 | + iframeWin.contentWindow.submitHandler(index, layero); | |
796 | + } | |
797 | + } | |
790 | 798 | layer.open({ |
791 | 799 | type: 2, |
792 | 800 | area: [width + 'px', height + 'px'], |
... | ... | @@ -795,7 +803,10 @@ var table = { |
795 | 803 | maxmin: true, |
796 | 804 | shade: 0.3, |
797 | 805 | title: title, |
798 | - content: url | |
806 | + content: url, | |
807 | + // 弹层外区域关闭 | |
808 | + shadeClose: true, | |
809 | + yes: callback | |
799 | 810 | }); |
800 | 811 | }, |
801 | 812 | // 弹出层指定参数选项 |
... | ... | @@ -900,16 +911,22 @@ var table = { |
900 | 911 | // 操作封装处理 |
901 | 912 | operate: { |
902 | 913 | // 提交数据 |
903 | - submit: function(url, type, dataType, data) { | |
914 | + submit: function(url, type, dataType, data, callback) { | |
904 | 915 | $.modal.loading("正在处理中,请稍后..."); |
905 | 916 | var config = { |
906 | 917 | url: url, |
907 | 918 | type: type, |
908 | 919 | dataType: dataType, |
909 | 920 | data: data, |
910 | - success: function(result) { | |
911 | - $.operate.ajaxSuccess(result); | |
912 | - } | |
921 | + beforeSend: function () { | |
922 | + $.modal.loading("正在处理中,请稍后..."); | |
923 | + }, | |
924 | + success: function(result) { | |
925 | + if (typeof callback == "function") { | |
926 | + callback(result); | |
927 | + } | |
928 | + $.operate.ajaxSuccess(result); | |
929 | + } | |
913 | 930 | }; |
914 | 931 | $.ajax(config) |
915 | 932 | }, |
... | ... |
src/main/resources/templates/receipt/receiptHeader/receiptHeader.html
... | ... | @@ -93,6 +93,9 @@ |
93 | 93 | <a class="btn btn-outline btn-primary btn-rounded" onclick="addPool()" shiro:hasPermission="receipt:receiptHeader:addPool"> |
94 | 94 | <i class="fa fa-check-circle"></i> 加入订单池 |
95 | 95 | </a> |
96 | + <a class="btn btn-outline btn-info btn-rounded" onclick="crossLocation()" shiro:hasPermission="receipt:receiptHeader:cross"> | |
97 | + <i class="fa fa-random"></i> 越库 | |
98 | + </a> | |
96 | 99 | <a class="btn btn-outline btn-danger btn-rounded" onclick="$.operate.batRemove()" shiro:hasPermission="receipt:receiptHeader:remove"> |
97 | 100 | <i class="fa fa-trash-o"></i> 删除 |
98 | 101 | </a> |
... | ... | @@ -906,7 +909,6 @@ |
906 | 909 | } |
907 | 910 | |
908 | 911 | function receive(id) { |
909 | - | |
910 | 912 | var url = prefix+"/receive"; |
911 | 913 | var ids = id; |
912 | 914 | var data = { "ids": ids}; |
... | ... | @@ -925,6 +927,13 @@ |
925 | 927 | }; |
926 | 928 | return curParams |
927 | 929 | } |
930 | + | |
931 | + function crossLocation() { | |
932 | + let rows = $.table.selectColumns("id"); | |
933 | + let url = prefix+"/crossLocation"; | |
934 | + let data = { "ids": rows.join()}; | |
935 | + $.operate.submit(url, "post", "json", data); | |
936 | + } | |
928 | 937 | </script> |
929 | 938 | </body> |
930 | 939 | </html> |
931 | 940 | \ No newline at end of file |
... | ... |
src/main/resources/templates/system/menu/menu.html
... | ... | @@ -56,6 +56,7 @@ |
56 | 56 | parentCode: "parentId", |
57 | 57 | expandAll: false, |
58 | 58 | expandFirst: false, |
59 | + modalName:"", | |
59 | 60 | url: prefix + "/list", |
60 | 61 | createUrl: prefix + "/add/{id}", |
61 | 62 | updateUrl: prefix + "/edit/{id}", |
... | ... | @@ -145,7 +146,7 @@ |
145 | 146 | var actions = []; |
146 | 147 | actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> '); |
147 | 148 | actions.push('<a class="btn btn-info btn-xs ' + addFlag + '" href="#" onclick="$.operate.add(\'' + row.id + '\')"><i class="fa fa-plus"></i>新增</a> '); |
148 | - actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="remove(\'' + row.id + '\')"><i class="fa fa-trash-o"></i>删除</a>'); | |
149 | + actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-trash-o"></i>删除</a>'); | |
149 | 150 | return actions.join(''); |
150 | 151 | } |
151 | 152 | }] |
... | ... |