| | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.core.common.Cools; |
| | | import com.core.common.R; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.api.controller.params.ReceviceTaskParams; |
| | |
| | | //任务 |
| | | if (params.getMsgType().equals("task_complete")) { |
| | | if (!Objects.isNull(mast.getWrkCode())) { |
| | | if (mast.getOveMk().equals("N") && mast.getIoType() == 1) { |
| | | if (mast.getOveMk().equals("N") && !Cools.isEmpty(mast.getIsSuplus())) { |
| | | throw new CoolException("任务未上报重量,无法完结任务!!"); |
| | | } |
| | | } |
| | |
| | | //余料长度 |
| | | wrkDetl.setRealQty(val * matnr.getVolume()); |
| | | mast.setIoType(1); |
| | | mast.setOveMk("Y"); |
| | | mast.setIsSuplus(1); |
| | | if (!wrkMastService.updateById(mast)) { |
| | | throw new CoolException("主档状态修改失败"); |
| | |
| | | Double val = Math.round((params.getWeight() - matnr.getSafeQty()) * 10000) / 10000.0; |
| | | //称重后,计算出真实长度 |
| | | Double realQty = val * matnr.getVolume(); |
| | | // if (val.compareTo(0.0) > 0) { |
| | | // //余料长度 |
| | | // wrkDetl.setRealQty(realQty); |
| | | // } else { |
| | | // //空板 |
| | | // wrkDetl.setRealQty(0.0); |
| | | // } |
| | | wrkDetl.setAnfme(realQty); |
| | | wrkDetl.setWeight(params.getWeight()); |
| | | if (!wrkDetlService.update(wrkDetl, new EntityWrapper<WrkDetl>().eq("wrk_no", mast.getWrkNo()).eq("matnr", wrkDetl.getMatnr()).eq("barcode", wrkDetl.getBarcode()))) { |
| | | throw new CoolException("任务档明细修改失败!!"); |
| | | } |
| | | mast.setOveMk("Y"); |
| | | if (!wrkMastService.updateById(mast)) { |
| | | throw new CoolException("任务档修改失败!!"); |
| | | } |
| | | |
| | | // 更新原出库单 |
| | | int indexOf = mast.getWrkCode().indexOf("-1"); |
| | | if (indexOf != -1) { |
| | |
| | | //库存减去称重长度 |
| | | Double v = Math.round((wrkDetl.getStockQty() - realQty) * 10000) / 10000.0; |
| | | //原出为数量与真实数量互换,保持一致性 |
| | | detl.setRealQty(detl.getAnfme()); |
| | | detl.setAnfme(v); |
| | | detl.setWeight(params.getWeight()); |
| | | if (!wrkDetlService.update(detl, new EntityWrapper<WrkDetl>().eq("wrk_no", wrkNo).eq("matnr", detl.getMatnr()).eq("barcode", detl.getBarcode()))) { |