| | |
| | | for (OrderDetl orderDetl : orderDetls) { |
| | | BigDecimal a1 = new BigDecimal(orderDetl.getAnfme()).setScale(2,BigDecimal.ROUND_HALF_UP); |
| | | BigDecimal b1 = new BigDecimal(orderDetl.getQty()).setScale(2,BigDecimal.ROUND_HALF_UP); |
| | | Double c1 = a1.subtract(b1).setScale(2,BigDecimal.ROUND_HALF_UP).doubleValue(); |
| | | double issued = Optional.of( c1 ).orElse(0.0D); |
| | | |
| | | double issued = Optional.of(orderDetl.getAnfme() - orderDetl.getWorkQty()).orElse(0.0D); |
| | | if (issued <= 0.0D) { continue; } |
| | | List<LocDetl> locDetls = locDetlService.queryStock2(orderDetl.getMatnr(), orderDetl.getBatch()); |
| | | for (LocDetl locDetl : locDetls) { |
| | |
| | | sign=true; |
| | | } |
| | | LocDto locDto = new LocDto(locDetl.getLocNo(), locDetl.getMatnr(), locDetl.getMaktx(), locDetl.getBatch(), orderDetl.getOrderNo(), |
| | | sign ? locDetl.getAnfme() : issued,locDetl.getOwner(),locDetl.getPayment()); |
| | | sign ? locDetl.getAnfme() : issued); |
| | | List<Integer> staNos = staDescService.queryOutStaNosByLocNo(locDetl.getLocNo(), sign? 101 : 103); |
| | | // LocDto locDto = new LocDto(locDetl.getLocNo(), locDetl.getMatnr(), locDetl.getMaktx(), locDetl.getBatch(), orderDetl.getOrderNo(), |
| | | // locDetl.getAnfme(), issued < locDetl.getAnfme()? issued : locDetl.getAnfme()); |
| | |
| | | } |
| | | } |
| | | if (issued > 0) { |
| | | LocDto locDto = new LocDto(null, orderDetl.getMatnr(), orderDetl.getMaktx(), orderDetl.getBatch(), orderDetl.getOrderNo(), issued,orderDetl.getOwner(),1); |
| | | LocDto locDto = new LocDto(null, orderDetl.getMatnr(), orderDetl.getMaktx(), orderDetl.getBatch(), orderDetl.getOrderNo(), issued); |
| | | // LocDto locDto = new LocDto(null, orderDetl.getMatnr(), orderDetl.getMaktx(), orderDetl.getBatch(), orderDetl.getOrderNo(), 0.0,issued); |
| | | locDto.setLack(Boolean.TRUE); |
| | | locDtos.add(locDto); |
| | |
| | | manPakOut.setCreateTime(new Date()); |
| | | manPakOut.setBatch(locDto.getBatch()); |
| | | manPakOut.setUpdateTime(new Date()); |
| | | manPakOut.setPayment(locDto.getPayment()); |
| | | manPakOut.setOwner(locDto.getOwner()); |
| | | manPakOut.setUuid(uuid); |
| | | if (Cools.isEmpty(manPakOutService.selectOne(new EntityWrapper<ManPakOut>().eq("doc_num",locDto.getOrderNo())))){ |
| | | manPakOut.setName(locDto.getMaktx()); |
| | |
| | | import com.core.common.R; |
| | | import com.zy.common.web.BaseController; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.*; |
| | |
| | | } |
| | | |
| | | @RequestMapping(value = "/pakout/delete/auth") |
| | | @ManagerAuth |
| | | public R delete(@RequestParam(value="ids[]") Long[] ids){ |
| | | for (Long id : ids){ |
| | | pakoutService.deleteById(id); |
| | | } |
| | | return R.ok(); |
| | | @ManagerAuth(memo = "手动删除订单") |
| | | public R delete(@RequestParam String docNum){ |
| | | pakoutService.deletePakout(docNum); |
| | | return R.ok("拣货单删除成功"); |
| | | } |
| | | |
| | | @RequestMapping(value = "/pakout/export/auth") |
| | |
| | | * 所属项目 |
| | | */ |
| | | @ApiModelProperty(value= "所属项目") |
| | | @TableId(value = "host_id", type = IdType.AUTO) |
| | | @TableField("host_id") |
| | | private Long hostId; |
| | | |
| | |
| | | } |
| | | |
| | | public Double getEnableQty() { |
| | | |
| | | if (null != this.anfme && this.qty != null) { |
| | | return this.anfme - this.qty; |
| | | Double enableQty = null; |
| | | if (null != this.anfme && this.workQty != null) { |
| | | enableQty = this.anfme - this.workQty; |
| | | if (enableQty <0){ |
| | | enableQty = 0.0D; |
| | | } |
| | | return null; |
| | | |
| | | } |
| | | return enableQty; |
| | | } |
| | | |
| | | public void sync(Object source) { |
| | |
| | | |
| | | public interface PakoutService extends IService<Pakout> { |
| | | |
| | | void deletePakout(String docNum); |
| | | } |
| | |
| | | package com.zy.asrs.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.zy.asrs.entity.Order; |
| | | import com.zy.asrs.entity.OrderDetl; |
| | | import com.zy.asrs.mapper.PakoutMapper; |
| | | import com.zy.asrs.entity.Pakout; |
| | | import com.zy.asrs.service.OrderDetlService; |
| | | import com.zy.asrs.service.OrderService; |
| | | import com.zy.asrs.service.PakoutService; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Service("pakoutService") |
| | | public class PakoutServiceImpl extends ServiceImpl<PakoutMapper, Pakout> implements PakoutService { |
| | | @Autowired |
| | | private OrderService orderService; |
| | | |
| | | @Autowired |
| | | private OrderDetlService orderDetlService; |
| | | |
| | | @Override |
| | | public void deletePakout(String docNum) { |
| | | Order order = orderService.selectByNo(docNum); |
| | | List<OrderDetl> orderDetls = orderDetlService.selectList(new EntityWrapper<OrderDetl>().eq("order_no", docNum)); |
| | | |
| | | for (OrderDetl orderDetl: orderDetls){ |
| | | if (orderDetl.getQty() > 0.0){ |
| | | throw new RuntimeException("拣货单已有出库任务,不可删除!"); |
| | | } |
| | | orderDetl.setWorkQty(0.0D); |
| | | } |
| | | |
| | | if (!orderDetlService.updateBatchById(orderDetls)){ |
| | | throw new RuntimeException("订单明细批量更新失败"); |
| | | } |
| | | order.setSettle(1L); |
| | | if (!orderService.updateById(order)){ |
| | | throw new RuntimeException("订单明细批量更新失败"); |
| | | } |
| | | if (!delete(new EntityWrapper<Pakout>().eq("doc_num",docNum))){ |
| | | throw new RuntimeException("拣货单删除失败"); |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | |
| | | |
| | | //实际出库量 |
| | | private Double anfme; |
| | | private int owner; |
| | | private int payment; |
| | | |
| | | |
| | | //所需出库量 |
| | | private Double needQty; |
| | |
| | | this.anfme = anfme; |
| | | } |
| | | |
| | | public LocDto(String locNo, String matnr, String maktx, String batch, String orderNo, Double anfme,int owner ,int payment) { |
| | | public LocDto(String locNo, String matnr, String maktx, String batch, String orderNo, Double anfme) { |
| | | this.locNo = locNo; |
| | | this.matnr = matnr; |
| | | this.maktx = maktx; |
| | | this.batch = batch; |
| | | this.orderNo = orderNo; |
| | | this.anfme = anfme; |
| | | this.owner = owner; |
| | | this.payment = payment; |
| | | |
| | | } |
| | | |
| | | public LocDto(String locNo, String matnr, String maktx, String batch, String orderNo, Double anfme, Double needQty) { |
| | |
| | | ,{field: 'orderNo', align: 'center',title: '单据编号', templet: '#orderNoTpl', width: 160} |
| | | ,{field: 'matnr', align: 'center',title: '商品编码', width: 160} |
| | | ,{field: 'maktx', align: 'center',title: '商品名称', width: 200} |
| | | ,{field: 'owner$', align: 'center',title: '货主'} |
| | | ,{field: 'payment$', align: 'center',title: '货物形态'} |
| | | ,{field: 'owner', align: 'center',title: '货主', hide: true} |
| | | ,{field: 'payment', align: 'center',title: '货物形态', hide: true} |
| | | // ,{field: 'anfme', align: 'center',title: '数量'} |
| | | // ,{field: 'qty', align: 'center',title: '作业数量', style: 'font-weight: bold'} |
| | | ,{field: 'anfme', align: 'center',title: '总数量', style: 'font-weight: bold'} |
| | | ,{field: 'enableQty', align: 'center',title: '待出数量', style: 'font-weight: bold'} |
| | | // ,{field: 'name', align: 'center',title: '名称'} |
| | | // ,{field: 'model', align: 'center',title: '型号'} |
| | | ,{field: 'unit', align: 'center',title: '单位', hide: true} |
| | |
| | | } |
| | | ,yes: function(index, layero){ |
| | | //按钮【立即出库】的回调 |
| | | pakout(tableCache, index); |
| | | //pakout(tableCache, index); |
| | | pakout2(tableCache, index); |
| | | } |
| | | ,btn2: function(index, layero){ |
| | |
| | | var pageCurr; |
| | | var printMatCodeNos = []; |
| | | var ordernoo = "123"; |
| | | var insTbCount = 0; |
| | | layui.config({ |
| | | base: baseUrl + "/static/layui/lay/modules/" |
| | | }).use(['table','laydate', 'form', 'admin', 'layer'], function(){ |
| | |
| | | ,{align: 'center', title: '二维码', toolbar: '#operate', width: 200 , hide:true} |
| | | ,{align: 'center', title: '明细', toolbar: '#tbLook', minWidth: 160, width: 160} |
| | | ,{field: 'status$', align: 'center',title: '状态'} |
| | | ,{field: 'owner$', align: 'center',title: '货主'} |
| | | ,{field: 'payment$', align: 'center',title: '货物形态'} |
| | | // ,{field: 'custName', align: 'center',title: '客户名称', width: 160} |
| | | ,{field: 'createTime$', align: 'center',title: '操作时间'} |
| | | ,{align: 'center', title: '操作', toolbar: '#operate'} |
| | |
| | | case "btnPrint2": |
| | | btnPrint2(data.wrkNo, data.docNum, 4); |
| | | break; |
| | | case "del": |
| | | doDel(data.docNum); |
| | | break; |
| | | case "look": |
| | | var $a = $(obj.tr).find('a[lay-event="look"]'); |
| | | var offset = $a.offset(); |
| | |
| | | ,{field: 'matnr', align: 'center',title: '物料号'} |
| | | ,{field: 'maktx', align: 'center',title: '商品名称'} |
| | | ,{field: 'anfme', align: 'center',title: '数量'} |
| | | ,{field: 'owner$', align: 'center',title: '货主'} |
| | | ,{field: 'payment$', align: 'center',title: '货物形态'} |
| | | ,{field: 'owner', align: 'center',title: '货主', hide:true} |
| | | ,{field: 'payment', align: 'center',title: '货物形态', hide:true} |
| | | ,{field: 'createTime$', align: 'center',title: '操作时间'} |
| | | ,{field: 'count', align: 'center',title: '完成数'} |
| | | ,{field: 'status$', align: 'center',title: '状态'} |
| | |
| | | }) |
| | | } |
| | | |
| | | function doDel(docNum) { |
| | | console.log(docNum) |
| | | layer.confirm('确定要删除吗?', { |
| | | shade: .1, |
| | | skin: 'layui-layer-admin' |
| | | }, function (i) { |
| | | layer.close(i); |
| | | layer.load(2); |
| | | $.ajax({ |
| | | url: baseUrl+"/pakout/delete/auth", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data:{ |
| | | docNum:docNum |
| | | }, |
| | | method: 'GET', |
| | | 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}); |
| | | } |
| | | } |
| | | }) |
| | | }); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | |
| | | <a class="layui-btn layui-btn-primary layui-border-blue layui-btn-xs btn-complete" lay-event="complete">完结</a> |
| | | {{# } }} |
| | | <a class="layui-btn layui-btn-primary layui-border-blue layui-btn-xs btn-complete" lay-event="btnPrint2">打印</a> |
| | | <a class="layui-btn layui-btn-danger layui-btn-xs btn-delete" lay-event="del">删除</a> |
| | | <!-- <a class="layui-btn layui-btn-primary layui-btn-xs btn-edit" lay-event="btnPrint"><img src="../../static/image/nav/fn_3.png" alt="二维码"></a> |
| | | --> |
| | | </script> |