| | |
| | | package com.consum.base.service; |
| | | |
| | | import com.consum.base.Constants; |
| | | import com.consum.base.core.param.BaseWarehouseParam1; |
| | | import com.consum.base.pojo.LWhFormOutputParam; |
| | | import com.consum.base.util.IdUtil; |
| | | 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 lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | import org.springframework.transaction.interceptor.TransactionAspectSupport; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | @Autowired |
| | | private LWhFormOutputCoreService lWhFormOutputCoreService; |
| | | |
| | | // /** |
| | | private static String QUERY_FORM_OUTPUT_LIST = "SELECT * FROM l_wh_form_output WHERE 1 = 1"; |
| | | |
| | | |
| | | // /** |
| | | // * @Description 新增出库单 |
| | | // * @Author 卢庆阳 |
| | | // * @Date 2023/10/27 |
| | |
| | | int flag5 = 0; |
| | | for (LWhGoodsRecord record : recordList) { |
| | | //根据物品型号查询物品库存 |
| | | int goodsNum = this.lWhGoodsService.queryGoodsModelNum(warehouseId, record.getBaseGoodsModelsId(), (short) 1, null); |
| | | int goodsNum = this.lWhGoodsService.queryGoodsModelNum(0,warehouseId, record.getBaseGoodsModelsId(), (short) 1, null); |
| | | |
| | | //5.新增L_WH_PROCURE_MODEL记录 |
| | | LWhProcureModel lWhProcureModel = new LWhProcureModel(); |
| | |
| | | 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); |
| | | } |
| | | // lWhFormOutputCoreService.outFormByTransId 中已经更新了 |
| | | // if (flag1 > 0) { |
| | | // LWhFormOutput lWhFormOutput1 = new LWhFormOutput(lWhFormOutputId); |
| | | // lWhFormOutput1.setWarehouseFlowId(lWarehouseFlowId); |
| | | // flag3 = this.update(lWhFormOutput1); |
| | | // } |
| | | |
| | | //如果有一条记录新增失败,则回滚 |
| | | if (flag1 == 0 || flag3 == 0 || flag5 != recordList.size()) { |
| | |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | /** |
| | | * @Description 列表查询 |
| | | * @Author 卢庆阳 |
| | | * @Date 2023/10/30 |
| | | */ |
| | | public GenericPager queryFormOutputList(LWhFormOutputParam param) { |
| | | HashMap<String, Object> paramts = new HashMap<>(); |
| | | StringBuilder sql = new StringBuilder(QUERY_FORM_OUTPUT_LIST); |
| | | //出库单号 |
| | | if (!StringUtils.isEmpty(param.getBusinessFormCode())) { |
| | | sql.append(" and BUSINESS_FORM_CODE like :businessFormCode "); |
| | | paramts.put("businessFormCode", StringUtils.CHAR_PERCENT + param.getBusinessFormCode() + StringUtils.CHAR_PERCENT); |
| | | } |
| | | //物品名称 |
| | | if (!StringUtils.isEmpty(param.getGoodsTemplateName())) { |
| | | sql.append(" AND id IN (SELECT BUSINESS_ID FROM L_WH_PROCURE_MODEL procureModel LEFT JOIN BASE_GOODS_MODELS baseModel ON procureModel.BASE_GOODS_MODELS_ID=baseModel.ID LEFT JOIN BASE_GOODS_TEMPLATE baseTemp ON baseModel.GOODS_TEMPLATES_ID=baseTemp.id WHERE procureModel.BUSINESS_TYPE=1 AND baseTemp.GOODS_NAME LIKE :goodsTemplateName)"); |
| | | paramts.put("goodsTemplateName", StringUtils.CHAR_PERCENT + param.getGoodsTemplateName() + StringUtils.CHAR_PERCENT); |
| | | } |
| | | //机构 |
| | | if (param.getAgencyId() != null){ |
| | | sql.append(" and AGENCY_ID like :agencyId "); |
| | | paramts.put("agencyId", param.getAgencyId() + StringUtils.CHAR_PERCENT); |
| | | } |
| | | //创建人 |
| | | if (!StringUtils.isEmpty(param.getOperatorName())) { |
| | | sql.append(" and operator_name =:operator_name "); |
| | | paramts.put("operator_name", param.getOperatorName()); |
| | | } |
| | | //状态 |
| | | if (param.getStates() != null) { |
| | | sql.append(" and states =:states "); |
| | | paramts.put("states", param.getStates()); |
| | | } |
| | | //出库时间 |
| | | if (param.getOutputTimeStart() != null) { |
| | | sql.append(" and DEAL_TIME >=:outputTimeStart "); |
| | | paramts.put("outputTimeStart", param.getOutputTimeStart() * 1000000); |
| | | } |
| | | if (param.getOutputTimeEnd() != null) { |
| | | sql.append(" and DEAL_TIME <:outputTimeEnd "); |
| | | paramts.put("outputTimeEnd", param.getOutputTimeEnd() * 1000000 + 240000); |
| | | } |
| | | |
| | | sql.append(" ORDER BY DEAL_TIME DESC"); |
| | | GenericPager genericPager = selectSplit(sql.toString(), paramts, new LWhFormOutput()); |
| | | return genericPager; |
| | | } |
| | | } |