| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.lang.reflect.Field; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * @ClassName LWhFormProcureController |
| | |
| | | private BaseGoodsTemplateServiceImpl baseGoodsTemplateService; |
| | | @Resource |
| | | private LWhProcureModelService lWhProcureModelService; |
| | | @Resource |
| | | private LOrgSupplierServiceImpl lOrgSupplierService; |
| | | |
| | | /** |
| | | * @Description 新增 |
| | |
| | | return ResponseValue.error("仓库ID不能为空"); |
| | | } |
| | | BaseWarehouse baseWarehouse = baseWarehouseService.getById(warehouseId); |
| | | FinSysTenantUser sysTenantUser = this.getSysInfo(); |
| | | String tenantId = sysTenantUser.getTenantId(); |
| | | String tenantName = sysTenantUser.getTenantName(); |
| | | // 只能添加本机构仓库的进货单 |
| | | //?????? |
| | | // |
| | |
| | | } |
| | | long procureTime = DateUtils.getDateTimeNumber(System.currentTimeMillis()); |
| | | |
| | | Set<String> supplierList = new HashSet<>(); |
| | | |
| | | ArrayList<LWhFormProcureGoods> procureGoodList = new ArrayList<>(); |
| | | ArrayList<LWhProcureModel> whProcureModeLlist = new ArrayList<>(); |
| | | |
| | |
| | | Long baseCategoryId = procureGoodT.getBaseCategoryId(); |
| | | Long baseGoodsTemplateId = procureGoodT.getBaseGoodsTemplateId(); |
| | | String supplier = procureGoodT.getSupplier(); |
| | | // 判断当前供应商是否已存在 |
| | | if (!supplierList.contains(supplier) && !lOrgSupplierService.supplierIsContain(tenantId, supplier)) { |
| | | supplierList.add(supplier); |
| | | } |
| | | |
| | | |
| | | List<LWhProcureModelParams> models = procureGoodT.getModels(); |
| | | if (CollectionUtils.isEmpty(models)) { |
| | | return ResponseValue.error("采购单不能为空"); |
| | |
| | | if (tempGoodsInfo == null) { |
| | | return ResponseValue.error("采购的价型号未找到"); |
| | | } |
| | | String modelName = (String) tempGoodsInfo.get("modelname"); |
| | | // 查询型号库存 |
| | | int goodsModelNum = lWhGoodsService.queryGoodsModelNum(0, warehouseId, baseGoodsModelsId, (short) 1, null); |
| | | LWhProcureModel model = new LWhProcureModel(); |
| | |
| | | model.setBusinessType(WhBusinessEnum.CAIGOU.getValue() + 0); |
| | | model.setBusinessId(whFormProcureId); |
| | | model.setBaseGoodsModelsId(baseGoodsModelsId); |
| | | model.setBaseGoodsModelsName(modelName); |
| | | model.setPrice(price); |
| | | model.setCounts(counts); |
| | | model.setWorehouseCount(goodsModelNum); |
| | |
| | | lWhFormProcure.setAgencyId(baseWarehouse.getAgencyId()); |
| | | lWhFormProcure.setAgencyName(baseWarehouse.getAgencyName()); |
| | | int result = lWhFormProcureService.insert(lWhFormProcure); |
| | | if (result > 0) return ResponseValue.success(1); |
| | | |
| | | supplierList.forEach(supplier -> { |
| | | LOrgSupplier lOrgSupplier = new LOrgSupplier(); |
| | | lOrgSupplier.setId(NumberGenerator.getLongSequenceNumber()); |
| | | lOrgSupplier.setAgencyId(tenantId); |
| | | lOrgSupplier.setAgencyName(tenantName); |
| | | lOrgSupplier.setSupplier(supplier); |
| | | lOrgSupplierService.insert(lOrgSupplier); |
| | | }); |
| | | if (result > 0) { |
| | | return ResponseValue.success(1); |
| | | } |
| | | return ResponseValue.error("新增失败!"); |
| | | } |
| | | |