| | |
| | | * @Date 2023/10/30 |
| | | */ |
| | | @GetMapping("/selectByCategoryId") |
| | | public ResponseValue querybyCategoryId(Long categoryId) { |
| | | List<BaseGoodsTemplate> list = this.baseGoodsTemplateService.querybyCategoryId(categoryId); |
| | | public ResponseValue queryByCategoryId(Long categoryId) { |
| | | List<BaseGoodsTemplate> list = this.baseGoodsTemplateService.queryByCategoryId(categoryId); |
| | | return ResponseValue.success(list); |
| | | } |
| | | |
| | |
| | | import com.consum.base.pojo.*; |
| | | import com.consum.base.service.BaseCategoryServiceImpl; |
| | | import com.consum.base.service.LWhFormOutputServiceImpl; |
| | | import com.consum.base.service.LWhProcureModelService; |
| | | import com.consum.model.po.*; |
| | | import com.iplatform.model.po.S_user_core; |
| | | import com.walker.db.page.GenericPager; |
| | |
| | | |
| | | @Autowired |
| | | private LWhFormOutputServiceImpl lWhFormOutputService; |
| | | @Autowired |
| | | private LWhProcureModelService lWhProcureModelService; |
| | | |
| | | /** |
| | | * @Description 新增出库单 |
| | |
| | | |
| | | GenericPager genericPager = lWhFormOutputService.queryFormOutputList(param); |
| | | List<LWhFormOutput> datas = genericPager.getDatas(); |
| | | ArrayList<LWhFormProcureExtend> newDatas = new ArrayList<>(); |
| | | ArrayList<LWhFormOutputExtend> newDatas = new ArrayList<>(); |
| | | if (!CollectionUtils.isEmpty(datas)) { |
| | | datas.forEach(item -> { |
| | | // 查询型号数量 |
| | | LWhProcureModel lWhProcureModel = new LWhProcureModel(); |
| | | lWhProcureModel.setBusinessType(3); |
| | | lWhProcureModel.setBusinessId(item.getId()); |
| | | List<LWhProcureModel> models = lWhFormOutputService.select(lWhProcureModel); |
| | | LWhFormProcureExtend formProcureExtend = new LWhFormProcureExtend(); |
| | | List<LWhProcureModel> models = lWhProcureModelService.select(lWhProcureModel); |
| | | LWhFormOutputExtend formProcureExtend = new LWhFormOutputExtend(); |
| | | BeanUtils.copyProperties(item, formProcureExtend); |
| | | formProcureExtend.setModels(models); |
| | | newDatas.add(formProcureExtend); |
| | |
| | | package com.consum.base.pojo; |
| | | |
| | | import com.consum.model.po.LWhFormOutput; |
| | | import com.consum.model.po.LWhFormProcure; |
| | | import com.consum.model.po.LWhProcureModel; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @ClassName LWhFormProcureExtend |
| | | * @Author cy |
| | | * @Date 2023/10/27 |
| | | * @Description |
| | | * @Author 卢庆阳 |
| | | * @Date 2023/10/30 |
| | | */ |
| | | public class LWhFormOutputExtend extends LWhFormProcure { |
| | | * @Version 1.0 |
| | | **/ |
| | | public class LWhFormOutputExtend extends LWhFormOutput { |
| | | |
| | | private List<LWhProcureModel> models; |
| | | private List<LWhFormProcureGoodsParams> procureGoods; |
| | | |
| | | public List<LWhProcureModel> getModels() { |
| | | return models; |
| | |
| | | this.models = models; |
| | | } |
| | | |
| | | public List<LWhFormProcureGoodsParams> getProcureGoods() { |
| | | return procureGoods; |
| | | } |
| | | |
| | | public void setProcureGoods(List<LWhFormProcureGoodsParams> procureGoods) { |
| | | this.procureGoods = procureGoods; |
| | | } |
| | | } |
| | |
| | | * @Author 卢庆阳 |
| | | * @Date 2023/10/30 |
| | | */ |
| | | public List<BaseGoodsTemplate> querybyCategoryId(Long categoryId) { |
| | | public List<BaseGoodsTemplate> queryByCategoryId(Long categoryId) { |
| | | BaseGoodsTemplate goodsTemplate = new BaseGoodsTemplate(); |
| | | goodsTemplate.setCategoryId(categoryId); |
| | | List<BaseGoodsTemplate> select = this.select(goodsTemplate); |
| | | return select; |
| | | return this.select(goodsTemplate); |
| | | } |
| | | } |
| | |
| | | package com.consum.base.service; |
| | | |
| | | import com.consum.base.core.CodeGeneratorEnum; |
| | | import com.consum.base.core.CodeGeneratorService; |
| | | import com.consum.base.core.param.BaseWarehouseParam1; |
| | | import com.consum.base.pojo.LWhFormOutputParam; |
| | | import com.consum.base.pojo.LWhProcureModelParams; |
| | |
| | | @Service |
| | | public class LWhFormOutputServiceImpl extends BaseServiceImpl { |
| | | |
| | | @Autowired |
| | | private CodeGeneratorService codeGeneratorService; |
| | | @Autowired |
| | | private BaseWarehouseServiceImpl baseWarehouseService; |
| | | @Autowired |
| | |
| | | * @Author 卢庆阳 |
| | | * @Date 2023/10/27 |
| | | */ |
| | | // public int add(LWhFormOutputParam param, S_user_core currentUser, FinSysTenantUser sysInfo) { |
| | | // //1.新增出库单记录 |
| | | // LWhFormOutput lWhFormOutput = new LWhFormOutput(); |
| | | // //出入库id |
| | | // long lWhFormOutputId = IdUtil.generateId(); |
| | | // lWhFormOutput.setId(lWhFormOutputId); |
| | | // Long warehouseId = param.getWarehouseId(); |
| | | // lWhFormOutput.setWarehouseId(warehouseId); |
| | | // //根据仓库id查询仓库 |
| | | // BaseWarehouse warehouse = this.baseWarehouseService.getById(warehouseId); |
| | | // if (warehouse == null) { |
| | | // log.error("仓库id不存在"); |
| | | // return 0; |
| | | // } |
| | | // lWhFormOutput.setWarehouseName(warehouse.getWarehouseName()); |
| | | // lWhFormOutput.setOutputCode(BaseWarehouseParam1.In_OutPutTypeEnum.Fragmentary_Output.getValue() + ""); |
| | | // lWhFormOutput.setOutputName("零星出库"); |
| | | // lWhFormOutput.setAgencyId(Long.valueOf(sysInfo.getTenantId())); |
| | | // lWhFormOutput.setAgencyName(sysInfo.getTenantName()); |
| | | // lWhFormOutput.setOperatorId(sysInfo.getId()); |
| | | // lWhFormOutput.setOperatorName(sysInfo.getUserName()); |
| | | // long dateTimeNumber = DateUtils.getDateTimeNumber(System.currentTimeMillis()); |
| | | // lWhFormOutput.setDealTime(dateTimeNumber); |
| | | // lWhFormOutput.setStates(1); |
| | | // int flag1 = this.insert(lWhFormOutput); |
| | | // |
| | | // //4.新增l_wh_goods_record记录 |
| | | // List<LWhGoodsRecord> recordList = param.getList(); |
| | | // if (CollectionUtils.isEmpty(recordList)) { |
| | | // log.error("规格型号为空"); |
| | | // return 0; |
| | | // } |
| | | // int flag5 = 0; |
| | | // for (LWhGoodsRecord record : recordList) { |
| | | // //根据物品型号查询物品库存 |
| | | // int goodsNum = this.lWhGoodsService.queryGoodsModelNum(0,warehouseId, record.getBaseGoodsModelsId(), (short) 1, null); |
| | | // |
| | | // //5.新增L_WH_PROCURE_MODEL记录 |
| | | // LWhProcureModel lWhProcureModel = new LWhProcureModel(); |
| | | // lWhProcureModel.setId(IdUtil.generateId()); |
| | | // lWhProcureModel.setBusinessType(3); |
| | | // lWhProcureModel.setBaseGoodsModelsId(record.getBaseGoodsModelsId()); |
| | | // lWhProcureModel.setCounts(record.getThisCount()); |
| | | // lWhProcureModel.setWorehouseCount(goodsNum); |
| | | // int res = this.lWhProcureModelService.insert(lWhProcureModel); |
| | | // flag5 += res; |
| | | // } |
| | | // |
| | | // //2.根据出库单出库 |
| | | // Long lWarehouseFlowId = this.lWhFormOutputCoreService.outFormByTransId(lWhFormOutput.getId(), currentUser, dateTimeNumber); |
| | | // //3.向出库单 插入 进出库流水总表ID |
| | | // int flag3 = 0; |
| | | // if (flag1 > 0) { |
| | | // LWhFormOutput lWhFormOutput1 = new LWhFormOutput(lWhFormOutputId); |
| | | // lWhFormOutput1.setWarehouseFlowId(lWarehouseFlowId); |
| | | // flag3 = this.update(lWhFormOutput1); |
| | | // } |
| | | // |
| | | // //如果有一条记录新增失败,则回滚 |
| | | // if (flag1 == 0 || flag3 == 0 || flag5 != recordList.size()) { |
| | | // TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | // return 0; |
| | | // } |
| | | // |
| | | // return 1; |
| | | // } |
| | | |
| | | /** |
| | | * @Description 新增出库单 |
| | | * @Author 卢庆阳 |
| | | * @Date 2023/10/27 |
| | | */ |
| | | public int add(LWhFormOutputParam param, S_user_core currentUser, FinSysTenantUser sysInfo) { |
| | | //1.新增出库单记录 |
| | | LWhFormOutput lWhFormOutput = new LWhFormOutput(); |
| | | //出入库id |
| | | long lWhFormOutputId = IdUtil.generateId(); |
| | | lWhFormOutput.setId(lWhFormOutputId); |
| | | lWhFormOutput.setBusinessFormCode(codeGeneratorService.createBusinessFormCode(CodeGeneratorEnum.OutPut_Warehouse)); |
| | | Long warehouseId = param.getWarehouseId(); |
| | | lWhFormOutput.setWarehouseId(warehouseId); |
| | | //根据仓库id查询仓库 |
| | |
| | | lWhProcureModel.setBusinessType(3); |
| | | lWhProcureModel.setBusinessId(lWhFormOutputId); |
| | | lWhProcureModel.setBaseGoodsModelsId(model.getBaseGoodsModelsId()); |
| | | //lWhProcureModel.se |
| | | lWhProcureModel.setCounts(model.getCounts()); |
| | | //根据物品型号查询物品库存 |
| | | int goodsNum = this.lWhGoodsService.queryGoodsModelNum(0,warehouseId, model.getBaseGoodsModelsId(), (short) 1, null); |
New file |
| | |
| | | package com.consum.base.service; |
| | | |
| | | import com.consum.base.core.CodeGeneratorEnum; |
| | | import com.consum.base.core.CodeGeneratorService; |
| | | import com.consum.base.pojo.LWhFormScrappedGoodsParams; |
| | | import com.consum.base.pojo.LWhFormScrappedParam; |
| | | import com.consum.base.pojo.LWhProcureModelParams; |
| | | import com.consum.base.util.IdUtil; |
| | | import com.consum.model.po.*; |
| | | import com.iplatform.model.po.S_user_core; |
| | | import com.walker.jdbc.service.BaseServiceImpl; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.interceptor.TransactionAspectSupport; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Description 报废单 |
| | | * @Author 卢庆阳 |
| | | * @Date 2023/11/1 |
| | | */ |
| | | @Service |
| | | public class LWhFormScrappedServiceImpl extends BaseServiceImpl { |
| | | @Autowired |
| | | private CodeGeneratorService codeGeneratorService; |
| | | @Autowired |
| | | private BaseWarehouseServiceImpl baseWarehouseService; |
| | | @Autowired |
| | | private FinSysTenantDepartmentServiceImpl departmentService; |
| | | @Autowired |
| | | private LWhGoodsService lWhGoodsService; |
| | | @Autowired |
| | | private LWhFormScrappedGoodsService scrappedGoodsService; |
| | | |
| | | /** |
| | | * 新增 |
| | | * @param param |
| | | * @param sysInfo |
| | | * @param operatorUser |
| | | * @return |
| | | */ |
| | | //1.新增报废单 |
| | | //2.新增报废单物品 |
| | | public int add(LWhFormScrappedParam param, FinSysTenantUser sysInfo, S_user_core operatorUser) { |
| | | //1.新增报废单记录 |
| | | LWhFormScrapped lWhFormScrapped = new LWhFormScrapped(); |
| | | //调拨单id |
| | | long lWhFormTransferId = IdUtil.generateId(); |
| | | lWhFormScrapped.setId(lWhFormTransferId); |
| | | lWhFormScrapped.setBusinessFormCode(codeGeneratorService.createBusinessFormCode(CodeGeneratorEnum.Scrapped)); |
| | | lWhFormScrapped.setWarehouseType(0); |
| | | Long warehouseId = param.getWarehouseId(); |
| | | lWhFormScrapped.setWarehouseId(warehouseId); |
| | | //根据仓库id查询仓库 |
| | | BaseWarehouse warehouse = this.baseWarehouseService.getById(warehouseId); |
| | | if (warehouse == null) { |
| | | log.error("仓库不存在"); |
| | | return 0; |
| | | } |
| | | lWhFormScrapped.setWarehouseName(warehouse.getWarehouseName()); |
| | | lWhFormScrapped.setAgencyId(Long.valueOf(sysInfo.getTenantId())); |
| | | lWhFormScrapped.setAgencyName(sysInfo.getTenantName()); |
| | | lWhFormScrapped.setOperatorId(sysInfo.getSysUserId()); |
| | | lWhFormScrapped.setOperatorName(sysInfo.getUserName()); |
| | | lWhFormScrapped.setDealTime(param.getDealTime()); |
| | | lWhFormScrapped.setStates(0); |
| | | //根据部门id查询部门 |
| | | FinSysTenantDepartment department = this.departmentService.getById(sysInfo.getSysDeptId()); |
| | | if (department != null) { |
| | | lWhFormScrapped.setDepartmentId(sysInfo.getSysDeptId()); |
| | | lWhFormScrapped.setDepartmentName(department.getName()); |
| | | } |
| | | int flag1 = this.insert(lWhFormScrapped); |
| | | if (flag1 == 0) { |
| | | log.error("新增报废单失败"); |
| | | return 0; |
| | | } |
| | | //2.新增报废单物品记录 |
| | | List<LWhFormScrappedGoodsParams> scrappedGoodsParamList = param.getScrappedGoodsList(); |
| | | List<LWhFormScrappedGoods> scrappedGoodsList = new ArrayList<>(); |
| | | for (LWhFormScrappedGoodsParams params : scrappedGoodsParamList) { |
| | | LWhFormScrappedGoods scrappedGoods = new LWhFormScrappedGoods(); |
| | | scrappedGoods.setId(IdUtil.generateId()); |
| | | //根据物品型号查询物品库存 |
| | | int goodsNum = this.lWhGoodsService.queryGoodsModelNum(0,warehouseId, scrappedGoods.getBaseGoodsModelsId(), (short) 1, null); |
| | | if (params.getCounts() > goodsNum) { |
| | | log.error("报废数量大于库存数量"); |
| | | return 0; |
| | | } |
| | | scrappedGoods.setCounts(params.getCounts()); |
| | | scrappedGoods.setScrappedCode(params.getScrappedCode()); |
| | | //TODO 报废原因 |
| | | scrappedGoodsList.add(scrappedGoods); |
| | | } |
| | | int flag2 = this.scrappedGoodsService.insert(scrappedGoodsList); |
| | | if (flag2 != scrappedGoodsList.size()) { |
| | | log.error("新增报废单物品记录"); |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | return 0; |
| | | } |
| | | return 1; |
| | | } |
| | | } |
| | |
| | | @JsonIgnore |
| | | protected boolean isset_baseGoodsModelsId = false; |
| | | |
| | | private String baseGoodsModelsName = null; |
| | | @JsonIgnore |
| | | protected boolean isset_baseGoodsModelsName = false; |
| | | |
| | | private Long price = null; |
| | | @JsonIgnore |
| | | protected boolean isset_price = false; |
| | |
| | | return this.baseGoodsModelsId == null; |
| | | } |
| | | |
| | | public String getBaseGoodsModelsName() { |
| | | return this.baseGoodsModelsName; |
| | | } |
| | | |
| | | public void setBaseGoodsModelsName(String baseGoodsModelsName) { |
| | | this.baseGoodsModelsName = baseGoodsModelsName; |
| | | this.isset_baseGoodsModelsName = true; |
| | | } |
| | | |
| | | @JsonIgnore |
| | | public boolean isEmptyBaseGoodsModelsName() { |
| | | return this.baseGoodsModelsName == null || this.baseGoodsModelsName.length() == 0; |
| | | } |
| | | |
| | | public Long getPrice() { |
| | | return this.price; |
| | | } |
| | |
| | | .append("businessType=").append(this.businessType) |
| | | .append("businessId=").append(this.businessId) |
| | | .append("baseGoodsModelsId=").append(this.baseGoodsModelsId) |
| | | .append("baseGoodsModelsName=").append(this.baseGoodsModelsName) |
| | | .append("price=").append(this.price) |
| | | .append("counts=").append(this.counts) |
| | | .append("worehouseCount=").append(this.worehouseCount) |
| | |
| | | if (this.isset_baseGoodsModelsId) { |
| | | l_wh_procure_model.setBaseGoodsModelsId(this.getBaseGoodsModelsId()); |
| | | } |
| | | if (this.isset_baseGoodsModelsName) { |
| | | l_wh_procure_model.setBaseGoodsModelsName(this.getBaseGoodsModelsName()); |
| | | } |
| | | if (this.isset_price) { |
| | | l_wh_procure_model.setPrice(this.getPrice()); |
| | | } |
| | |
| | | public static final String BusinessType = "business_type"; |
| | | public static final String BusinessId = "business_id"; |
| | | public static final String BaseGoodsModelsId = "base_goods_models_id"; |
| | | public static final String BaseGoodsModelsName = "base_goods_models_name"; |
| | | public static final String Price = "price"; |
| | | public static final String Counts = "counts"; |
| | | public static final String WorehouseCount = "worehouse_count"; |
| | |
| | | } |
| | | if (lWhProcureModel.isset_baseGoodsModelsId) { |
| | | this.setBaseGoodsModelsId(lWhProcureModel.getBaseGoodsModelsId()); |
| | | } |
| | | if (lWhProcureModel.isset_baseGoodsModelsName) { |
| | | this.setBaseGoodsModelsName(lWhProcureModel.getBaseGoodsModelsName()); |
| | | } |
| | | if (lWhProcureModel.isset_price) { |
| | | this.setPrice(lWhProcureModel.getPrice()); |
| | |
| | | ib.set(BusinessType, this.getBusinessType(), this.isset_businessType); |
| | | ib.set(BusinessId, this.getBusinessId(), this.isset_businessId); |
| | | ib.set(BaseGoodsModelsId, this.getBaseGoodsModelsId(), this.isset_baseGoodsModelsId); |
| | | ib.set(BaseGoodsModelsName, this.getBaseGoodsModelsName(), this.isset_baseGoodsModelsName); |
| | | ib.set(Price, this.getPrice(), this.isset_price); |
| | | ib.set(Counts, this.getCounts(), this.isset_counts); |
| | | ib.set(WorehouseCount, this.getWorehouseCount(), this.isset_worehouseCount); |
| | |
| | | ub.set(BusinessType, this.getBusinessType(), this.isset_businessType); |
| | | ub.set(BusinessId, this.getBusinessId(), this.isset_businessId); |
| | | ub.set(BaseGoodsModelsId, this.getBaseGoodsModelsId(), this.isset_baseGoodsModelsId); |
| | | ub.set(BaseGoodsModelsName, this.getBaseGoodsModelsName(), this.isset_baseGoodsModelsName); |
| | | ub.set(Price, this.getPrice(), this.isset_price); |
| | | ub.set(Counts, this.getCounts(), this.isset_counts); |
| | | ub.set(WorehouseCount, this.getWorehouseCount(), this.isset_worehouseCount); |
| | |
| | | ub.set(BusinessType, this.getBusinessType(), this.isset_businessType); |
| | | ub.set(BusinessId, this.getBusinessId(), this.isset_businessId); |
| | | ub.set(BaseGoodsModelsId, this.getBaseGoodsModelsId(), this.isset_baseGoodsModelsId); |
| | | ub.set(BaseGoodsModelsName, this.getBaseGoodsModelsName(), this.isset_baseGoodsModelsName); |
| | | ub.set(Price, this.getPrice(), this.isset_price); |
| | | ub.set(Counts, this.getCounts(), this.isset_counts); |
| | | ub.set(WorehouseCount, this.getWorehouseCount(), this.isset_worehouseCount); |
| | |
| | | ub.set(BusinessType, this.getBusinessType(), this.isset_businessType); |
| | | ub.set(BusinessId, this.getBusinessId(), this.isset_businessId); |
| | | ub.set(BaseGoodsModelsId, this.getBaseGoodsModelsId(), this.isset_baseGoodsModelsId); |
| | | ub.set(BaseGoodsModelsName, this.getBaseGoodsModelsName(), this.isset_baseGoodsModelsName); |
| | | ub.set(Price, this.getPrice(), this.isset_price); |
| | | ub.set(Counts, this.getCounts(), this.isset_counts); |
| | | ub.set(WorehouseCount, this.getWorehouseCount(), this.isset_worehouseCount); |
| | |
| | | */ |
| | | @Override |
| | | public SqlAndParameters<Map<String, Object>> getSelectSql_(String where, Map<String, Object> parameters) { |
| | | return new SqlAndParameters<>("select id, from_procure_goods_id, business_type, business_id, base_goods_models_id, price, counts, worehouse_count, supplier from " + this.getTableName_() + " " + where, parameters); |
| | | return new SqlAndParameters<>("select id, from_procure_goods_id, business_type, business_id, base_goods_models_id, base_goods_models_name, price, counts, worehouse_count, supplier from " + this.getTableName_() + " " + where, parameters); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Override |
| | | public SqlAndParameters<Object[]> getSelectSql_(String where, Object[] parameters) { |
| | | return new SqlAndParameters<>("select id, from_procure_goods_id, business_type, business_id, base_goods_models_id, price, counts, worehouse_count, supplier from " + this.getTableName_() + " " + where, parameters); |
| | | return new SqlAndParameters<>("select id, from_procure_goods_id, business_type, business_id, base_goods_models_id, base_goods_models_name, price, counts, worehouse_count, supplier from " + this.getTableName_() + " " + where, parameters); |
| | | } |
| | | |
| | | /** |
| | |
| | | l_wh_procure_model.setBaseGoodsModelsId(rs.getLong(columnIndex)); |
| | | } |
| | | } |
| | | columnIndex = resultSetUtils.findColumn(rs, LWhProcureModel_mapper.BaseGoodsModelsName); |
| | | if (columnIndex > 0) { |
| | | l_wh_procure_model.setBaseGoodsModelsName(rs.getString(columnIndex)); |
| | | } |
| | | columnIndex = resultSetUtils.findColumn(rs, LWhProcureModel_mapper.Price); |
| | | if (columnIndex > 0) { |
| | | if (rs.getBigDecimal(columnIndex) == null) { |