| | |
| | | package com.consum.base.service.impl; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import org.apache.commons.compress.utils.Lists; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.interceptor.TransactionAspectSupport; |
| | | |
| | | import com.consum.base.core.CodeGeneratorEnum; |
| | | import com.consum.base.core.CodeGeneratorService; |
| | | import com.consum.base.core.WhBusinessEnum; |
| | | import com.consum.base.core.param.BaseWarehouseParam1; |
| | | import com.consum.base.core.service.LWhWarningCoreServiceImpl; |
| | | import com.consum.base.core.type.GoodsModelType; |
| | | import com.consum.base.core.type.OutPutStatesType; |
| | | import com.consum.base.core.utils.CurrencyUtil; |
| | |
| | | import com.consum.base.pojo.LWhFormOutputParam; |
| | | import com.consum.base.pojo.excel.OutputExcelTemplate; |
| | | import com.consum.base.pojo.query.LWhFormOutputQry; |
| | | import com.consum.base.service.BaseGoodsModelsService; |
| | | import com.consum.base.service.BaseWarehouseService; |
| | | import com.consum.base.service.LWhFormOutputService; |
| | | import com.consum.base.service.LWhGoodsService; |
| | | import com.consum.base.service.LWhProcureModelService; |
| | | import com.consum.model.po.BaseGoodsModels; |
| | | import com.consum.model.po.BaseWarehouse; |
| | | import com.consum.model.po.FinSysTenantUser; |
| | | import com.consum.model.po.LWhFormOutput; |
| | | import com.consum.model.po.LWhProcureModel; |
| | | import com.consum.model.po.WhFormOutput; |
| | | import com.consum.base.service.*; |
| | | import com.consum.model.po.*; |
| | | import com.iplatform.model.po.S_user_core; |
| | | import com.walker.db.page.GenericPager; |
| | | import com.walker.infrastructure.utils.CollectionUtils; |
| | | import com.walker.infrastructure.utils.DateUtils; |
| | | import com.walker.infrastructure.utils.StringUtils; |
| | | import com.walker.jdbc.service.BaseServiceImpl; |
| | | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.compress.utils.Lists; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.interceptor.TransactionAspectSupport; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * @Description 出库单 |
| | |
| | | private LWhFormOutputCoreService lWhFormOutputCoreService; |
| | | @Autowired |
| | | private BaseGoodsModelsService baseGoodsModelsService; |
| | | |
| | | @Resource |
| | | private LWhWarningCoreServiceImpl lWhWarningCoreService; |
| | | private static String QUERY_FORM_OUTPUT_LIST = "SELECT * FROM l_wh_form_output WHERE 1 = 1"; |
| | | |
| | | /** |
| | |
| | | return 0; |
| | | } |
| | | // 2.新增物品型号记录 |
| | | Set<Long> allChangModelList = new HashSet<>(); |
| | | List<LWFormsOutputGoodsInfoParam> goodsList = param.getGoods(); |
| | | List<LWhProcureModel> modelList = new ArrayList<>(); |
| | | for (LWFormsOutputGoodsInfoParam goods : goodsList) { |
| | |
| | | lWhProcureModel.setBusinessType(GoodsModelType.OUT_PUT.getValue()); |
| | | lWhProcureModel.setBusinessId(lWhFormOutputId); |
| | | lWhProcureModel.setBaseGoodsModelsId(model.getBaseGoodsModelsId()); |
| | | allChangModelList.add(model.getBaseGoodsModelsId()); |
| | | // 根据型号id查询型号 |
| | | BaseGoodsModels baseGoodsModels = |
| | | this.baseGoodsModelsService.get(new BaseGoodsModels(model.getBaseGoodsModelsId())); |
| | |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | return 0; |
| | | } |
| | | // 4 预警 |
| | | //当库存变动时调用该方法 |
| | | lWhWarningCoreService.updateKuCun((short) 0, warehouseId, new ArrayList<>(allChangModelList), null, DateUtils.getDateTimeNumber(System.currentTimeMillis())); |
| | | |
| | | |
| | | return 1; |
| | | } |
| | |
| | | package com.consum.base.service.impl; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Propagation; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.transaction.interceptor.TransactionAspectSupport; |
| | | |
| | | import cn.hutool.core.convert.Convert; |
| | | import com.consum.base.core.WhBusinessEnum; |
| | | import com.consum.base.core.service.LWhWarningCoreServiceImpl; |
| | | import com.consum.base.core.utils.IdUtil; |
| | | import com.consum.base.core.utils.LockManage; |
| | | import com.consum.base.service.BaseGoodsTemplateService; |
| | | import com.consum.base.service.GoodsBaseServiceImpl; |
| | | import com.consum.base.service.LWarehouseFlowService; |
| | | import com.consum.base.service.LWhFormScrappedGoodsService; |
| | | import com.consum.base.service.LWhGoodsRecordService; |
| | | import com.consum.base.service.LWhGoodsService; |
| | | import com.consum.base.service.*; |
| | | import com.consum.model.po.LWarehouseFlow; |
| | | import com.consum.model.po.LWhFormScrapped; |
| | | import com.consum.model.po.LWhFormScrappedGoods; |
| | | import com.consum.model.po.LWhGoodsRecord; |
| | | import com.iplatform.model.po.S_user_core; |
| | | import com.walker.infrastructure.utils.CollectionUtils; |
| | | |
| | | import cn.hutool.core.convert.Convert; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Propagation; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.transaction.interceptor.TransactionAspectSupport; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @ClassName LWhFormScrappedCoreService |
| | |
| | | // 报废单编号 |
| | | Long transBusinessId = formScrappedGood.getTransBusinessId(); |
| | | |
| | | // 获得锁后查询该型号的期初数量 |
| | | int goodsModelNum = 0; |
| | | List<Long> srappedGoodsIds = null; |
| | | if (warehouseType == null || warehouseType == 0) { |
| | | goodsModelNum = lWhGoodsService.queryGoodsModelNum(warehouseType, warehouseId, baseGoodsModelsId, 1, null); |
| | | srappedGoodsIds = lWhGoodsService.queryScrappedGoodsIds(warehouseType, warehouseId, null, null, |
| | | baseGoodsModelsId, (short)1, counts); |
| | | } else { |
| | |
| | | // 根据分发单、规格型号编号、使用人员名称,进行报废 |
| | | srappedGoodsIds = lWhGoodsService.queryScrappedGoodsIds(warehouseType, warehouseId, |
| | | transBusinessId, userName, baseGoodsModelsId, (short)2, counts); |
| | | goodsModelNum = lWhGoodsService.queryGoodsModelNum(warehouseType, warehouseId, baseGoodsModelsId, 2, null); |
| | | } |
| | | |
| | | if (goodsModelNum < counts) { |
| | | log.error("要报废的物品数量不足"); |
| | | // 手动回滚 |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | throw new RuntimeException("出库失败!型号数量不足"); |
| | | } |
| | | |
| | | if (CollectionUtils.isEmpty(srappedGoodsIds) || srappedGoodsIds.size() < counts) { |
| | |
| | | package com.consum.base.service.impl; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import com.consum.base.core.CodeGeneratorEnum; |
| | | import com.consum.base.core.CodeGeneratorService; |
| | | import com.consum.base.core.utils.*; |
| | | import com.consum.base.pojo.LWhFormScrappedGoodsInfoParam; |
| | | import com.consum.base.pojo.LWhFormScrappedGoodsModelParams; |
| | | import com.consum.base.pojo.LWhFormScrappedParam; |
| | | import com.consum.base.pojo.dto.GoodModelInfoDTO; |
| | | import com.consum.base.pojo.excel.ScrappedInfoExcelTemplate; |
| | | import com.consum.base.pojo.query.LWhFormScrappedQry; |
| | | import com.consum.base.pojo.response.*; |
| | | import com.consum.base.service.*; |
| | | import com.consum.model.po.*; |
| | | import com.iplatform.model.po.S_user_core; |
| | | import com.walker.db.page.GenericPager; |
| | | import com.walker.infrastructure.utils.DateUtils; |
| | | import com.walker.infrastructure.utils.StringUtils; |
| | | import com.walker.jdbc.service.BaseServiceImpl; |
| | | import org.apache.commons.compress.utils.Lists; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | import org.springframework.transaction.interceptor.TransactionAspectSupport; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import com.consum.base.core.CodeGeneratorEnum; |
| | | import com.consum.base.core.CodeGeneratorService; |
| | | import com.consum.base.core.utils.CurrencyUtil; |
| | | import com.consum.base.core.utils.IdUtil; |
| | | import com.consum.base.core.utils.MapUtils; |
| | | import com.consum.base.core.utils.MapperUtil; |
| | | import com.consum.base.core.utils.PageUtil; |
| | | import com.consum.base.pojo.LWhFormScrappedGoodsInfoParam; |
| | | import com.consum.base.pojo.LWhFormScrappedGoodsModelParams; |
| | | import com.consum.base.pojo.LWhFormScrappedParam; |
| | | import com.consum.base.pojo.dto.GoodModelInfoDTO; |
| | | import com.consum.base.pojo.excel.ScrappedInfoExcelTemplate; |
| | | import com.consum.base.pojo.query.LWhFormScrappedQry; |
| | | import com.consum.base.pojo.response.FormScrappedGoodsDetailVO; |
| | | import com.consum.base.pojo.response.GoodsModelVO; |
| | | import com.consum.base.pojo.response.GoodsTemplateCountVO; |
| | | import com.consum.base.pojo.response.GoodsTemplateInfoVO; |
| | | import com.consum.base.pojo.response.LWhFormScrappedExtendVO; |
| | | import com.consum.base.service.BaseGoodsModelsService; |
| | | import com.consum.base.service.BaseGoodsTemplateService; |
| | | import com.consum.base.service.BaseWarehouseService; |
| | | import com.consum.base.service.FinSysTenantDepartmentService; |
| | | import com.consum.base.service.LWhFormScrappedGoodsService; |
| | | import com.consum.base.service.LWhFormScrappedService; |
| | | import com.consum.base.service.LWhGoodsService; |
| | | import com.consum.base.service.SDictDataServiceImpl; |
| | | import com.consum.model.po.BaseGoodsModels; |
| | | import com.consum.model.po.BaseGoodsTemplate; |
| | | import com.consum.model.po.BaseWarehouse; |
| | | import com.consum.model.po.FinSysTenantDepartment; |
| | | import com.consum.model.po.FinSysTenantUser; |
| | | import com.consum.model.po.LWhFormScrapped; |
| | | import com.consum.model.po.LWhFormScrappedGoods; |
| | | import com.consum.model.po.SDictData; |
| | | import com.iplatform.model.po.S_user_core; |
| | | import com.walker.db.page.GenericPager; |
| | | import com.walker.infrastructure.utils.StringUtils; |
| | | import com.walker.jdbc.service.BaseServiceImpl; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @Description 报废单 |
| | |
| | | lWhFormScrapped.setOperatorName(sysInfo.getUserName()); |
| | | lWhFormScrapped.setDealTime(param.getDealTime()); |
| | | lWhFormScrapped.setStates(0); |
| | | lWhFormScrapped.setCreateTime(DateUtils.getDateTimeNumber(System.currentTimeMillis())); |
| | | lWhFormScrapped.setUploadFiles(param.getUploadFiles()); |
| | | // 根据部门id查询部门 |
| | | FinSysTenantDepartment department = this.departmentService.getById(sysInfo.getSysDeptId()); |
| | |
| | | scrappedGoodsList.add(scrappedGoods); |
| | | } |
| | | int flag2 = this.scrappedGoodsService.insertBatch(scrappedGoodsList); |
| | | if (flag2 != scrappedGoodsList.size()) { |
| | | if (flag2 == 0) { |
| | | log.error("新增报废单物品记录 失败"); |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | return 0; |
| | | } |
| | | } |
| | | // 3.根据报废单报废物品 |
| | | Long lWarehouseFlowId = |
| | | this.lWhFormScrappedCoreService.outFormByTransId(lWhFormScrappedId, currentUser, param.getDealTime()); |
| | | Long lWarehouseFlowId = this.lWhFormScrappedCoreService.outFormByTransId(lWhFormScrappedId, currentUser, param.getDealTime()); |
| | | if (lWarehouseFlowId == null) { |
| | | log.error("根据出库单出库 失败"); |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | |
| | | @JsonIgnore |
| | | protected boolean isset_states = false; |
| | | |
| | | private Long createTime = null; |
| | | @JsonIgnore |
| | | protected boolean isset_createTime = false; |
| | | |
| | | /** |
| | | * 默认构造函数 |
| | | */ |
| | |
| | | return this.states == null; |
| | | } |
| | | |
| | | public Long getCreateTime() { |
| | | return this.createTime; |
| | | } |
| | | |
| | | public void setCreateTime(Long createTime) { |
| | | this.createTime = createTime; |
| | | this.isset_createTime = true; |
| | | } |
| | | |
| | | @JsonIgnore |
| | | public boolean isEmptyCreateTime() { |
| | | return this.createTime == null; |
| | | } |
| | | |
| | | /** |
| | | * 重写 toString() 方法 |
| | | */ |
| | |
| | | .append("departmentId=").append(this.departmentId) |
| | | .append("uploadFiles=").append(this.uploadFiles) |
| | | .append("states=").append(this.states) |
| | | .append("createTime=").append(this.createTime) |
| | | .toString(); |
| | | } |
| | | |
| | |
| | | if (this.isset_states) { |
| | | l_wh_form_scrapped.setStates(this.getStates()); |
| | | } |
| | | if (this.isset_createTime) { |
| | | l_wh_form_scrapped.setCreateTime(this.getCreateTime()); |
| | | } |
| | | return l_wh_form_scrapped; |
| | | } |
| | | } |
| | |
| | | import com.walker.jdbc.sqlgen.InsertBuilder; |
| | | import com.walker.jdbc.sqlgen.SelectBuilder; |
| | | import com.walker.jdbc.sqlgen.UpdateBuilder; |
| | | import com.walker.jdbc.util.StringUtils; |
| | | |
| | | import org.springframework.jdbc.core.RowMapper; |
| | | |
| | | import java.sql.ResultSet; |
| | |
| | | public static final String DepartmentId = "department_id"; |
| | | public static final String UploadFiles = "upload_files"; |
| | | public static final String States = "states"; |
| | | public static final String CreateTime = "create_time"; |
| | | |
| | | /** |
| | | * 默认构造函数 |
| | |
| | | } |
| | | if (lWhFormScrapped.isset_states) { |
| | | this.setStates(lWhFormScrapped.getStates()); |
| | | } |
| | | if (lWhFormScrapped.isset_createTime) { |
| | | this.setCreateTime(lWhFormScrapped.getCreateTime()); |
| | | } |
| | | // 去掉,2022-09-07 |
| | | // this.setDatabaseName_(l_wh_form_scrapped.getDatabaseName_()); |
| | |
| | | ib.set(DepartmentId, this.getDepartmentId(), this.isset_departmentId); |
| | | ib.set(UploadFiles, this.getUploadFiles(), this.isset_uploadFiles); |
| | | ib.set(States, this.getStates(), this.isset_states); |
| | | ib.set(CreateTime, this.getCreateTime(), this.isset_createTime); |
| | | return ib.genMapSql(); |
| | | } |
| | | |
| | |
| | | ub.set(DepartmentId, this.getDepartmentId(), this.isset_departmentId); |
| | | ub.set(UploadFiles, this.getUploadFiles(), this.isset_uploadFiles); |
| | | ub.set(States, this.getStates(), this.isset_states); |
| | | ub.set(CreateTime, this.getCreateTime(), this.isset_createTime); |
| | | ub.where(this.getPkName_(), this.getPkValue_()); |
| | | return ub.genMapSql(); |
| | | } |
| | |
| | | ub.set(DepartmentId, this.getDepartmentId(), this.isset_departmentId); |
| | | ub.set(UploadFiles, this.getUploadFiles(), this.isset_uploadFiles); |
| | | ub.set(States, this.getStates(), this.isset_states); |
| | | ub.set(CreateTime, this.getCreateTime(), this.isset_createTime); |
| | | return ub.genMapSql(where, parameters); |
| | | } |
| | | |
| | |
| | | ub.set(DepartmentId, this.getDepartmentId(), this.isset_departmentId); |
| | | ub.set(UploadFiles, this.getUploadFiles(), this.isset_uploadFiles); |
| | | ub.set(States, this.getStates(), this.isset_states); |
| | | ub.set(CreateTime, this.getCreateTime(), this.isset_createTime); |
| | | return ub.genArraySql(where, parameters); |
| | | } |
| | | |
| | |
| | | */ |
| | | @Override |
| | | public SqlAndParameters<Map<String, Object>> getSelectSql_(String where, Map<String, Object> parameters) { |
| | | return new SqlAndParameters<>("select id, l_warehouse_flow_id, business_form_code, warehouse_type, warehouse_id, warehouse_name, agency_id, agency_name, operator_id, operator_name, deal_time, department_name, department_id, upload_files, states from " + this.getTableName_() + " " + where, parameters); |
| | | return new SqlAndParameters<>("select id, l_warehouse_flow_id, business_form_code, warehouse_type, warehouse_id, warehouse_name, agency_id, agency_name, operator_id, operator_name, deal_time, department_name, department_id, upload_files, states, create_time from " + this.getTableName_() + " " + where, parameters); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Override |
| | | public SqlAndParameters<Object[]> getSelectSql_(String where, Object[] parameters) { |
| | | return new SqlAndParameters<>("select id, l_warehouse_flow_id, business_form_code, warehouse_type, warehouse_id, warehouse_name, agency_id, agency_name, operator_id, operator_name, deal_time, department_name, department_id, upload_files, states from " + this.getTableName_() + " " + where, parameters); |
| | | return new SqlAndParameters<>("select id, l_warehouse_flow_id, business_form_code, warehouse_type, warehouse_id, warehouse_name, agency_id, agency_name, operator_id, operator_name, deal_time, department_name, department_id, upload_files, states, create_time from " + this.getTableName_() + " " + where, parameters); |
| | | } |
| | | |
| | | /** |
| | |
| | | l_wh_form_scrapped.setStates(rs.getInt(columnIndex)); |
| | | } |
| | | } |
| | | columnIndex = resultSetUtils.findColumn(rs, LWhFormScrapped_mapper.CreateTime); |
| | | if (columnIndex > 0) { |
| | | if (rs.getBigDecimal(columnIndex) == null) { |
| | | l_wh_form_scrapped.setCreateTime(null); |
| | | } else { |
| | | l_wh_form_scrapped.setCreateTime(rs.getLong(columnIndex)); |
| | | } |
| | | } |
| | | return l_wh_form_scrapped; |
| | | } |
| | | } |