| | |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.vincent.rsf.framework.common.Cools; |
| | | import com.vincent.rsf.framework.common.R; |
| | | import com.vincent.rsf.framework.exception.CoolException; |
| | |
| | | import com.vincent.rsf.server.manager.mapper.*; |
| | | import com.vincent.rsf.server.manager.service.*; |
| | | import com.vincent.rsf.server.system.constant.CodeRes; |
| | | import com.vincent.rsf.server.system.constant.GlobalConfigCode; |
| | | import com.vincent.rsf.server.system.constant.SerialRuleCode; |
| | | import com.vincent.rsf.server.system.controller.param.LoginParam; |
| | | import com.vincent.rsf.server.system.controller.result.LoginResult; |
| | | import com.vincent.rsf.server.system.entity.*; |
| | | import com.vincent.rsf.server.system.mapper.FieldsMapper; |
| | | import com.vincent.rsf.server.system.mapper.TenantMapper; |
| | | import com.vincent.rsf.server.system.service.ConfigService; |
| | | import com.vincent.rsf.server.system.service.FieldsItemService; |
| | | import com.vincent.rsf.server.system.service.UserLoginService; |
| | | import com.vincent.rsf.server.system.service.UserService; |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | private LocAreaMapper locAreaMapper; |
| | | @Autowired |
| | | private DeviceSiteMapper deviceSiteMapper; |
| | | @Autowired |
| | | private ConfigService configService; |
| | | |
| | | /** |
| | | * @return |
| | |
| | | } |
| | | //TODO /**收货数量累加,1. 会出超收情况 2. 会有收货不足情况*/ |
| | | Double rcptedQty = asnOrder.getQty() + receiptQty; |
| | | asnOrder.setQty(rcptedQty).setExceStatus(AsnExceStatus.ASN_EXCE_STATUS_EXCE_ING.val); |
| | | |
| | | asnOrder.setQty(rcptedQty).setExceStatus(AsnExceStatus.ASN_EXCE_STATUS_EXCE_ING.val); |
| | | if (!asnOrderMapper.updateById(asnOrder)) { |
| | | throw new CoolException("已收货数量修改失败!!"); |
| | | } |
| | | |
| | | Config config = configService.getOne(new LambdaQueryWrapper<Config>().eq(Config::getFlag, GlobalConfigCode.ALLOW_OVER_CHANGE)); |
| | | |
| | | |
| | | List<Map<String, Object>> receipts1 = (List<Map<String, Object>>) params.get("receipts"); |
| | | for (Map<String, Object> rcpt : receipts1) { |
| | | if (null == rcpt || Objects.isNull(rcpt)) { |
| | |
| | | if (Objects.isNull(dto.getReceiptQty()) || Double.compare(dto.getReceiptQty(), 0.0) == 0) { |
| | | throw new CoolException("物料:" + dto.getMaktx() + "收货数量不能为零!!"); |
| | | } |
| | | |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | try { |
| | | if (!Objects.isNull(dto.getProdTime())) { |
| | | sdf.parse(dto.getProdTime()); |
| | | } |
| | | } catch (ParseException e) { |
| | | throw new CoolException("请输入正确的时间格式!!"); |
| | | } |
| | | |
| | | Double itemRcptQty = dto.getReceiptQty() + orderItem.getQty(); |
| | | Boolean allowOver = false; |
| | | if (!Objects.isNull(config)) { |
| | | if (Boolean.parseBoolean(config.getVal())) { |
| | | allowOver = true; |
| | | } |
| | | } |
| | | if (itemRcptQty.compareTo(orderItem.getAnfme()) > 0 && !allowOver) { |
| | | throw new CoolException("收货数量不能大于计划数量!!"); |
| | | } |
| | | |
| | | orderItem.setQty(itemRcptQty) |
| | | // .setSplrBatch(dto.getSplrBatch()) |
| | | .setUpdateBy(loginUserId) |
| | |
| | | .setFieldsIndex(orderItem.getFieldsIndex()) |
| | | .setShipperId(matnr.getShipperId()); |
| | | //TODO 供应商标识未设置,标识由PO单供应商编码转换 |
| | | WarehouseAreasItem serviceOne = warehouseAreasItemService.getOne(new LambdaQueryWrapper<WarehouseAreasItem>() |
| | | |
| | | LambdaQueryWrapper<WarehouseAreasItem> queryWrapper = new LambdaQueryWrapper<WarehouseAreasItem>() |
| | | // .eq(WarehouseAreasItem::getAsnItemId, item.getAsnItemId()) |
| | | .eq(WarehouseAreasItem::getMatnrCode, item.getMatnrCode()) |
| | | .eq(!Cools.isEmpty(item.getFieldsIndex()), WarehouseAreasItem::getFieldsIndex, item.getFieldsIndex()) |
| | | .eq(WarehouseAreasItem::getAsnCode, item.getAsnCode()) |
| | | .eq(!Cools.isEmpty(item.getIsptResult()), WarehouseAreasItem::getIsptResult, item.getIsptResult()) |
| | | .eq(StringUtils.isNotBlank(item.getSplrBatch()), WarehouseAreasItem::getSplrBatch, item.getSplrBatch())); |
| | | .eq(StringUtils.isNotBlank(item.getSplrBatch()), WarehouseAreasItem::getSplrBatch, item.getSplrBatch()); |
| | | if (Objects.isNull(orderItem.getIsptResult())) { |
| | | queryWrapper.isNull(WarehouseAreasItem::getIsptResult); |
| | | } else { |
| | | queryWrapper.eq(WarehouseAreasItem::getIsptResult, orderItem.getIsptResult()); |
| | | } |
| | | |
| | | WarehouseAreasItem serviceOne = warehouseAreasItemService.getOne(queryWrapper); |
| | | |
| | | if (!Objects.isNull(serviceOne)) { |
| | | item.setId(serviceOne.getId()); |
| | | item.setAnfme(item.getAnfme() + serviceOne.getAnfme()); |
| | |
| | | .setId(isptItem.getId()) |
| | | .setMatnrCode(isptItem.getMatnrCode()) |
| | | .setMaktx(isptItem.getMaktx()) |
| | | .setDisQty(isptItem.getDisQty()) |
| | | // .setDisQty(isptItem.getDisQty()) |
| | | .setDlyQty(isptItem.getDlyQty()) |
| | | .setRcptQty(isptItem.getRcptQty()) |
| | | .setIsptResult(isptItem.getIsptResult()) |
| | | .setSplrBatch(isptItem.getSplrBatch()) |
| | | .setSplrName(isptItem.getSplrName()) |
| | | .setPicPath(isptItem.getPicPath()) |
| | | .setMemo(isptItem.getMemo()) |
| | | .setSafeQty(isptItem.getSafeQty()); |
| | | .setMemo(isptItem.getMemo()); |
| | | // .setSafeQty(isptItem.getSafeQty()); |
| | | dtos.add(objDto); |
| | | }); |
| | | return R.ok(dtos); |
| | |
| | | * 快速质检 |
| | | * |
| | | * @param params |
| | | * @param loginUserId |
| | | * @return |
| | | */ |
| | | @Override |
| | | public R checkUpdate(List<QlyIsptItem> params) { |
| | | public R checkUpdate(List<QlyIsptItem> params, Long loginUserId) { |
| | | if (Objects.isNull(params) || params.isEmpty()) { |
| | | throw new CoolException("参数不能为空!!"); |
| | | } |
| | | IsptItemsParams itemsParams = new IsptItemsParams(); |
| | | itemsParams.setIsptItem(params).setType("0"); |
| | | if (qlyIsptItemService.batchUpdate(itemsParams)) { |
| | | if (qlyIsptItemService.batchUpdate(itemsParams, loginUserId)) { |
| | | return R.ok(); |
| | | } else { |
| | | return R.error("保存失败!!"); |
| | |
| | | @Override |
| | | public R operateToStock(OpStockParams params) { |
| | | if (org.apache.commons.lang3.StringUtils.isBlank(params.getBarcode())) { |
| | | throw new CoolException("拖盘码不能为空!!"); |
| | | throw new CoolException("托盘码不能为空!!"); |
| | | } |
| | | if (StringUtils.isBlank(params.getAsnCode())) { |
| | | throw new CoolException("单据不能为空!!"); |
| | | WaitPakin waitPakin = waitPakinService.getOne(new LambdaQueryWrapper<WaitPakin>() |
| | | .eq(WaitPakin::getBarcode, params.getBarcode()) |
| | | .eq(WaitPakin::getIoStatus,PakinIOStatus.PAKIN_IO_STATUS_DONE.val) |
| | | ); |
| | | if (Cools.isEmpty(waitPakin)){ |
| | | throw new CoolException("未找到组托数据,请检查状态"); |
| | | } |
| | | if (StringUtils.isBlank(params.getMatnrCode())) { |
| | | throw new CoolException("物料编码不能为空!!"); |
| | | List<WaitPakinItem> waitPakinItems = waitPakinItemService.list(new LambdaQueryWrapper<WaitPakinItem>().eq(WaitPakinItem::getPakinId, waitPakin.getId())); |
| | | if (Cools.isEmpty(waitPakinItems)){ |
| | | throw new CoolException("数据错误,未找到组托明细"); |
| | | } |
| | | AsnOrder asnOrders = asnOrderMapper.getOne(new LambdaQueryWrapper<AsnOrder>().eq(AsnOrder::getCode, params.getAsnCode())); |
| | | if (Objects.isNull(asnOrders)) { |
| | | throw new CoolException("单据不存在!!"); |
| | | } |
| | | List<Loc> locs = locService.list(new LambdaQueryWrapper<Loc>().eq(Loc::getBarcode, params.getBarcode())); |
| | | if (!locs.isEmpty()) { |
| | | throw new CoolException("拖盘已使用"); |
| | | } |
| | | List<WaitPakin> waitPakins = waitPakinService.list(new LambdaQueryWrapper<WaitPakin>().eq(WaitPakin::getBarcode, params.getBarcode())); |
| | | if (!waitPakins.isEmpty()) { |
| | | throw new CoolException("拖盘已使用!!"); |
| | | } |
| | | AsnOrderItem orderItems = asnOrderItemMapper.selectOne(new LambdaQueryWrapper<AsnOrderItem>() |
| | | .eq(AsnOrderItem::getAsnId, asnOrders.getId()) |
| | | .eq(AsnOrderItem::getMatnrCode, params.getMatnrCode())); |
| | | if (Objects.isNull(orderItems)) { |
| | | return R.ok(null); |
| | | } |
| | | orderItems.setBarcode(params.getBarcode()); |
| | | |
| | | return R.ok(orderItems); |
| | | |
| | | return R.ok(waitPakinItems); |
| | | } |
| | | |
| | | /** |
| | |
| | | /**获取平库订单*/ |
| | | AsnOrder order = asnOrderMapper.getOne(new LambdaQueryWrapper<AsnOrder>() |
| | | .eq(AsnOrder::getId, OrderId) |
| | | .eq(AsnOrder::getType, OrderType.ORDER_PLAT_IN.type)); |
| | | .eq(AsnOrder::getWkType, OrderWorkType.ORDER_WORK_TYPE_OTHER_IN.type) |
| | | .eq(AsnOrder::getType, OrderType.ORDER_IN.type)); |
| | | if (Objects.isNull(order)) { |
| | | throw new CoolException("非平库单据不可执行人工上架!!"); |
| | | } |