| | |
| | | import com.zy.api.entity.ReportOrderParam; |
| | | import com.zy.api.entity.StockUpOrderParams; |
| | | import com.zy.api.entity.SyncMatParmas; |
| | | import com.zy.api.entity.dto.XSR; |
| | | import com.zy.api.enums.MatLocType; |
| | | import com.zy.api.enums.OrderType; |
| | | import com.zy.api.enums.OrderWkType; |
| | |
| | | * @date 2025/11/24 14:49 |
| | | */ |
| | | @Override |
| | | public R receiveOrders(PubOrderParams params) { |
| | | public XSR receiveOrders(PubOrderParams params) { |
| | | if (params.getType().equals(OrderWkType.getTypeVal(params.getType()))) { |
| | | return R.error("当前类型不是上架派工单!!"); |
| | | return XSR.error("当前类型不是上架派工单!!"); |
| | | } |
| | | addOrUpdateOrders(params, "add"); |
| | | return R.ok("单据下发成功!!"); |
| | | return XSR.ok("单据下发成功!!"); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R getInDispatchResult(ReportOrderParam params) { |
| | | public XSR getInDispatchResult(ReportOrderParam params) { |
| | | if (Objects.isNull(params)) { |
| | | return R.error("参数不能为空!!"); |
| | | return XSR.error("参数不能为空!!"); |
| | | } |
| | | String response = null; |
| | | try { |
| | |
| | | .build() |
| | | .doPost(); |
| | | if (Objects.isNull(response) || response.trim().isEmpty()) { |
| | | return R.error("外网接口无响应!!"); |
| | | return XSR.error("外网接口无响应!!"); |
| | | } |
| | | JSONObject jsonObject = JSONObject.parseObject(response); |
| | | Integer code = jsonObject.getInteger("code"); |
| | | if (!Objects.isNull(code) && code.equals(1)) { |
| | | return R.ok("入库单上报完成!!"); |
| | | return XSR.ok("入库单上报完成!!"); |
| | | } else { |
| | | String msg = jsonObject.getString("message"); |
| | | return R.error(Objects.isNull(msg) ? "上报失败!!" : msg); |
| | | return XSR.error(Objects.isNull(msg) ? "上报失败!!" : msg); |
| | | } |
| | | } catch (Exception e) { |
| | | return R.error(e.getMessage()); |
| | | return XSR.error(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R sendOutDispatch(PubOrderParams params) { |
| | | public XSR sendOutDispatch(PubOrderParams params) { |
| | | if (Objects.isNull(params)) { |
| | | return R.error("参数不能为空!!"); |
| | | return XSR.error("参数不能为空!!"); |
| | | } |
| | | // 校验参数 |
| | | if (Objects.isNull(params.getDispatch_no())) { |
| | | return R.error("派工单编号不能为空!!"); |
| | | return XSR.error("派工单编号不能为空!!"); |
| | | } |
| | | if (Objects.isNull(params.getKopen_id())) { |
| | | return R.error("流水号不能为空!!"); |
| | | return XSR.error("流水号不能为空!!"); |
| | | } |
| | | if (Objects.isNull(params.getCompany_id())) { |
| | | return R.error("公司ID不能为空!!"); |
| | | return XSR.error("公司ID不能为空!!"); |
| | | } |
| | | |
| | | addOrUpdateOrders(params, "add"); |
| | | |
| | | return R.ok("备货指示派工单下发成功!!"); |
| | | return XSR.ok("备货指示派工单下发成功!!"); |
| | | } |
| | | |
| | | // /** |
| | |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public synchronized R basMatupdate(SyncMatParmas params) { |
| | | if (Objects.isNull(params.getPro_komcode())) { |
| | | return R.error("零件编码不能为空!!"); |
| | | public synchronized XSR basMatupdate(List<SyncMatParmas> params) { |
| | | if (Objects.isNull(params) || params.isEmpty()) { |
| | | return XSR.error("参数不能为空!!"); |
| | | } |
| | | Mat matnr = matService.selectOne(new EntityWrapper<Mat>().eq("matnr", params.getPro_komcode())); |
| | | if (!Objects.isNull(matnr)) { |
| | | // 订单时间 |
| | | if (Utils.isValidFormat(params.getUpdate_time(), "yyyy-MM-dd HH:mm:ss")) { |
| | | Date date1 = Utils.getFormateDate(params.getUpdate_time()); |
| | | matnr.setUpdateTime(date1); |
| | | params.forEach(mats -> { |
| | | if (Objects.isNull(mats)) { |
| | | throw new CoolException("物料编码不能为空!!"); |
| | | } |
| | | matnr.setMaktx(params.getPro_name()); |
| | | matnr.setSpecs(params.getPro_size()); |
| | | matnr.setWeight(Double.parseDouble(params.getPro_wet())); |
| | | matnr.setSuppCode(params.getPro_id()); |
| | | matnr.setTagId(MatLocType.getTag(params.getPro_type())); |
| | | matnr.setManu(params.getCompany_id()); |
| | | if (!matService.updateById(matnr)) { |
| | | throw new CoolException("物料更新失败或无需更新!!"); |
| | | Mat matnr = matService.selectOne(new EntityWrapper<Mat>().eq("matnr", mats.getPro_komcode())); |
| | | if (!Objects.isNull(matnr)) { |
| | | // 订单时间 |
| | | if (Utils.isValidFormat(mats.getUpdate_time(), "yyyy-MM-dd HH:mm:ss")) { |
| | | Date date1 = Utils.getFormateDate(mats.getUpdate_time()); |
| | | matnr.setUpdateTime(date1); |
| | | } |
| | | matnr.setMaktx(mats.getPro_name()); |
| | | matnr.setSpecs(mats.getPro_size()); |
| | | matnr.setWeight(Double.parseDouble(mats.getPro_wet())); |
| | | matnr.setSuppCode(mats.getPro_id()); |
| | | matnr.setTagId(MatLocType.getTag(mats.getPro_type())); |
| | | matnr.setLocType(MatLocType.getTag(mats.getPro_type())); |
| | | matnr.setManu(mats.getCompany_id()); |
| | | if (!matService.updateById(matnr)) { |
| | | throw new CoolException("物料更新失败或无需更新!!"); |
| | | } |
| | | } else { |
| | | if (Objects.isNull(matnr)) { |
| | | matnr = new Mat(); |
| | | } |
| | | // 订单时间 |
| | | if (Utils.isValidFormat(mats.getUpdate_time(), "yyyy-MM-dd HH:mm:ss")) { |
| | | Date date1 = Utils.getFormateDate(mats.getUpdate_time()); |
| | | matnr.setUpdateTime(date1); |
| | | } |
| | | matnr.setMaktx(mats.getPro_name()); |
| | | matnr.setMatnr(mats.getPro_komcode()); |
| | | matnr.setSpecs(mats.getPro_size()); |
| | | matnr.setWeight(Double.parseDouble(mats.getPro_wet())); |
| | | matnr.setSuppCode(mats.getPro_id()); |
| | | matnr.setTagId(MatLocType.getTag(mats.getPro_type())); |
| | | matnr.setLocType(MatLocType.getTag(mats.getPro_type())); |
| | | matnr.setManu(mats.getCompany_id()); |
| | | if (!matService.insert(matnr)) { |
| | | throw new CoolException("物料更新失败!!"); |
| | | } |
| | | } |
| | | } else { |
| | | if (Objects.isNull(matnr)) { |
| | | matnr = new Mat(); |
| | | } |
| | | // 订单时间 |
| | | if (Utils.isValidFormat(params.getUpdate_time(), "yyyy-MM-dd HH:mm:ss")) { |
| | | Date date1 = Utils.getFormateDate(params.getUpdate_time()); |
| | | matnr.setUpdateTime(date1); |
| | | } |
| | | matnr.setMaktx(params.getPro_name()); |
| | | matnr.setMatnr(params.getPro_komcode()); |
| | | matnr.setSpecs(params.getPro_size()); |
| | | matnr.setWeight(Double.parseDouble(params.getPro_wet())); |
| | | matnr.setSuppCode(params.getPro_id()); |
| | | matnr.setTagId(MatLocType.getTag(params.getPro_type())); |
| | | matnr.setManu(params.getCompany_id()); |
| | | if (!matService.insert(matnr)) { |
| | | throw new CoolException("物料更新失败!!"); |
| | | } |
| | | } |
| | | return R.ok("保存成功!!"); |
| | | }); |
| | | |
| | | return XSR.ok("保存成功!!"); |
| | | } |
| | | |
| | | /** |
| | |
| | | // 入库 |
| | | order = orderService.selectOne(new EntityWrapper<Order>().eq("order_no", |
| | | orderParams.getDispatch_no())); |
| | | } else if |
| | | (OrderType.ORDER_OUT.type.equals(OrderWkType.getTypeVal(params.getType()))) { |
| | | } else if (OrderType.ORDER_OUT.type.equals(OrderWkType.getTypeVal(params.getType()))) { |
| | | // 出库 |
| | | if (OrderWkType.ORDER_WK_ORDER_OUT.val.equals(params.getType())) { |
| | | // 备货单出库 |
| | |
| | | * @date 2025/11/24 15:40 |
| | | */ |
| | | @Override |
| | | public R getOutDetails(StockUpOrderParams params) { |
| | | public XSR getOutDetails(StockUpOrderParams params) { |
| | | if (Objects.isNull(params)) { |
| | | return R.error("参数不能为空!!"); |
| | | return XSR.error("参数不能为空!!"); |
| | | } |
| | | // 校验参数 |
| | | if (Objects.isNull(params.getDispatch_no())) { |
| | | return R.error("派工单编号不能为空!!"); |
| | | return XSR.error("派工单编号不能为空!!"); |
| | | } |
| | | if (Objects.isNull(params.getKopen_id())) { |
| | | return R.error("流水号不能为空!!"); |
| | | return XSR.error("流水号不能为空!!"); |
| | | } |
| | | if (Objects.isNull(params.getCompany_id())) { |
| | | return R.error("公司ID不能为空!!"); |
| | | return XSR.error("公司ID不能为空!!"); |
| | | } |
| | | if (Objects.isNull(params.getDetails()) || params.getDetails().isEmpty()) { |
| | | return R.error("订单明细不能为空!!"); |
| | | return XSR.error("订单明细不能为空!!"); |
| | | } |
| | | |
| | | List<OrderItemsParam> items = new ArrayList<>(); |
| | |
| | | addOrUpdateOrders(pubOrderParams, "add"); |
| | | }); |
| | | |
| | | return R.ok("备货单下发成功!!"); |
| | | return XSR.ok("备货单下发成功!!"); |
| | | } |
| | | |
| | | } |