|  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private LocDetlService locDetlService; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private LocMastService locMastService; | 
|---|
|  |  |  | private PakoutService pakoutService; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private StaDescService staDescService; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | 
|---|
|  |  |  | for (LocDetl locDetl : locDetls) { | 
|---|
|  |  |  | if (issued > 0) { | 
|---|
|  |  |  | LocDto locDto = new LocDto(locDetl.getLocNo(), locDetl.getMatnr(), locDetl.getMaktx(), locDetl.getBatch(), orderDetl.getOrderNo(), | 
|---|
|  |  |  | issued >= locDetl.getAnfme() ? locDetl.getAnfme() : issued); | 
|---|
|  |  |  | issued >= locDetl.getAnfme() ? locDetl.getAnfme() : issued,locDetl.getOwner(),locDetl.getPayment()); | 
|---|
|  |  |  | List<Integer> staNos = staDescService.queryOutStaNosByLocNo(locDetl.getLocNo(), issued >= locDetl.getAnfme() ? 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); | 
|---|
|  |  |  | 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(), 0.0,issued); | 
|---|
|  |  |  | locDto.setLack(Boolean.TRUE); | 
|---|
|  |  |  | locDtos.add(locDto); | 
|---|
|  |  |  | 
|---|
|  |  |  | if (Cools.isEmpty(locDtos)) { | 
|---|
|  |  |  | return R.error("平库参数为空,没有生成拣货单"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | String uuid = String.valueOf(System.currentTimeMillis()); | 
|---|
|  |  |  | boolean lack = true; | 
|---|
|  |  |  | for (LocDto locDto : locDtos) { | 
|---|
|  |  |  | if (!locDto.isLack()) { | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | for (LocDto locDto:locDtos){ | 
|---|
|  |  |  | ManLocDetl manLocDetl = manLocDetlService.selectItem(locDto.getLocNo(), locDto.getMatnr(), locDto.getBatch()); | 
|---|
|  |  |  | if (!Cools.isEmpty(manLocDetl) && !(locDto.getAnfme()>=manLocDetl.getAnfme())) { | 
|---|
|  |  |  | if (!Cools.isEmpty(manLocDetl) && !(locDto.getAnfme()>manLocDetl.getAnfme())) { | 
|---|
|  |  |  | manLocDetl.setStatus(0); | 
|---|
|  |  |  | if (manLocDetlService.update(manLocDetl, new EntityWrapper<ManLocDetl>().eq("uuid", manLocDetl.getUuid()))) { | 
|---|
|  |  |  | if (addPakOUT(locDto).equals(R.ok())) { | 
|---|
|  |  |  | if (addPakOUT(locDto,uuid).equals(R.ok())) { | 
|---|
|  |  |  | Order order = orderService.selectByNo(locDto.getOrderNo()); | 
|---|
|  |  |  | if (Cools.isEmpty(order)){ | 
|---|
|  |  |  | return R.error("查询订单失败,请联系管理员"+locDto.getOrderNo()); | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }else if (locDto.getLocNo().equals("立库")){ | 
|---|
|  |  |  | addPakOUT(locDto).equals(R.ok()); | 
|---|
|  |  |  | addPakOUT(locDto,uuid).equals(R.ok()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | for (LocDto locDto:locDtos){ | 
|---|
|  |  |  | if (locDto.getLocNo().equals("库存不足")){ | 
|---|
|  |  |  | addPakOUT(locDto).equals(R.ok()); | 
|---|
|  |  |  | addPakOUT(locDto,uuid).equals(R.ok()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return R.ok(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private R addPakOUT(LocDto locDto){ | 
|---|
|  |  |  | private R addPakOUT(LocDto locDto,String uuid){ | 
|---|
|  |  |  | ManPakOut manPakOut=new ManPakOut(); | 
|---|
|  |  |  | manPakOut.setWrkNo(locDto.getOrderNo()+"-"+System.currentTimeMillis()); | 
|---|
|  |  |  | manPakOut.setWrkSts((long)1); | 
|---|
|  |  |  | 
|---|
|  |  |  | manPakOut.setUpdateTime(new Date()); | 
|---|
|  |  |  | manPakOut.setPayment(locDto.getPayment()); | 
|---|
|  |  |  | manPakOut.setOwner(locDto.getOwner()); | 
|---|
|  |  |  | manPakOut.setUuid(String.valueOf(System.currentTimeMillis())); | 
|---|
|  |  |  | manPakOut.setUuid(uuid); | 
|---|
|  |  |  | if (Cools.isEmpty(manPakOutService.selectOne(new EntityWrapper<ManPakOut>().eq("doc_num",locDto.getOrderNo())))){ | 
|---|
|  |  |  | manPakOut.setName(locDto.getMaktx()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | this.anfme = anfme; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public LocDto(String locNo, String matnr, String maktx, String batch, String orderNo, Double anfme) { | 
|---|
|  |  |  | public LocDto(String locNo, String matnr, String maktx, String batch, String orderNo, Double anfme,int owner ,int payment) { | 
|---|
|  |  |  | 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) { | 
|---|
|  |  |  | 
|---|
|  |  |  | <result column="update_by" property="updateBy" /> | 
|---|
|  |  |  | <result column="update_time" property="updateTime" /> | 
|---|
|  |  |  | <result column="memo" property="memo" /> | 
|---|
|  |  |  | <result column="owner" property="owner" /> | 
|---|
|  |  |  | <result column="payment" property="payment" /> | 
|---|
|  |  |  | <result column="uuid" property="uuid" /> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | </resultMap> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | <result column="update_by" property="updateBy" /> | 
|---|
|  |  |  | <result column="update_time" property="updateTime" /> | 
|---|
|  |  |  | <result column="memo" property="memo" /> | 
|---|
|  |  |  | <result column="owner" property="owner" /> | 
|---|
|  |  |  | <result column="payment" property="payment" /> | 
|---|
|  |  |  | <result column="uuid" property="uuid" /> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | </resultMap> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | headers: {token: localStorage.getItem('token')}, | 
|---|
|  |  |  | url: baseUrl+'/ManPakOut/list/auth', | 
|---|
|  |  |  | where: { | 
|---|
|  |  |  | doc_num: data.docNum | 
|---|
|  |  |  | doc_num: data.docNum, | 
|---|
|  |  |  | uuid: data.uuid | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | page: true, | 
|---|
|  |  |  | cellMinWidth: 100, | 
|---|
|  |  |  | 
|---|
|  |  |  | {type: 'numbers'} | 
|---|
|  |  |  | ,{field: 'id', align: 'center',title: 'id', hide:true} | 
|---|
|  |  |  | ,{field: 'docNum', align: 'center',title: '拣货单号'} | 
|---|
|  |  |  | ,{field: 'uuid', align: 'center',title: 'uuid'} | 
|---|
|  |  |  | ,{field: 'locNo', align: 'center',title: '库位'} | 
|---|
|  |  |  | ,{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: '状态'} | 
|---|
|  |  |  | 
|---|
|  |  |  | {field: 'specs', title: '规格'}, | 
|---|
|  |  |  | {field: 'anfme', title: '数量(修改)', style: 'color: blue;font-weight: bold', edit: true, minWidth: 110, width: 110}, | 
|---|
|  |  |  | {field: 'workQty', title: '作业数量',  minWidth: 100, width: 100}, | 
|---|
|  |  |  | {field: 'owner$', title: '货主',  minWidth: 100, width: 100}, | 
|---|
|  |  |  | {field: 'payment$', title: '货物形态',  minWidth: 100, width: 100}, | 
|---|
|  |  |  | // {field: 'unit', title: '单位', width: 80}, | 
|---|
|  |  |  | {field: 'memo', title: '备注' , edit: true}, | 
|---|
|  |  |  | {align: 'center', title: '操作', toolbar: '#formSSXMTableBar', minWidth: 80, width: 80, fixed: 'right'} | 
|---|