| | |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.*; |
| | | import com.zy.asrs.entity.param.CheckTaskListParam; |
| | | import com.zy.asrs.entity.param.OpenAdjustmentOrderParam; |
| | | import com.zy.asrs.entity.param.OrderDomainParam; |
| | | import com.zy.asrs.entity.result.CheckOrderExportDTO; |
| | | import com.zy.asrs.enums.CheckStatusEnum; |
| | | import com.zy.asrs.enums.OrderTypeEnum; |
| | | import com.zy.asrs.service.*; |
| | | import com.core.annotations.ManagerAuth; |
| | |
| | | private SnowflakeIdWorker snowflakeIdWorker; |
| | | @Autowired |
| | | private DocTypeService docTypeService; |
| | | @Autowired |
| | | private OpenService openService; |
| | | |
| | | @PostMapping(value = "/checkOrder/pdaComplete/auth") |
| | | @ManagerAuth(memo = "pda:完成盘点") |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | @PostMapping(value = "/adjustOrder/create/test") |
| | | @ManagerAuth(memo = "内部测试:生成调整单") |
| | | public R adjustOrderCreateTest(@RequestParam("orderId") Long orderId) { |
| | | CheckOrder checkOrder = checkOrderService.selectById(orderId); |
| | | List<CheckOrderDetl> checkOrderDetls = checkOrderDetlService.selectList(new EntityWrapper<CheckOrderDetl>().eq("order_id", orderId)); |
| | | checkOrderDetls.forEach(checkOrderDetl -> { checkOrderDetl.setStatus(1);}); |
| | | OpenAdjustmentOrderParam openAdjustmentOrderParam = new OpenAdjustmentOrderParam(); |
| | | openAdjustmentOrderParam.setOrderTime(DateUtils.convert(new Date())); |
| | | openAdjustmentOrderParam.setOrderDetails(checkOrderDetls); |
| | | |
| | | openService.adjustmentOrderCreate(openAdjustmentOrderParam); |
| | | |
| | | return R.ok(); |
| | | |
| | | } |
| | | |
| | | @PostMapping(value = "/adjustOrder/complete/auth") |
| | | @ManagerAuth(memo = "完成调整单") |
| | | public R adjustOrderComplete(@RequestParam("orderId") Long orderId) { |
| | | checkOrderService.adjustOrderComplete(orderId,getUserId()); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | import com.core.common.Cools;import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import com.core.common.SpringUtils; |
| | | import com.zy.asrs.enums.CheckStatusEnum; |
| | | import com.zy.asrs.service.OrderService; |
| | | import com.zy.asrs.entity.Order; |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | |
| | | /** |
| | | * 状态 1: 未生成 0: 禁用 2:待盘 3:已盘 |
| | | */ |
| | | @ApiModelProperty(value= "状态 1: 未生成 0: 禁用 2:待盘 3:已盘 4:待调整 5:已调整") |
| | | @ApiModelProperty(value= "状态 1: 未生成 0: 禁用 2:待盘 3:已盘 4:允许 5:禁止 6:已修改") |
| | | private Integer status; |
| | | |
| | | /** |
| | |
| | | |
| | | public String getStatus$(){ |
| | | if (null == this.status){ return null; } |
| | | switch (this.status){ |
| | | case 1: |
| | | return "未生成"; |
| | | case 0: |
| | | return "禁用"; |
| | | case 2: |
| | | return "待盘"; |
| | | case 3: |
| | | return "已盘"; |
| | | case 4: |
| | | return "待调整"; |
| | | case 5: |
| | | return "已调整"; |
| | | default: |
| | | return String.valueOf(this.status); |
| | | } |
| | | String descByType = CheckStatusEnum.getDescByType(this.status); |
| | | if (Cools.isEmpty(descByType)){ return "未定义"; } |
| | | return descByType; |
| | | } |
| | | |
| | | public String getCreateBy$(){ |
| | |
| | | |
| | | |
| | | public BigDecimal getBookQty() { |
| | | if (diffQty.compareTo(BigDecimal.ZERO) == 0 || diffQty.compareTo(BigDecimal.ZERO) > 0) { |
| | | return new BigDecimal(anfme.toString()); |
| | | |
| | | if (diffQty.compareTo(BigDecimal.ZERO) == 0 ) { |
| | | return BigDecimal.ZERO; |
| | | } |
| | | if ( diffQty.compareTo(BigDecimal.ZERO) > 0) { |
| | | return new BigDecimal(anfme.toString()); |
| | | } |
| | | return new BigDecimal(anfme.toString()).subtract(diffQty); |
| | | } |
| New file |
| | |
| | | package com.zy.asrs.enums; |
| | | |
| | | public enum CheckStatusEnum { |
| | | //状态 1: 未生成 0: 禁用 2:待盘 3:已盘 |
| | | NO_CREATE(1, "未生成"), |
| | | DISABLED(0, "禁用"), |
| | | WAIT_CHECK(2, "待盘"), |
| | | CHECKED(3, "已盘"), |
| | | |
| | | //调整单 |
| | | ALLOW(4, "允许"), |
| | | FORBID(5, "禁止"), |
| | | MODIFIED(6, "已修改"); |
| | | |
| | | |
| | | |
| | | public final Integer type; |
| | | |
| | | public final String desc; |
| | | |
| | | CheckStatusEnum(Integer type, String desc) { |
| | | this.type = type; |
| | | this.desc = desc; |
| | | } |
| | | public static String getDescByType(Integer type) { |
| | | for (CheckStatusEnum value : CheckStatusEnum.values()) { |
| | | if (value.type.equals(type)) { |
| | | return value.desc; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | } |
| | |
| | | List<CheckOrderDetl> getTaskList(String barcode); |
| | | |
| | | R pdaComplete(CheckTaskListParam checkTaskListParam); |
| | | |
| | | void adjustOrderComplete(Long orderId, Long userId); |
| | | } |
| | |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.*; |
| | | import com.zy.asrs.entity.param.CheckTaskListParam; |
| | | import com.zy.asrs.enums.CheckStatusEnum; |
| | | import com.zy.asrs.mapper.CheckOrderMapper; |
| | | import com.zy.asrs.service.*; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Service("checkOrderService") |
| | |
| | | |
| | | return R.ok(); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void adjustOrderComplete(Long orderId, Long userId) { |
| | | CheckOrder checkOrder = this.selectById(orderId); |
| | | if (Cools.isEmpty(checkOrder)) { |
| | | throw new CoolException("数据错误"); |
| | | } |
| | | List<CheckOrderDetl> selectList = checkOrderDetlService.selectList(new EntityWrapper<CheckOrderDetl>().eq("order_id", orderId)); |
| | | for (CheckOrderDetl checkOrderDetl : selectList) { |
| | | |
| | | LocDetl locDetl = locDetlService.selectById(checkOrderDetl.getLocDetlId()); |
| | | if (Cools.isEmpty(locDetl)) { |
| | | throw new CoolException("未找到库存数据,数据错误"); |
| | | } |
| | | if (checkOrderDetl.getStatus().equals(CheckStatusEnum.ALLOW.type)) { |
| | | BigDecimal decimal = locDetl.getBookQty().add(checkOrderDetl.getDiffQty()); |
| | | locDetl.setAnfme(decimal.doubleValue()); |
| | | }else if (checkOrderDetl.getStatus().equals(CheckStatusEnum.FORBID.type)) { |
| | | if (locDetl.getDiffQty().compareTo(BigDecimal.ZERO) < 0) { |
| | | BigDecimal subtract = new BigDecimal(locDetl.getAnfme().toString()).subtract(locDetl.getDiffQty()); |
| | | locDetl.setAnfme(subtract.doubleValue()); |
| | | } |
| | | } |
| | | |
| | | locDetl.setDiffQty(BigDecimal.ZERO); |
| | | locDetl.setModiTime(new Date()); |
| | | if (!locDetlService.updateById(locDetl)){ |
| | | throw new CoolException("更新库存数据失败"); |
| | | } |
| | | } |
| | | |
| | | checkOrder.setSettle(4L); |
| | | checkOrder.setUpdateTime(new Date()); |
| | | if (!this.updateById(checkOrder)){ |
| | | throw new CoolException("更新调整单状态失败"); |
| | | } |
| | | } |
| | | } |
| | |
| | | import com.zy.asrs.entity.param.*; |
| | | import com.zy.asrs.entity.result.OpenOrderCompeteResult; |
| | | import com.zy.asrs.entity.result.StockVo; |
| | | import com.zy.asrs.enums.CheckStatusEnum; |
| | | import com.zy.asrs.mapper.TagMapper; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.asrs.utils.MatUtils; |
| | |
| | | checkOrderDetl.setAnfme(checkOrderDetl1.getAnfme()); |
| | | checkOrderDetl.setDiffQty(checkOrderDetl1.getDiffQty()); |
| | | checkOrderDetl.setWorkQty(checkOrderDetl1.getWorkQty()); |
| | | checkOrderDetl.setStatus(4); |
| | | checkOrderDetl.setStatus(checkOrderDetl1.getStatus().equals(1)?CheckStatusEnum.ALLOW.type:CheckStatusEnum.FORBID.type); |
| | | checkOrderDetl.setZpallet(locDetl.getZpallet()); |
| | | checkOrderDetl.setCreateTime(now); |
| | | checkOrderDetl.setUpdateTime(now); |
| | |
| | | if (layEvent === 'edit') { |
| | | showEditModel(data); |
| | | }else if (layEvent === 'adjust') { |
| | | pakoutPreview(data.id); |
| | | adjustComplete(data.id); |
| | | }else if (layEvent === 'export') { |
| | | export1(data.id); |
| | | }else if (layEvent === 'del') { |
| | |
| | | } |
| | | |
| | | |
| | | function pakoutPreview(id) { |
| | | function adjustComplete(id) { |
| | | let loadIndex = layer.load(2); |
| | | $.ajax({ |
| | | url: baseUrl + "/checkOrder/preview/auth", |
| | | url: baseUrl + "/adjustOrder/complete/auth", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: { |
| | | orderId: id |
| | |
| | | method: 'POST', |
| | | success: function (res) { |
| | | if (res.code === 200){ |
| | | |
| | | layer.close(loadIndex); |
| | | layer.msg(res.msg, {icon: 1}); |
| | | insTb.reload({where: null}); |
| | | } else if (res.code === 403){ |
| | | top.location.href = baseUrl+"/"; |
| | | } else { |
| | | layer.close(loadIndex); |
| | | layer.msg(res.msg, {icon: 2}) |
| | | } |
| | | } |
| | |
| | | showEditModel(data); |
| | | }else if (layEvent === 'createTask') { |
| | | pakoutPreview(data.id); |
| | | }else if (layEvent === 'createAdjust') { |
| | | createAdjust(data.id); |
| | | }else if (layEvent === 'export') { |
| | | export1(data.id); |
| | | }else if (layEvent === 'del') { |
| | |
| | | }); |
| | | } |
| | | |
| | | function createAdjust(orderId) { |
| | | layer.confirm('确定要生成调整单吗?', { |
| | | shade: .1, |
| | | skin: 'layui-layer-admin' |
| | | }, function (i) { |
| | | layer.close(i); |
| | | layer.load(2); |
| | | $.ajax({ |
| | | url: baseUrl+"/adjustOrder/create/test", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: { |
| | | orderId: orderId |
| | | }, |
| | | method: 'POST', |
| | | success: function (res) { |
| | | layer.closeAll('loading'); |
| | | if (res.code === 200){ |
| | | if (insTbCount === 0) { |
| | | insTb.reload({page: {curr: 1}}); |
| | | } else { |
| | | $(".layui-laypage-btn")[0].click(); |
| | | } |
| | | layer.msg(res.msg, {icon: 1}); |
| | | } else if (res.code === 403){ |
| | | top.location.href = baseUrl+"/"; |
| | | }else { |
| | | layer.msg(res.msg, {icon: 2}); |
| | | } |
| | | } |
| | | }) |
| | | }); |
| | | } |
| | | |
| | | |
| | | function pakoutPreview(id) { |
| | | let loadIndex = layer.load(2); |
| | |
| | | ,{field: 'orderNo', align: 'center',title: '单据编号', hide: true} |
| | | ,{field: 'batch', align: 'center',title: '批号', width: 300, sort:true} |
| | | ,{field: 'anfme', align: 'center',title: '可用数量'} |
| | | ,{field: 'bookQty', align: 'center',title: '账面数量'} |
| | | ,{field: 'diffQty', align: 'center',title: '差异数量', |
| | | templet: function(d) { |
| | | // 根据条件判断字体颜色 |
| | | if (d.diffQty < 0 ) { |
| | | return '<span style="color: #de3434;">' +d.diffQty + '</span>'; |
| | | }else if (d.diffQty > 0){ |
| | | return '<span style="color: #19fa02;">' +d.diffQty + '</span>'; |
| | | } else { |
| | | return '<span">' +d.diffQty + '</span>'; |
| | | } |
| | | }} |
| | | ,{field: 'bookQty', align: 'center',title: '原数量'} |
| | | ,{field: 'zpallet', align: 'center',title: '托盘条码'} |
| | | ,{field: 'specs', align: 'center',title: '规格'} |
| | | ,{field: 'model', align: 'center',title: '代码', hide: true} |
| | |
| | | return '<span">' +d.frozen$ + '</span>'; |
| | | } |
| | | }} |
| | | ,{field: 'diffQty', align: 'center',title: '盘点数量', |
| | | templet: function(d) { |
| | | // 根据条件判断字体颜色 |
| | | if (d.diffQty < 0 ) { |
| | | return '<span style="color: #de3434;">' +d.diffQty + '</span>'; |
| | | }else if (d.diffQty > 0){ |
| | | return '<span style="color: #19fa02;">' +d.diffQty + '</span>'; |
| | | } else { |
| | | return '<span">' +d.diffQty + '</span>'; |
| | | } |
| | | }} |
| | | |
| | | ]; |
| | | |
| | | // cols.push.apply(cols, detlCols); |
| | |
| | | {{# } }} |
| | | {{# if (d.settle == 4) { }} |
| | | <a class="layui-btn layui-btn-primary layui-border-blue layui-btn-xs btn-complete" lay-event="export">导出差异单</a> |
| | | <a class="layui-btn layui-btn-primary layui-btn-xs layui-border" lay-event="createAdjust">生成调整单</a> |
| | | {{# } }} |
| | | </script> |
| | | <!-- 表格操作列 --> |