| | |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.core.common.DateUtils; |
| | | import zy.cloud.wms.manager.entity.LocDetl; |
| | | import zy.cloud.wms.manager.entity.Node; |
| | | import zy.cloud.wms.manager.entity.ReceiveDetl; |
| | | import zy.cloud.wms.manager.entity.dto.PutShelfDTO; |
| | | import zy.cloud.wms.manager.service.LocDetlService; |
| | | import zy.cloud.wms.manager.service.NodeService; |
| | | import zy.cloud.wms.manager.service.ReceiveDetlService; |
| | | import com.core.annotations.ManagerAuth; |
| | | import com.core.common.BaseRes; |
| | |
| | | |
| | | @Autowired |
| | | private ReceiveDetlService receiveDetlService; |
| | | @Autowired |
| | | private LocDetlService locDetlService; |
| | | @Autowired |
| | | private NodeService nodeService; |
| | | |
| | | @RequestMapping(value = "/receiveDetl/{id}/auth") |
| | | @ManagerAuth |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 上架动作,插入库存明细,更新单据明细 |
| | | * @param putShelfDTO |
| | | * @return |
| | | */ |
| | | @RequestMapping("/receiveDetl/addIn") |
| | | public R addIn(@RequestBody ReceiveDetl receiveDetl){ |
| | | System.out.println("receiveDetl = " + receiveDetl); |
| | | return R.ok(); |
| | | @ManagerAuth |
| | | public R addIn(@RequestBody PutShelfDTO putShelfDTO){ |
| | | /** |
| | | * 控管与数据初始化 |
| | | */ |
| | | if (Cools.isEmpty(putShelfDTO.getId(),putShelfDTO.getBatch(),putShelfDTO.getRemain(),putShelfDTO.getSelect())){ |
| | | return R.error("输入数据有误,请重新输入"); |
| | | } |
| | | Date date = new Date(); |
| | | double remain = Double.parseDouble(putShelfDTO.getRemain()); |
| | | double anfme = Double.parseDouble(putShelfDTO.getAnfme()); |
| | | double inQty = Double.parseDouble(putShelfDTO.getInQty()); |
| | | if (anfme - (remain + inQty) < 0){ |
| | | return R.error("本次入库数量大于所需入库数量"); |
| | | } |
| | | Node targetLoc = nodeService.selectOne(new EntityWrapper<Node>() |
| | | .eq("id", putShelfDTO.getSelect())); |
| | | |
| | | |
| | | /** |
| | | * 更新库存 |
| | | */ |
| | | LocDetl checkLoc = locDetlService.selectOne(new EntityWrapper<LocDetl>() |
| | | .eq("loc_no", targetLoc.getName()) |
| | | .eq("matnr", putShelfDTO.getMatnr()) |
| | | .eq("batch", putShelfDTO.getBatch())); |
| | | if (Cools.isEmpty(checkLoc)) { |
| | | LocDetl locDetl = new LocDetl(); |
| | | locDetl.setHostId(getHostId()); |
| | | locDetl.setLocNo(targetLoc.getName()); |
| | | locDetl.setNodeId(targetLoc.getId()); |
| | | locDetl.setAnfme(remain); |
| | | locDetl.setMatnr(putShelfDTO.getMatnr()); |
| | | locDetl.setMaktx(putShelfDTO.getMaktx()); |
| | | locDetl.setCreateBy(getUserId()); |
| | | locDetl.setCreateTime(date); |
| | | locDetl.setUpdateBy(getUserId()); |
| | | locDetl.setUpdateTime(date); |
| | | locDetl.setBatch(putShelfDTO.getBatch()); |
| | | locDetlService.insert(locDetl); |
| | | }else { |
| | | checkLoc.setAnfme(checkLoc.getAnfme() + remain); |
| | | locDetlService.update(checkLoc,new EntityWrapper<LocDetl>() |
| | | .eq("loc_no", targetLoc.getName()) |
| | | .eq("matnr", putShelfDTO.getMatnr()) |
| | | .eq("batch", putShelfDTO.getBatch())); |
| | | } |
| | | |
| | | /** |
| | | * 反写订单数量 |
| | | */ |
| | | |
| | | ReceiveDetl targetRece = receiveDetlService.selectOne(new EntityWrapper<ReceiveDetl>() |
| | | .eq("id", putShelfDTO.getId())); |
| | | targetRece.setInQty((int) (targetRece.getInQty() + remain)); |
| | | receiveDetlService.update(targetRece,new EntityWrapper<ReceiveDetl>() |
| | | .eq("id",targetRece.getId())); |
| | | return R.ok("添加成功"); |
| | | } |
| | | |
| | | } |
| | |
| | | * 批号 |
| | | */ |
| | | @ApiModelProperty(value= "批号") |
| | | @TableId(value = "batch", type = IdType.INPUT) |
| | | private String batch; |
| | | |
| | | /** |
| | |
| | | if (this.inQty == 0){ |
| | | return "未入库"; |
| | | } |
| | | if (count - inQty != 0){ |
| | | if (anfme - inQty != 0){ |
| | | return "入库中"; |
| | | } |
| | | return "已完成"; |
New file |
| | |
| | | package zy.cloud.wms.manager.entity.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class PutShelfDTO { |
| | | private String id; |
| | | private String anfme; |
| | | private String inQty; |
| | | private String maktx; |
| | | private String matnr; |
| | | private String remain; |
| | | private String select; |
| | | private String batch; |
| | | } |
| | |
| | | {type: 'checkbox'} |
| | | ,{field: 'id', align: 'center',title: 'ID', hide:true} |
| | | ,{field: 'hostId', align: 'center',title: '', hide:true} |
| | | ,{field: 'orderNo', align: 'center',title: '单据编号'} |
| | | ,{field: 'orderId$', align: 'center',title: '订单内码', width: 100} |
| | | ,{field: 'anfme', align: 'center',title: '待上架数量', width: 100} |
| | | ,{field: 'inQty', align: 'center',title: '已上架数量', width: 100} |
| | | ,{field: 'anfme', align: 'center',title: '应入库量', width: 100} |
| | | ,{field: 'inQty', align: 'center',title: '已入库量', width: 100} |
| | | ,{field: 'matnr', align: 'center',title: '商品编码'} |
| | | ,{field: 'maktx', align: 'center',title: '商品名称'} |
| | | ,{field: 'state$', align: 'center',title: '订单状态'} |
| | | ,{field: 'name', align: 'center',title: '名称', hide:true} |
| | | ,{field: 'specs', align: 'center',title: '规格', hide:true} |
| | | ,{field: 'model', align: 'center',title: '型号', hide:true} |
| | |
| | | pageSize: 'limit' |
| | | }, |
| | | parseData: function (res) { |
| | | console.log(res) |
| | | return { |
| | | 'code': res.code, |
| | | 'msg': res.msg, |
| | |
| | | } |
| | | }); |
| | | function startIn(data) { |
| | | |
| | | admin.open({ |
| | | type:1 |
| | | ,area: '600px' |
| | |
| | | form.val('inDetail',data); |
| | | |
| | | form.on('submit(inLoc)',function (data) { |
| | | |
| | | var loc = insXmSel.getValue('valueStr'); |
| | | alert(loc); |
| | | console.log(data); |
| | | // alert(loc); |
| | | console.log(data.field); |
| | | $.ajax({ |
| | | url: baseUrl+"/receiveDetl/addIn" |
| | | ,headers: {'token':localStorage.getItem('token')} |
| | | ,data: data |
| | | // ,data: data.field |
| | | ,data: JSON.stringify(data.field) |
| | | ,contentType:'application/json;charset=UTF-8' |
| | | ,method: 'POST' |
| | | ,success: function (res) { |
| | | console.log(res) |
| | | layer.closeAll(); |
| | | if(res.code === 200){ |
| | | layer.msg(res.msg); |
| | | } |
| | | if (res.code === 500){ |
| | | layer.msg(res.msg); |
| | | } |
| | | } |
| | | }) |
| | | return false; |
| | | }); |
| | |
| | | <div class="layui-row"> |
| | | <div class="layui-col-md6"> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label" >唯一ID: </label> |
| | | <div class="layui-input-block"> |
| | | <input class="layui-input" name="id" placeholder="请输入" disabled> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="layui-col-md6"> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label" >商品名称: </label> |
| | | <div class="layui-input-block"> |
| | | <input class="layui-input" name="maktx" placeholder="请输入" disabled> |
| | |
| | | <div class="layui-col-md6"> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label"> |
| | | 应入数量: |
| | | 应入库量: |
| | | </label> |
| | | <div class="layui-input-block"> |
| | | <input class="layui-input" name="anfme" disabled> |
| | |
| | | <div class="layui-col-md6"> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label"> |
| | | 已入数量: |
| | | 已入库量: |
| | | </label> |
| | | <div class="layui-input-block"> |
| | | <input class="layui-input" name="inQty" disabled> |
| | |
| | | 本次入库量: |
| | | </label> |
| | | <div class="layui-input-block"> |
| | | <input type="number" class="layui-input" name="remain" placeholder="请输入"> |
| | | <input type="number" class="layui-input" name="remain" placeholder="请输入" required> |
| | | </div> |
| | | </div> |
| | | </div> |
| | |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="layui-col-md6"> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label"> |
| | | 批号: |
| | | </label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" class="layui-input" name="batch" placeholder="请输入" required> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <hr class="layui-bg-gray"> |
| | | <div class="layui-form-item text-right"> |
| | | <!-- <button class="layui-btn" lay-filter="recommendIn" lay-submit="">自动入库</button>--> |