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