| | |
| | | import com.zy.common.utils.Synchro; |
| | | import com.zy.common.web.BaseController; |
| | | import com.zy.nc.entity.NccJcQilibcBarcodeflowWms; |
| | | import com.zy.nc.entity.NccXsckmxTkWms; |
| | | import com.zy.nc.entity.NccQilibcTmprintWms; |
| | | import com.zy.nc.entity.NccSaleXclGgsybWms; |
| | | import com.zy.nc.service.NccJcQilibcBarcodeflowWmsService; |
| | | import com.zy.nc.service.NccXsckmxTkWmsService; |
| | | import com.zy.nc.service.NccQilibcTmprintWmsService; |
| | | import com.zy.nc.service.NccSaleXclGgsybWmsService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.util.*; |
| | | |
| | | /** |
| | |
| | | private ManLocDetlMapper manLocDetlMapper; |
| | | @Autowired |
| | | private WrkDetlLogService wrkDetlLogService; |
| | | @Autowired |
| | | private WrkMastLogService wrkMastLogService; |
| | | @Autowired |
| | | private StoreTypeService storeTypeService; |
| | | |
| | | @Autowired |
| | | private MatService matService; |
| | | @Autowired |
| | | private NccJcQilibcBarcodeflowWmsService nccJcQilibcBarcodeflowWmsService; |
| | | @Autowired |
| | | private NccQilibcTmprintWmsService nccQilibcTmprintWmsService; |
| | | @Autowired |
| | | private NccSaleXclGgsybWmsService nccSaleXclGgsybWmsService; |
| | | @Autowired |
| | | private OrderPakinService orderPakinService; |
| | | |
| | |
| | | |
| | | @Autowired |
| | | private OrderDetlPakinService orderDetlPakinService; |
| | | |
| | | @Autowired |
| | | private NccXsckmxTkWmsService nccXsckmxTkWmsService; |
| | | |
| | | @RequestMapping("/pda/WarehouseOut/v1") |
| | | @ManagerAuth(memo = "并板途中拣料-参考念初") |
| | |
| | | @RequestMapping(value = "/mat/auth") |
| | | @ManagerAuth |
| | | public R pdaSearchV3(@RequestParam String matnr) { |
| | | EntityWrapper<NccJcQilibcBarcodeflowWms> wrapper = new EntityWrapper<>(); |
| | | wrapper.eq("VBARCODE", matnr).orderBy("ts", false); |
| | | NccJcQilibcBarcodeflowWms nccJcQilibcBarcodeflowWms = nccJcQilibcBarcodeflowWmsService.selectOne(wrapper); |
| | | if (null == nccJcQilibcBarcodeflowWms) { |
| | | EntityWrapper<NccQilibcTmprintWms> wrapper = new EntityWrapper<>(); |
| | | wrapper.eq("BARCODE", matnr).orderBy("PRINTTIME", false); |
| | | NccQilibcTmprintWms nccQilibcTmprintWms = nccQilibcTmprintWmsService.selectOne(wrapper); |
| | | if (null == nccQilibcTmprintWms) { |
| | | return R.error("未找到此条码"); |
| | | } else { |
| | | if (!nccJcQilibcBarcodeflowWms.getInfla().equals("出库")) { |
| | | return R.error("该条码最后一次不是出库"); |
| | | } |
| | | } |
| | | Mat mat = matService.selectByMatnr(nccJcQilibcBarcodeflowWms.getWlbm()); |
| | | Mat mat = matService.selectByMatnr(nccQilibcTmprintWms.getWlbm()); |
| | | MatParam matParam = new MatParam(); |
| | | Synchro.Copy(mat, matParam); |
| | | matParam.setBatch(nccJcQilibcBarcodeflowWms.getVbatchcode()); |
| | | matParam.setAnfme(nccJcQilibcBarcodeflowWms.getAsnnum() == null ? 0.0D : nccJcQilibcBarcodeflowWms.getAsnnum().doubleValue()); |
| | | matParam.setAnfme2(nccJcQilibcBarcodeflowWms.getNastnum() == null ? 0.0D : nccJcQilibcBarcodeflowWms.getNastnum().doubleValue()); |
| | | matParam.setTiaoma(nccJcQilibcBarcodeflowWms.getVbarcode()); |
| | | matParam.setBatch(nccQilibcTmprintWms.getVbatchcode()); |
| | | // matParam.setAnfme(nccQilibcTmprintWms.getAsnnum() == null ? 0.0D : nccQilibcTmprintWms.getAsnnum().doubleValue()); |
| | | // matParam.setAnfme2(nccQilibcTmprintWms.getNastnum() == null ? 0.0D : nccQilibcTmprintWms.getNastnum().doubleValue()); |
| | | matParam.setAnfme(0.0D); |
| | | matParam.setAnfme2(0.0D); |
| | | matParam.setTiaoma(nccQilibcTmprintWms.getBarcode()); |
| | | return R.ok().add(matParam); |
| | | } |
| | | |
| | | @RequestMapping(value = "/mat/back") |
| | | @ManagerAuth |
| | | public R pdaSearchBack(@RequestParam String matnr) { |
| | | EntityWrapper<NccXsckmxTkWms> wrapper = new EntityWrapper<>(); |
| | | wrapper.like("VBATCHCODE", matnr); |
| | | List<NccXsckmxTkWms> nccXsckmxTkWmsList = nccXsckmxTkWmsService.selectList(wrapper); |
| | | if (nccXsckmxTkWmsList.isEmpty()) { |
| | | return R.error("未找到此条码"); |
| | | public R pdaSearchBack(@RequestParam String barcode) { |
| | | WrkMastLog wrkMastLog = wrkMastLogService.selectOne(new EntityWrapper<WrkMastLog>() |
| | | .eq("barcode", barcode) |
| | | .in("io_type", 101, 103, 107) |
| | | .orderBy("appe_time", false) |
| | | ); |
| | | |
| | | if(null == wrkMastLog) { |
| | | return R.error("未找到此托盘码出库记录"); |
| | | } |
| | | |
| | | List<String> orderNos = new ArrayList<>(); |
| | | List<HashMap<String, Object>> list = new ArrayList<>(); |
| | | for (NccXsckmxTkWms nccXsckmxTkWms : nccXsckmxTkWmsList) { |
| | | if (orderNos.contains(nccXsckmxTkWms.getVsourcebillcode())) { |
| | | continue; |
| | | } |
| | | orderNos.add(nccXsckmxTkWms.getVsourcebillcode()); |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | |
| | | Mat mat = matService.selectByMatnr(nccXsckmxTkWms.getWlbm()); |
| | | if (mat == null) { |
| | | continue; |
| | | } |
| | | MatParam matParam = new MatParam(); |
| | | Synchro.Copy(mat, matParam); |
| | | matParam.setBatch(nccXsckmxTkWms.getVbatchcode()); |
| | | matParam.setAnfme(0.0D); |
| | | matParam.setAnfme2(0.0D); |
| | | matParam.setTiaoma(matnr); |
| | | |
| | | map.put("orderNo", nccXsckmxTkWms.getVsourcebillcode()); |
| | | map.put("matData", matParam); |
| | | list.add(map); |
| | | List<WrkDetlLog> wrkDetlLogs = wrkDetlLogService.selectList(new EntityWrapper<WrkDetlLog>() |
| | | .eq("wrk_no", wrkMastLog.getWrkNo()) |
| | | .eq("zpallet", barcode) |
| | | .orderBy("io_time", false) |
| | | ); |
| | | if (wrkDetlLogs.isEmpty()) { |
| | | return R.error("未找到此托盘码出库记录明细"); |
| | | } |
| | | return R.ok().add(list); |
| | | |
| | | WrkDetlLog wrkDetlLog = wrkDetlLogs.get(0); |
| | | String batch = wrkDetlLog.getBatch(); |
| | | |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | Mat mat = matService.selectByMatnr(wrkDetlLog.getMatnr()); |
| | | if (mat == null) { |
| | | return R.error("未找到物料明细"); |
| | | } |
| | | MatParam matParam = new MatParam(); |
| | | Synchro.Copy(mat, matParam); |
| | | matParam.setBatch(batch); |
| | | matParam.setAnfme(0.0D); |
| | | matParam.setAnfme2(0.0D); |
| | | matParam.setTiaoma(batch); |
| | | |
| | | String[] split = wrkDetlLog.getOrderNo().split("-"); |
| | | map.put("orderNo", split[0]); |
| | | map.put("matData", matParam); |
| | | return R.ok().add(map); |
| | | } |
| | | |
| | | @RequestMapping("/comb/auth") |
| | |
| | | return R.ok("组托成功"); |
| | | } |
| | | |
| | | @RequestMapping("/comb2/auth") |
| | | @ManagerAuth(memo = "采购组托") |
| | | public R comb2(@RequestBody CombParam combParam) { |
| | | CombParam.CombMat combMat = combParam.getCombMats().get(0); |
| | | |
| | | ArrayList<String> ckbmList = new ArrayList<>(); |
| | | List<StoreType> storeTypes = storeTypeService.selectList(new EntityWrapper<StoreType>() |
| | | .like("store_name", "立体库")); |
| | | for (StoreType storeType : storeTypes) { |
| | | ckbmList.add(storeType.getStoreId()); |
| | | } |
| | | |
| | | NccSaleXclGgsybWms nccSaleXclGgsybWms = nccSaleXclGgsybWmsService.selectOne(new EntityWrapper<NccSaleXclGgsybWms>() |
| | | .eq("WLBM", combMat.getMatnr()) |
| | | .eq("VBATCHCODE", combMat.getBatch()) |
| | | .in("CKBM", ckbmList) |
| | | ); |
| | | if(null == nccSaleXclGgsybWms) { |
| | | return R.error("未查到ERP库存"); |
| | | } |
| | | |
| | | //ERP库存数量 |
| | | BigDecimal zsl = nccSaleXclGgsybWms.getZsl(); |
| | | |
| | | //获取立库数量 |
| | | List<LocDetl> locDetls = locDetlService.selectList(new EntityWrapper<LocDetl>() |
| | | .eq("matnr", combMat.getMatnr()) |
| | | .eq("batch", combMat.getBatch()) |
| | | ); |
| | | BigDecimal stockNum = new BigDecimal(0); |
| | | for (LocDetl locDetl : locDetls) { |
| | | stockNum = stockNum.add(BigDecimal.valueOf(locDetl.getAnfme())); |
| | | } |
| | | |
| | | //加上组托数量 |
| | | for (CombParam.CombMat mat : combParam.getCombMats()) { |
| | | stockNum = stockNum.add(BigDecimal.valueOf(mat.getAnfme())); |
| | | } |
| | | |
| | | if(stockNum.doubleValue() > zsl.doubleValue()) { |
| | | return R.error("组托数量超过ERP库存"); |
| | | } |
| | | |
| | | List<CombParam.CombMat> combMats = combParam.getCombMats(); |
| | | for (CombParam.CombMat mat : combMats) { |
| | | mat.setStandby1(nccSaleXclGgsybWms.getCkbm()); |
| | | } |
| | | |
| | | mobileService.comb(combParam, getUserId()); |
| | | return R.ok("组托成功"); |
| | | } |
| | | |
| | | @RequestMapping("/pack/get/auth") |
| | | @ManagerAuth |
| | | public R packGet(@RequestParam String barcode) { |