| | |
| | | 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 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); |
| | | } |
| | | |
| | |
| | | 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) { |