| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import zy.cloud.wms.common.model.OrderStoDto; |
| | | import zy.cloud.wms.common.service.MainService; |
| | | import zy.cloud.wms.common.service.asrs.AsrsService; |
| | | import zy.cloud.wms.common.utils.VersionUtils; |
| | | import zy.cloud.wms.manager.entity.*; |
| | | import zy.cloud.wms.manager.entity.param.*; |
| | | import zy.cloud.wms.manager.entity.result.StoPrintVo; |
| | | import zy.cloud.wms.manager.service.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | |
| | | private SnowflakeIdWorker snowflakeIdWorker; |
| | | @Autowired |
| | | private MatService matService; |
| | | @Autowired |
| | | private AsrsService asrsService; |
| | | |
| | | @Override |
| | | @Transactional |
| | |
| | | null, // 经手人编号[空] |
| | | dto.getMatnr(), // 商品编号 |
| | | dto.getCount(), // 商品数量 |
| | | dto.getCount(), // 总数量 |
| | | Cools.isEmpty(mat.getName())?0.0D:Double.parseDouble(mat.getName()), // 商品单价 |
| | | null, // 商品备注[空] |
| | | 1, // 状态 |
| | |
| | | return R.ok("生成销售订单" + param.getNumber() + "成功"); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public R stockTransfer(String number, Long userId) { |
| | | List<CustOrder> custOrders = custOrderService.selectList(new EntityWrapper<CustOrder>().eq("number", number).eq("status", 1)); |
| | | boolean asrs = false; |
| | | List<StockTransferParam> params = new ArrayList<>(); |
| | | for (CustOrder custOrder : custOrders) { |
| | | Double count = locDetlService.selectCountByMatnr(custOrder.getUserCode()); |
| | | if (count == null) { |
| | | count = 0.0D; |
| | | } |
| | | if (count < custOrder.getQty()) { |
| | | if (!asrs) { asrs = true; } |
| | | StockTransferParam param = new StockTransferParam(); |
| | | param.setMatnr(custOrder.getUserCode()); |
| | | param.setAnfme(custOrder.getQty() - count); |
| | | params.add(param); |
| | | } |
| | | } |
| | | if (asrs) { |
| | | // if (asrsService.stockTransfer(params)) { |
| | | // for (StockTransferParam param : params) { |
| | | // // 修改销售订单待出数量 |
| | | // if (!custOrderService.updateQty(number, param.getMatnr(), param.getAnfme())) { |
| | | // throw new CoolException("修改销售订单待出数量失败"); |
| | | // } |
| | | // } |
| | | // return R.ok("库存调拨成功"); |
| | | // } else { |
| | | // return R.error("立库调拨失败,请联系管理员"); |
| | | // } |
| | | } |
| | | return R.error("暂不缺货,不需要立库调拨"); |
| | | } |
| | | |
| | | } |