| | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.vincent.rsf.framework.common.R; |
| | | import com.vincent.rsf.server.api.entity.params.CallForEmptyContainersParam; |
| | | import com.vincent.rsf.server.api.entity.params.PdaGeneralParam; |
| | | import com.vincent.rsf.server.api.service.InBoundService; |
| | | import com.vincent.rsf.server.api.service.PdaOutStockService; |
| | | import com.vincent.rsf.server.common.annotation.OperationLog; |
| | | import com.vincent.rsf.server.manager.entity.Loc; |
| | | import com.vincent.rsf.server.manager.entity.LocItem; |
| | |
| | | private LocItemService locItemService; |
| | | @Resource |
| | | private AsnOrderService asnOrderService; |
| | | @Resource |
| | | private PdaOutStockService pdaOutStockService; |
| | | @Resource |
| | | private InBoundService inBoundService; |
| | | |
| | | |
| | | /** |
| | |
| | | try { |
| | | WkOrder order = new WkOrder(); |
| | | String orderNo = params.getString("orderNo"); |
| | | order.setCode(orderNo).setPoCode(orderNo).setType(OrderType.ORDER_OUT.type) |
| | | boolean out = params.getBoolean("out"); |
| | | order.setCode(orderNo).setPoCode(orderNo).setType(out?OrderType.ORDER_PRE.type:OrderType.ORDER_PRE_NOT_OUT.type) |
| | | // .setWkType(OrderWorkType.ORDER_WORK_TYPE_MATERIAL_PREPARATION.type) |
| | | .setCreateBy(getLoginUserId()) |
| | | .setUpdateBy(getLoginUserId()); |
| | |
| | | qty = item.getDouble("anfme"); |
| | | } |
| | | map.put("anfme", qty); |
| | | // map.put("unit", item.getString("unit")); |
| | | // map.put("splrCode", item.getString("splrCode")); |
| | | // map.put("splrName", item.getString("splrName")); |
| | | // map.put("splrBatch", item.getString("splrBatch")); |
| | | // map.put("platItemId", item.getString("platItemId")); |
| | | items.add(map); |
| | | } |
| | | |
| | |
| | | return result; |
| | | } |
| | | |
| | | Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getUseStatus, "O").eq(Loc::getAreaId, 22).last("limit 1")); |
| | | if (loc == null) { |
| | | return R.error("没有可用库位"); |
| | | } |
| | | String palletId = "AA" + String.format("%06d", (int) (Math.random() * 1000000)); |
| | | |
| | | for (int i = 0; i < jsonArray.size(); i++) { |
| | | JSONObject item = jsonArray.getJSONObject(i); |
| | | loc.setBarcode(palletId); |
| | | loc.setUseStatus("F"); |
| | | locService.updateById(loc); |
| | | |
| | | LocItem locItem = new LocItem(); |
| | | String matnrCode = item.getString("matNr"); |
| | | if (matnrCode == null) { |
| | | matnrCode = item.getString("matNr"); |
| | | } |
| | | Double qty = item.getDouble("anfme"); |
| | | if (qty == null) { |
| | | qty = item.getDouble("anfme"); |
| | | } |
| | | locItem.setLocId(loc.getId()) |
| | | .setLocCode(loc.getCode()) |
| | | .setOrderId(order.getId()) |
| | | .setType(OrderType.ORDER_OUT.type) |
| | | // .setWkType(Short.parseShort(OrderWorkType.ORDER_WORK_TYPE_MATERIAL_PREPARATION.type)) |
| | | // .setMatnrId(item.getLong("matnrId")) |
| | | .setMatnrCode(matnrCode) |
| | | // .setMaktx(item.getString("maktx")) |
| | | .setQty(qty) |
| | | .setAnfme(qty) |
| | | // .setUnit(item.getString("unit")) |
| | | .setBarcode(palletId) |
| | | .setStatus(1) |
| | | .setDeleted(0) |
| | | .setCreateTime(new Date()); |
| | | if (params.getInteger("prepareType") == 1) { |
| | | locItem.setWkType(Short.parseShort(OrderWorkType.ORDER_WORK_TYPE_NORMAL_MATERIAL_PREPARATION.type)); |
| | | } else { |
| | | locItem.setWkType(Short.parseShort(OrderWorkType.ORDER_WORK_TYPE_FEED_IN_MATERIAL_PREPARATION.type)); |
| | | } |
| | | locItemService.save(locItem); |
| | | } |
| | | // Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getUseStatus, "O").eq(Loc::getAreaId, 22).last("limit 1")); |
| | | // if (loc == null) { |
| | | // return R.error("没有可用库位"); |
| | | // } |
| | | // String palletId = "AA" + String.format("%06d", (int) (Math.random() * 1000000)); |
| | | // |
| | | // for (int i = 0; i < jsonArray.size(); i++) { |
| | | // JSONObject item = jsonArray.getJSONObject(i); |
| | | // loc.setBarcode(palletId); |
| | | // loc.setUseStatus("F"); |
| | | // locService.updateById(loc); |
| | | // |
| | | // LocItem locItem = new LocItem(); |
| | | // String matnrCode = item.getString("matNr"); |
| | | // if (matnrCode == null) { |
| | | // matnrCode = item.getString("matNr"); |
| | | // } |
| | | // Double qty = item.getDouble("anfme"); |
| | | // if (qty == null) { |
| | | // qty = item.getDouble("anfme"); |
| | | // } |
| | | // locItem.setLocId(loc.getId()) |
| | | // .setLocCode(loc.getCode()) |
| | | // .setOrderId(order.getId()) |
| | | // .setType(OrderType.ORDER_OUT.type) |
| | | //// .setWkType(Short.parseShort(OrderWorkType.ORDER_WORK_TYPE_MATERIAL_PREPARATION.type)) |
| | | //// .setMatnrId(item.getLong("matnrId")) |
| | | // .setMatnrCode(matnrCode) |
| | | //// .setMaktx(item.getString("maktx")) |
| | | // .setQty(qty) |
| | | // .setAnfme(qty) |
| | | //// .setUnit(item.getString("unit")) |
| | | // .setBarcode(palletId) |
| | | // .setStatus(1) |
| | | // .setDeleted(0) |
| | | // .setCreateTime(new Date()); |
| | | // if (params.getInteger("prepareType") == 1) { |
| | | // locItem.setWkType(Short.parseShort(OrderWorkType.ORDER_WORK_TYPE_NORMAL_MATERIAL_PREPARATION.type)); |
| | | // } else { |
| | | // locItem.setWkType(Short.parseShort(OrderWorkType.ORDER_WORK_TYPE_FEED_IN_MATERIAL_PREPARATION.type)); |
| | | // } |
| | | // locItemService.save(locItem); |
| | | // } |
| | | |
| | | return R.ok().add(order.getId()); |
| | | } catch (Exception e) { |
| | |
| | | } |
| | | } |
| | | |
| | | @PostMapping("/callForEmptyContainers") |
| | | @ApiOperation("mes呼叫空容器") |
| | | public R callForEmptyContainers(@RequestBody CallForEmptyContainersParam containerWaveParam) { |
| | | |
| | | return pdaOutStockService.callForEmptyContainers(containerWaveParam, 52L); |
| | | } |
| | | |
| | | @PostMapping("/in/emptyContainer/warehousing") |
| | | @ApiOperation("空容器入库") |
| | | public R emptyContainerWarehousing(@RequestBody PdaGeneralParam param) { |
| | | return inBoundService.generateTasks(param, 52L); |
| | | } |
| | | |
| | | } |