From 01107e8aadfaf1e84a971d8eeb9ab37e1c5569f3 Mon Sep 17 00:00:00 2001 From: cy <1664593601@qq.com> Date: 星期五, 01 十二月 2023 09:38:56 +0800 Subject: [PATCH] feat: 部门退回/报废公用接口 --- consum-base/src/main/java/com/consum/base/core/WarehouseBusinessServiceBAK.java | 1706 +++++++++++++++++++++++++++++----------------------------- 1 files changed, 853 insertions(+), 853 deletions(-) diff --git a/consum-base/src/main/java/com/consum/base/core/WarehouseBusinessServiceBAK.java b/consum-base/src/main/java/com/consum/base/core/WarehouseBusinessServiceBAK.java index 3ace85a..1660943 100644 --- a/consum-base/src/main/java/com/consum/base/core/WarehouseBusinessServiceBAK.java +++ b/consum-base/src/main/java/com/consum/base/core/WarehouseBusinessServiceBAK.java @@ -1,853 +1,853 @@ -package com.consum.base.core; - -import com.consum.base.core.param.BaseWarehouseParam; -import com.consum.base.core.param.DepBackWarehouseParam; -import com.consum.base.core.utils.SqlParameter; -import com.consum.base.core.utils.SuperMap; -import com.consum.base.core.utils.DateUtil; -import com.consum.model.po.*; -import com.walker.infrastructure.utils.NumberGenerator; -import com.walker.jdbc.service.BaseServiceImpl; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -/** - * 杩涘嚭搴� 涓氬姟澶� 绫� - */ -@Service -public class WarehouseBusinessServiceBAK extends BaseServiceImpl { - - - @Autowired - private WarehouseCoreService coreService; - - /** - * 鎵ц閲囪喘鍏ュ簱 - * 绗竴姝ワ細閫氳繃閲囪喘鍗曘�怶H_FORM_PROCURE銆戞煡璇㈤噰璐崟鍨嬪彿銆怶H_FORM_PROCURE_MODEL銆戞暟鎹� - * 绗簩姝ワ細缁勭粐CheckWarehouseParam锛岃皟鐢╓arehouseCoreService.unifyCheck()鎵ц鍏ュ簱 - * 绗笁姝ワ細鏇存柊閲囪喘鍗曞瀷鍙枫�怶H_FORM_PROCURE_MODEL銆戝簱瀛樼墿鍝佺紪鍙峰瓧娈靛強涓昏〃WH_FORM_PROCURE鐘舵�佷俊鎭� - * 绗洓姝ワ細鏇存柊 杩涘嚭搴撴祦姘达紙浠撳簱锛夈�怶H_GOODS_DETAILS銆� - * @param procure - */ - public void doProcure(WhFormProcure procure){ - - String sql = "SELECT\n" + - " * \n" + - "FROM\n" + - " WH_FORM_PROCURE_MODEL A \n" + - "WHERE\n" + - " A.WH_FORM_PROCURE_ID = :PROCURE_ID"; - - List<WhFormProcureModel> modelList = this.select(sql,new SqlParameter().put("PROCURE_ID",procure.getId()),new WhFormProcureModel()); - - for (WhFormProcureModel model : modelList){ - BaseWarehouseParam param = new BaseWarehouseParam(); - param.setIsCheckIn(true); - param.setWarehouseId(procure.getId()); - param.setCount(model.getCounts()); - param.setFirstInputCode(model.getId().toString()); - param.setFirst_input_type(1); - param.setModelId(model.getBaseGoodsModelsId()); - CheckWarehouseResult result = coreService.unifyCheck(param).get(0); - - - WhGoodsDetails details = new WhGoodsDetails(); - details.setId(result.getWhGoods().getFirstInputHisId()); - details.setBusinessFormId(procure.getId()); - details.setBusinessFormCode(procure.getBusinessFormCode()); - details.setBusinessFormName(procure.getWarehouseName() + "閲囪喘鍏ュ簱鍗�:" + details.getBusinessFormCode()); - details.setInitialCount(result.getInitial_count()); - details.setThisType(1); - details.setEndCount(result.getEnd_count()); - details.setWarehouseId(param.getWarehouseId()); - details.setWarehouseName(procure.getWarehouseName()); - details.setClassification(1); - details.setOperatorId(procure.getOperatorId2()); - details.setOperatorName(procure.getOperatorName2()); - details.setDealTime(procure.getIncomeTime()); - details.setWhGoodsId(result.getWhGoods().getId()); - - this.insert(details); - - - model.setInWhGoodsDetailsId(details.getId()); - update(model); - - procure.setStates(2); - update(procure); - } - } - public void doOutPut(WhFormOutput output){ - String sql = "SELECT\n" + - " * \n" + - "FROM\n" + - " WH_FORM_OUTPUT_GOODS A \n" + - "WHERE\n" + - " A.WH_FORM_OUTPUT_ID = :OUTPUT_ID"; - - List<WhFormOutputGoods> goodsList = this.select(sql,new SqlParameter() - .put("OUTPUT_ID",output.getId()),new WhFormOutputGoods()); - - for (WhFormOutputGoods goods : goodsList){ - BaseWarehouseParam param = new BaseWarehouseParam(); - param.setIsCheckIn(false); - param.setWarehouseId(output.getWarehouseId()); - param.setModelId(goods.getBaseGoodsModelsId()); - param.setCount(goods.getCounts()); - - List<CheckWarehouseResult> results = coreService.unifyCheck(param); - for (CheckWarehouseResult result : results){ - WhFormOutputModel model = new WhFormOutputModel(); - model.setId(NumberGenerator.getLongSequenceNumber()); - model.setCounts(result.getInitial_count() - result.getEnd_count()); - model.setOutWhGoodsDetailsId(result.getWhGoods().getId()); - model.setWhGoodsId(result.getWhGoods().getId()); - model.setWhFormOutputId(output.getId()); - model.setWhFormOutputGoodsId(goods.getId()); - insert(model); - - WhGoodsDetails details = new WhGoodsDetails(); - details.setBusinessFormId(output.getId()); - details.setBusinessFormCode(output.getBusinessFormCode()); - details.setBusinessFormName("鍑哄簱鍗曪細" + output.getBusinessFormCode()); - details.setInitialCount(result.getInitial_count()); - details.setThisType(2); - details.setThisCount(result.getInitial_count() - result.getEnd_count()); - details.setEndCount(result.getEnd_count()); - details.setWarehouseId(result.getWhGoods().getWarehouseId()); - details.setWarehouseName(result.getWhGoods().getWarehouseName()); - details.setClassification(3); - details.setOperatorId(output.getOperatorId()); - details.setOperatorName(output.getOperatorName()); - details.setDealTime(output.getDealTime()); - details.setWhGoodsId(result.getWhGoods().getId()); - this.insert(details); - } - } - } - - - /** - * 鎵ц璋冩嫧鍑哄簱鎿嶄綔 - * 1. 閫氳繃璋冩嫧鍗曘�怶H_FORM_TRANSFER銆戙�佽皟鎷ㄥ崟鐗╁搧銆怶H_FORM_TRANSFER_GOODS銆戠粍缁嘋heckWarehouseParam - * 2. 璋冪敤璋冪敤WarehouseCoreService.unifyCheck()鎵ц鍑哄簱 - * 3. 鏇存柊杩涘嚭搴撴祦姘达紙浠撳簱锛夈�怶H_GOODS_DETAILS銆� - * 4. 鏇存柊璋冩嫧鍗曘�怶H_FORM_TRANSFER銆戜负寰呮帴鏀讹紝鏇存柊璋冩嫧鍗曠墿鍝併�怶H_FORM_TRANSFER_MODEL銆戝嚭搴撴祦姘碔D - * @param transfer - */ - public void doTransferOutPut(WhFormTransfer transfer){ - String sql = "SELECT\n" + - " * \n" + - "FROM\n" + - " WH_FORM_TRANSFER_GOODS A \n" + - "WHERE\n" + - " A.WH_FORM_TRANSFER_ID = :TRANSFER_ID"; - - List<WhFormTransferGoods> goodsList = this.select(sql,new SqlParameter() - .put("TRANSFER_ID",transfer.getId()),new WhFormTransferGoods()); - - for (WhFormTransferGoods goods : goodsList){ - BaseWarehouseParam param = new BaseWarehouseParam(); - param.setIsCheckIn(false); - param.setWarehouseId(transfer.getOutWarehouseId()); - param.setCount(goods.getCounts()); - List<CheckWarehouseResult> results = coreService.unifyCheck(param); - for (CheckWarehouseResult result : results){ - WhFormTransferModel model = new WhFormTransferModel(); - model.setId(NumberGenerator.getLongSequenceNumber()); - model.setWhFormTransferId(transfer.getId()); - model.setWorehouseCount(result.getInitial_count()); - model.setCounts(result.getInitial_count() - result.getEnd_count()); - model.setOutWhGoodsDetailsId(result.getWhGoods().getId()); - model.setWhFormTransferGoodsId(goods.getId()); - insert(model); - - WhGoodsDetails details = new WhGoodsDetails(); - details.setBusinessFormId(transfer.getId()); - details.setBusinessFormCode(transfer.getBusinessFormCode()); - details.setBusinessFormName("璋冩嫧鍑哄簱鍗曪細" + transfer.getBusinessFormCode()); - details.setInitialCount(result.getInitial_count()); - details.setThisType(2); - details.setThisCount(result.getInitial_count() - result.getEnd_count()); - details.setEndCount(result.getEnd_count()); - details.setWarehouseId(result.getWhGoods().getWarehouseId()); - details.setWarehouseName(result.getWhGoods().getWarehouseName()); - details.setClassification(5); - details.setOperatorId(transfer.getOperatorId()); - details.setOperatorName(transfer.getOperatorName()); - details.setDealTime(transfer.getOutputTime()); - details.setWhGoodsId(result.getWhGoods().getId()); - this.insert(details); - } - } - } - - /** - * 鎵ц璋冩嫧鍏ュ簱鎿嶄綔 - * 1. 閫氳繃璋冩嫧鍗曘�怶H_FORM_TRANSFER銆戙�佽皟鎷ㄥ崟鐗╁搧銆怶H_FORM_TRANSFER_GOODS銆戠粍缁嘋heckWarehouseParam - * 2. 璋冪敤璋冪敤WarehouseCoreService.unifyCheck()鎵ц鍑哄簱 - * 3. 鏇存柊杩涘嚭搴撴祦姘达紙浠撳簱锛夈�怶H_GOODS_DETAILS銆� - * 4. 鏇存柊璋冩嫧鍗曘�怶H_FORM_TRANSFER銆戜负宸插叆搴擄紝锛屾洿鏂拌皟鎷ㄥ崟鐗╁搧銆怶H_FORM_TRANSFER_MODEL銆戝叆搴撴祦姘碔D - * @param transfer - */ - public void doTransferInPut(WhFormTransfer transfer){ - - String sql = "SELECT\n" + - " * \n" + - "FROM\n" + - " WH_FORM_TRANSFER_MODEL A \n" + - "WHERE\n" + - " A.WH_FORM_TRANSFER_ID = :TRANSFER_ID"; - - List<WhFormTransferModel> modelsList = this.select(sql,new SqlParameter() - .put("TRANSFER_ID",transfer.getId()),new WhFormTransferModel()); - - for (WhFormTransferModel model : modelsList) { - BaseWarehouseParam param = new BaseWarehouseParam(); - param.setIsCheckIn(true); - param.setWarehouseId(transfer.getInWarehouseId()); - param.setCount(model.getCounts()); - param.setWh_goods_id(model.getWhGoodsId()); - CheckWarehouseResult result = coreService.unifyCheck(param).get(0); - - WhGoodsDetails details = new WhGoodsDetails(); - details.setBusinessFormId(transfer.getId()); - details.setBusinessFormCode(transfer.getBusinessFormCode()); - details.setBusinessFormName("璋冩嫧鍏ュ簱鍗曪細" + transfer.getBusinessFormCode()); - details.setInitialCount(result.getInitial_count()); - details.setThisType(1); - details.setThisCount(result.getEnd_count()-result.getInitial_count()); - details.setEndCount(result.getEnd_count()); - details.setWarehouseId(result.getWhGoods().getWarehouseId()); - details.setWarehouseName(result.getWhGoods().getWarehouseName()); - details.setClassification(4); - details.setOperatorId(transfer.getOperatorId2()); - details.setOperatorName(transfer.getOperatorName2()); - details.setDealTime(transfer.getIninputTime()); - details.setWhGoodsId(result.getWhGoods().getId()); - this.insert(details); - - model.setInWhGoodsDetailsId(details.getId()); - update(model); - } - } - - /** - * 鎶ュ簾鍗� - * @param scrapped - */ - public void doScrapped(WhFormScrapped scrapped){ - String sql = "SELECT\n" + - " * \n" + - "FROM\n" + - " WH_FORM_SCRAPPED_GOODS A \n" + - "WHERE\n" + - " A.DEP_FORM_SCRAPPED_ID = :SCRAPPED_ID"; - - List<WhFormScrappedGoods> goodsList = this.select(sql,new SqlParameter() - .put("SCRAPPED_ID",scrapped.getId()),new WhFormScrappedGoods()); - - for (WhFormScrappedGoods goods : goodsList){ - BaseWarehouseParam param = new BaseWarehouseParam(); - param.setIsCheckIn(false); - param.setWarehouseId(scrapped.getWarehouseId()); - param.setCount(goods.getCounts()); - List<CheckWarehouseResult> results = coreService.unifyCheck(param); - for (CheckWarehouseResult result : results){ - - - WhGoodsDetails details = new WhGoodsDetails(); - details.setBusinessFormId(scrapped.getId()); - details.setBusinessFormCode(scrapped.getBusinessFormCode()); - details.setBusinessFormName("鎶ュ簾鍗曪細" + scrapped.getBusinessFormCode()); - details.setInitialCount(result.getInitial_count()); - details.setThisType(2); - details.setThisCount(result.getInitial_count() - result.getEnd_count()); - details.setEndCount(result.getEnd_count()); - details.setWarehouseId(result.getWhGoods().getWarehouseId()); - details.setWarehouseName(result.getWhGoods().getWarehouseName()); - details.setClassification(10); - details.setOperatorId(scrapped.getOperatorId()); - details.setOperatorName(scrapped.getOperatorName()); - details.setDealTime(scrapped.getDealTime()); - details.setWhGoodsId(result.getWhGoods().getId()); - this.insert(details); - - - WhFormScrappedModel model = new WhFormScrappedModel(); - model.setId(NumberGenerator.getLongSequenceNumber()); - model.setCounts(result.getWhGoods().getWhCount()); - model.setScrappedCode(goods.getScrappedCode()); - model.setScrappedName(goods.getScrappedName()); - model.setDepGoodsDetailsId(details.getId()); - model.setDepFormScrappedId(scrapped.getId()); - model.setWhGoodsId(result.getWhGoods().getId()); - model.setWhFormScrappedGoodsId(goods.getId()); - insert(model); - } - } - } - - /** - * 鍒涘缓鐩樼偣浠诲姟锛屽垱寤虹洏鐐逛换鍔℃椂锛屾牴鎹綋鏃舵椂闂翠細灏嗗簱瀛樻暟鎹喕缁撲竴浠芥斁鍏ュ緟鐩樼偣鍗曘�� - * 1.浠庡簱瀛樼墿鍝併�怶H_GOODS銆戜腑鎸夌収浠撳簱灏嗘暟鎹斁鍏ョ洏鐐瑰崟鐗╁搧銆怶H_FORM_INVENTORY_GOODS銆戯紝涓昏鏄� - * 鏈熷垵鏁伴噺INIT_COUNTS锛屽拰 搴撳瓨鐗╁搧缂栧彿WH_GOODS_ID瀛楁 - * @param inventory - */ - public void createInventoryForm(WhFormInventory inventory){ - String sql = - "SELECT\n" + - " b.BASE_GOODS_TEMPLATE_ID,\n" + - " b.GOODS_TEMPLATE_NAME,\n" + - " SUM( b.WH_COUNT ) AS WH_COUNT,\n" + - " b.BASE_GOODS_MODELS_ID,\n" + - " b.BASE_GOODS_MODELS_NAME,\n" + - " b.UNIT \n" + - "FROM\n" + - " (\n" + - " SELECT\n" + - " ID \n" + - " FROM\n" + - " BASE_GOODS_MODELS m \n" + - " WHERE\n" + - " STATES != 3 \n" + - " AND EXISTS ( SELECT 1 FROM BASE_GOODS_TEMPLATE t WHERE t.ID = m.GOODS_TEMPLATES_ID AND t.STATES != 3 ) \n" + - " ) a\n" + - " LEFT JOIN wh_goods b ON a.ID = b.BASE_GOODS_MODELS_ID \n" + - "WHERE\n" + - " b.STATES = 1 \n" + - " AND b.WAREHOUSE_ID =:WAREHOUSE_ID \n" + - "GROUP BY\n" + - " b.BASE_GOODS_TEMPLATE_ID,\n" + - " b.GOODS_TEMPLATE_NAME,\n" + - " b.BASE_GOODS_MODELS_ID,\n" + - " b.BASE_GOODS_MODELS_NAME"; - - List<WhGoods> goodsList = select(sql,new SqlParameter().add("WAREHOUSE_ID",inventory.getWarehouseId())); - List<WhFormInventoryGoods> list = new ArrayList<>(); - for (WhGoods goods : goodsList) { - WhFormInventoryGoods inventoryGoods = new WhFormInventoryGoods(); - inventoryGoods.setId(NumberGenerator.getLongSequenceNumber()); - inventoryGoods.setWhFormInventoryId(inventory.getId()); - inventoryGoods.setBaseGoodsTemplateId(goods.getBaseGoodsTemplateId()); - inventoryGoods.setGoodsTemplateName(goods.getGoodsTemplateName()); - inventoryGoods.setUnit(goods.getUnit()); - inventoryGoods.setBaseGoodsModelsId(goods.getBaseGoodsModelsId()); - inventoryGoods.setBaseGoodsModelsName(goods.getBaseGoodsModelsName()); - inventoryGoods.setInitCounts(goods.getWhCount()); - inventoryGoods.setInitCounts(null); - inventoryGoods.setErrorCounts(null); - inventoryGoods.setInventoryResult(1); - list.add(inventoryGoods); - } - insertBatch(list); - - } - - /** - * 鐩樼偣鍑哄簱 - * @param inventory - */ - public void doInventoryOutput(WhFormInventory inventory){ - String sql = "SELECT\n" + - " * \n" + - "FROM\n" + - " WH_FORM_INVENTORY_GOODS A \n" + - "WHERE\n" + - " A.WH_FORM_INVENTORY_ID = :INVENTORY_ID \n" + - " AND A.INVENTORY_RESULT =3 "; - - List<WhFormInventoryGoods> goodsList = this.select(sql,new SqlParameter() - .put("INVENTORY_ID",inventory.getId()),new WhFormInventoryGoods()); - - for (WhFormInventoryGoods goods : goodsList){ - BaseWarehouseParam param = new BaseWarehouseParam(); - param.setIsCheckIn(false); - param.setWarehouseId(inventory.getWarehouseId()); - param.setCount(goods.getErrorCounts()); - param.setModelId(goods.getBaseGoodsModelsId()); - param.setOutput_type(3); - List<CheckWarehouseResult> results = coreService.unifyCheck(param); - for (CheckWarehouseResult result : results){ - - WhGoodsDetails details = new WhGoodsDetails(); - details.setBusinessFormId(inventory.getId()); - details.setBusinessFormCode(inventory.getBusinessFormCode()); - details.setBusinessFormName("鐩樼偣鍑哄崟锛�" + inventory.getBusinessFormCode()); - - details.setInitialCount(result.getInitial_count()); - details.setThisType(2); - details.setThisCount(result.getInitial_count() - result.getEnd_count()); - details.setEndCount(result.getEnd_count()); - details.setWarehouseId(result.getWhGoods().getWarehouseId()); - details.setWarehouseName(result.getWhGoods().getWarehouseName()); - details.setClassification(9); - details.setOperatorId(inventory.getOperatorId()); - details.setOperatorName(inventory.getOperatorName()); - details.setDealTime(inventory.getStopTime()); - details.setWhGoodsId(result.getWhGoods().getId()); - this.insert(details); - - - WhFormInventoryModel model = new WhFormInventoryModel(); - model.setId(NumberGenerator.getLongSequenceNumber()); - model.setCounts(result.getWhGoods().getWhCount()); - model.setWhFormInventoryId(inventory.getId()); - model.setInventoryResult(3); - model.setWhGoodsDetailsId(details.getId()); - model.setWhFormInventoryGoodsId(goods.getId()); - model.setWhGoodsId(result.getWhGoods().getId()); - insert(model); - } - } - } - - /** - * 鐩樼偣鍏ュ簱 - * @param inventory - */ - public void doInventoryInput(WhFormInventory inventory){ - String sql = "SELECT\n" + - " * \n" + - "FROM\n" + - " WH_FORM_INVENTORY_GOODS A \n" + - "WHERE\n" + - " A.WH_FORM_INVENTORY_ID = :INVENTORY_ID \n" + - " AND A.INVENTORY_RESULT =2 "; - - List<WhFormInventoryGoods> goodsList = this.select(sql,new SqlParameter() - .put("INVENTORY_ID",inventory.getId()),new WhFormInventoryGoods()); - - for (WhFormInventoryGoods goods : goodsList){ - BaseWarehouseParam param = new BaseWarehouseParam(); - param.setIsCheckIn(true); - param.setWarehouseId(inventory.getWarehouseId()); - param.setCount(goods.getErrorCounts()); - param.setModelId(goods.getBaseGoodsModelsId()); - param.setFirst_input_type(3); - CheckWarehouseResult result = coreService.unifyCheck(param).get(0); - - WhGoodsDetails details = new WhGoodsDetails(); - details.setBusinessFormId(inventory.getId()); - details.setBusinessFormCode(inventory.getBusinessFormCode()); - details.setBusinessFormName("鐩樼偣鍏ュ簱鍗曪細" + inventory.getBusinessFormCode()); - - details.setInitialCount(result.getInitial_count()); - details.setThisType(1); - details.setThisCount(result.getEnd_count()-result.getInitial_count()); - details.setEndCount(result.getEnd_count()); - details.setWarehouseId(result.getWhGoods().getWarehouseId()); - details.setWarehouseName(result.getWhGoods().getWarehouseName()); - details.setClassification(8); - details.setOperatorId(inventory.getOperatorId()); - details.setOperatorName(inventory.getOperatorName()); - details.setDealTime(inventory.getStopTime()); - details.setWhGoodsId(result.getWhGoods().getId()); - this.insert(details); - - - WhFormInventoryModel model = new WhFormInventoryModel(); - model.setId(NumberGenerator.getLongSequenceNumber()); - model.setCounts(result.getWhGoods().getWhCount()); - model.setWhFormInventoryId(inventory.getId()); - model.setInventoryResult(3); - model.setWhGoodsDetailsId(details.getId()); - model.setWhFormInventoryGoodsId(goods.getId()); - model.setWhGoodsId(result.getWhGoods().getId()); - insert(model); - } - } - - /** - * 缁熶竴澶勭悊搴撳瓨棰勮锛堝畾鏃朵换鍔¤皟鐢ㄦ湇鍔★級 - * 璁″垝锛氭瘡澶╀腑鍗�13锛�00銆佹櫄涓�1:00鎵ц涓ゆ - */ - public void insertWarning(){ - - String sql = "SELECT\n" + - " SUM(b.WH_COUNT) AS WH_COUNT,\n" + - " b.BASE_GOODS_TEMPLATE_ID,\n" + - " b.GOODS_TEMPLATE_NAME,\n" + - " b.WAREHOUSE_ID,\n" + - " a.UPPER_LIMIT,\n" + - " a.LOWER_LIMIT \n" + - "FROM\n" + - " WH_WARNING_CONFIG a\n" + - " LEFT JOIN wh_goods b ON a.BASE_GOODS_TEMPLATE_ID = b.BASE_GOODS_TEMPLATE_ID \n" + - "WHERE\n" + - " a.BASE_WAREHOUSE_ID = b.WAREHOUSE_ID \n" + - " AND b.STATES = 1 \n" + - " AND a.GOODS_TYPE=1\n" + - " AND ( a.UPPER_LIMIT <= WH_COUNT OR a.LOWER_LIMIT >= WH_COUNT ) \n" + - "GROUP BY\n" + - " b.BASE_GOODS_TEMPLATE_ID,\n" + - " b.GOODS_TEMPLATE_NAME,\n" + - " b.WAREHOUSE_ID,\n" + - " a.UPPER_LIMIT,\n" + - " a.LOWER_LIMIT"; - - List<Map> goodslist = select(sql,new SqlParameter()); - - sql = "SELECT\n" + - " SUM(b.WH_COUNT) AS WH_COUNT,\n" + - " b.BASE_GOODS_TEMPLATE_ID,\n" + - " b.GOODS_TEMPLATE_NAME,\n" + - " b.BASE_GOODS_MODELS_ID,\n" + - " b.BASE_GOODS_MODELS_NAME,\n" + - " b.WAREHOUSE_ID,\n" + - " a.UPPER_LIMIT,\n" + - " a.LOWER_LIMIT \n" + - "FROM\n" + - " WH_WARNING_CONFIG a\n" + - " LEFT JOIN wh_goods b ON a.BASE_GOODS_MODELS_ID = b.BASE_GOODS_MODELS_ID \n" + - "WHERE\n" + - " a.BASE_WAREHOUSE_ID = b.WAREHOUSE_ID \n" + - " AND b.STATES = 1 \n" + - " AND a.GOODS_TYPE=2\n" + - " AND ( a.UPPER_LIMIT <= WH_COUNT OR a.LOWER_LIMIT >= WH_COUNT ) \n" + - "GROUP BY\n" + - " b.BASE_GOODS_TEMPLATE_ID,\n" + - " b.GOODS_TEMPLATE_NAME,\n" + - " b.BASE_GOODS_MODELS_ID,\n" + - " b.BASE_GOODS_MODELS_NAME,\n" + - " b.WAREHOUSE_ID,\n" + - " a.UPPER_LIMIT,\n" + - " a.LOWER_LIMIT"; - - List<Map> modeslist = select(sql,new SqlParameter()); - - List<Map> list = new ArrayList<>(); - list.addAll(goodslist); - list.addAll(modeslist); - - List<WhWarning> warningList = new ArrayList<>(); - for (Map map : list) { - SuperMap superMap = new SuperMap(map); - BaseWarehouse warehouse = get(new BaseWarehouse(),"ID=?",new Object[]{superMap.get("WAREHOUSE_ID")}); - - WhWarning warning = new WhWarning(); - warning.setId(NumberGenerator.getLongSequenceNumber()); - warning.setBaseWarehouseId(warehouse.getId()); - warning.setBaseWarehouseName(warehouse.getWarehouseName()); - warning.setBaseGoodsTemplateId(superMap.getLong("BASE_GOODS_TEMPLATE_ID")); - warning.setBaseGoodsTemplateName(superMap.getString("GOODS_TEMPLATE_NAME")); - if (superMap.getString("BASE_GOODS_MODELS_ID") == null){ - warning.setGoodsType(1); - } else { - warning.setBaseGoodsModelsId(superMap.getLong("BASE_GOODS_MODELS_ID")); - warning.setBaseGoodsModelsName(superMap.getString("BASE_GOODS_MODELS_NAME")); - warning.setGoodsType(2); - } - - int whCount = superMap.getInteger("WH_COUNT"); - int upCount = superMap.getInteger("UPPER_LIMIT"); - int lowCount = superMap.getInteger("LOWER_LIMIT"); - - if (whCount >= upCount){ - warning.setWarningType(1); - } - if (whCount<=lowCount){ - warning.setWarningType(2); - } - - warning.setUpperLimit(upCount); - warning.setLowerLimit(lowCount); - warning.setWarehouseCount(whCount); - warning.setStates(1); - warning.setWarningTime(DateUtil.getCurrentDateFor14()); - warning.setAgencyId(warehouse.getAgencyId()); - warning.setAgencyName(warehouse.getAgencyName()); - - warningList.add(warning); - } - - insertBatch(warningList); - } - - public void doDepBack(String depFormBackId){ - - DepFormBack back = get(new DepFormBack(),"ID=?",new Object[]{depFormBackId}); - - String sql = "SELECT\n" + - " B.*,\n" + - " A.BACK_COUNTS, \n" + - " A.ID AS DEP_FORM_BACK_GOODS_ID \n" + - "FROM\n" + - " DEP_FORM_BACK_GOODS A\n" + - " LEFT JOIN DEP_FORM_LENDING_GOODS B ON A.DEP_FORM_LENDING_GOODS_ID = B.ID \n" + - "WHERE\n" + - " A.DEP_FORM_BACK_ID = :DEP_FORM_BACK_ID \n" + - " AND A.WAREHOUSE_ID = B.WAREHOUSE_ID \n" + - " AND A.WAREHOUSE_ID = :WAREHOUSE_ID"; - - List<Map> list = select(sql,new SqlParameter("DEP_FORM_BACK_ID",back.getId()).add("WAREHOUSE_ID",back.getWarehouseId())); - - for (Map myMap : list) { - SuperMap map = new SuperMap(myMap); - - CheckUsingParam param = new CheckUsingParam(); - param.setIsCheckIn(false); - param.setLending_id(map.getLong("DEP_FORM_LENDING_ID")); - param.setModel_id(map.getLong("BASE_GOODS_MODELS_ID")); - param.setUser_name(map.getString("GOODS_USER_NAME")); - - List<CheckUsingResult> resultList = coreService.unifyUsingCheck(param); - for (CheckUsingResult result : resultList) { - BaseWarehouseParam param1 = new DepBackWarehouseParam(); - param1.setIsCheckIn(true); - param1.setWarehouseId(result.getLendingModel().getWarehouseId()); - param1.setModelId(result.getLendingModel().getBaseGoodsModelsId()); - param1.setCount(result.getEnd_count() - result.getInitial_count()); - param1.setFirst_input_type(4); - - //鍏ュ簱骞跺瓨鍏ユ祦姘� - CheckWarehouseResult result1 = coreService.unifyCheck(param1).get(0); - WhGoodsDetails details = new WhGoodsDetails(); - details.setId(result1.getWhGoods().getFirstInputHisId()); - details.setBusinessFormId(back.getId()); - details.setBusinessFormCode(back.getBusinessFormCode()); - details.setBusinessFormName(back.getWarehouseName() + "杩斿簱鍏ュ簱鍗�:" + details.getBusinessFormCode()); - details.setInitialCount(result.getInitial_count()); - details.setThisType(1); - details.setEndCount(result.getEnd_count()); - details.setWarehouseId(back.getWarehouseId()); - details.setWarehouseName(back.getWarehouseName()); - details.setClassification(1); - details.setOperatorId(back.getOperatorId()); - details.setOperatorName(back.getOperatorName()); - details.setDealTime(back.getDealTime()); - details.setWhGoodsId(result1.getWhGoods().getId()); - - this.insert(details); - - - //瀛樺叆鍦ㄧ敤娴佹按 - UsingGoodsHis his = new UsingGoodsHis(); - his.setId(NumberGenerator.getLongSequenceNumber()); - his.setBusinessFormId(back.getId()); - his.setBusinessFormCode(back.getBusinessFormCode()); - his.setBusinessFormName("杩斿簱鍗曪細" + back.getBusinessFormCode()); - his.setClassification(3); - his.setOperatorId(back.getOperatorId()); - his.setOperatorName(back.getOperatorName()); - his.setDealTime(back.getDealTime()); - his.setDepFormLendingModelId(result.getLendingModel().getId()); - his.setDepFormLendingGoodsId(result.getLendingModel().getDepFormLendingGoodsId()); - his.setDepFormLendingId(result.getLendingModel().getDepFormLendingId()); - his.setWhGoodsId(result.getLendingModel().getWhGoodsId()); - his.setInitialCount(result.getInitial_count()); - his.setEndCount(result.getEnd_count()); - his.setWarehouseId(back.getWarehouseId()); - his.setWarehouseName(back.getWarehouseName()); - his.setDepartmentId(back.getDepartmentId()); - his.setDepartmentName(back.getDepartmentName()); - insert(his); - - DepFormBackModel model = new DepFormBackModel(); - model.setId(NumberGenerator.getLongSequenceNumber()); - model.setDepFormBackGoodsId(map.getLong("DEP_FORM_BACK_GOODS_ID")); - model.setDepFormBackId(back.getId()); - model.setWhGoodsDetailsId(result1.getWh_goods_detail_id()); - model.setUsingGoodsHisId(his.getId()); - model.setWhGoodsId(his.getWhGoodsId()); - model.setCounts(his.getThisCount()); - model.setDepFormLendingModelId(his.getDepFormLendingModelId()); - model.setDepFormLendingGoodsId(his.getDepFormLendingGoodsId()); - model.setDepFormLendingId(his.getDepFormLendingId()); - model.setWhGoodsId(his.getWhGoodsId()); - insert(model); - } - - } - - - } - - - /** - * 閮ㄩ棬鐗╁搧鍒嗗彂 - */ - public void doDepLending(DepFormLending lending){ - String sql = "SELECT\n" + - " * \n" + - "FROM\n" + - " DEP_FORM_LENDING_GOODS A \n" + - "WHERE\n" + - " A.DEP_FORM_LENDING_ID = :LENDING_ID"; - - List<DepFormLendingGoods> goodsList = this.select(sql,new SqlParameter() - .put("LENDING_ID",lending.getId()),new DepFormLendingGoods()); - - for (DepFormLendingGoods goods : goodsList){ - BaseWarehouseParam param = new BaseWarehouseParam(); - param.setIsCheckIn(false); - param.setWarehouseId(lending.getWarehouseId()); - param.setModelId(goods.getBaseGoodsModelsId()); - param.setCount(goods.getCounts()); - - //棣栧厛浠庢満鏋勪粨搴撳嚭搴� - List<CheckWarehouseResult> results = coreService.unifyCheck(param); - for (CheckWarehouseResult result : results){ - WhGoodsDetails details = new WhGoodsDetails(); - details.setId(NumberGenerator.getLongSequenceNumber()); - details.setBusinessFormId(lending.getId()); - details.setBusinessFormCode(lending.getBusinessFormCode()); - details.setBusinessFormName("鍒嗗彂鍗曪細" + lending.getBusinessFormCode()); - details.setInitialCount(result.getInitial_count()); - details.setThisType(2); - details.setThisCount(result.getInitial_count() - result.getEnd_count()); - details.setEndCount(result.getEnd_count()); - details.setWarehouseId(result.getWhGoods().getWarehouseId()); - details.setWarehouseName(result.getWhGoods().getWarehouseName()); - details.setClassification(11); - details.setOperatorId(lending.getOperatorId()); - details.setOperatorName(lending.getOperatorName()); - details.setDealTime(lending.getDealTime()); - details.setWhGoodsId(result.getWhGoods().getId()); - this.insert(details); - - //鍥炲~鍑哄簱娴佹按ID锛岀敤浜庡垎鍙戞椂浣跨敤 - result.setWh_goods_detail_id(details.getId()); - } - - CheckUsingParam usingParam = new CheckUsingParam(); - usingParam.setIsCheckIn(true); - usingParam.setInput_type(1); - usingParam.setOutputList(results); - - List<CheckUsingResult> usingResults = coreService.unifyUsingCheck(usingParam); - for (CheckUsingResult usingResult : usingResults) { - UsingGoodsHis his = new UsingGoodsHis(); - his.setId(NumberGenerator.getLongSequenceNumber()); - his.setBusinessFormId(lending.getId()); - his.setBusinessFormCode(lending.getBusinessFormCode()); - his.setBusinessFormName("鍒嗗彂鍗曪細" + lending.getBusinessFormCode()); - his.setClassification(1); - his.setOperatorId(lending.getOperatorId()); - his.setOperatorName(lending.getOperatorName()); - his.setDealTime(lending.getDealTime()); - his.setDepFormLendingModelId(usingResult.getLendingModel().getId()); - his.setDepFormLendingGoodsId(usingResult.getLendingModel().getDepFormLendingGoodsId()); - his.setDepFormLendingId(lending.getId()); - his.setWhGoodsId(usingResult.getLendingModel().getWhGoodsId()); - his.setInitialCount(usingResult.getInitial_count()); - his.setEndCount(usingResult.getEnd_count()); - his.setWarehouseId(lending.getWarehouseId()); - his.setWarehouseName(lending.getWarehouseName()); - his.setDepartmentId(lending.getDepartmentId()); - his.setDepartmentName(lending.getDepartmentName()); - insert(his); - } - } - } - - public void doDepScrapped(String dep_form_scrapped_id){ - - DepFormScrapped scrapped = get(new DepFormScrapped(),"ID=?",new Object[]{dep_form_scrapped_id}); - - String sql = "SELECT\n" + - " B.*,\n" + - " A.SCRAPPED_COUNTS, \n" + - " A.ID AS DEP_FORM_SCRAPPED_GOODS_ID \n" + - "FROM\n" + - " DEP_FORM_SCRAPPED_GOODS A\n" + - " LEFT JOIN DEP_FORM_LENDING_GOODS B ON A.DEP_FORM_LENDING_GOODS_ID = B.ID \n" + - "WHERE\n" + - " A.DEP_FORM_SCRAPPED_ID = :DEP_FORM_SCRAPPED_ID \n" + - " AND A.WAREHOUSE_ID = B.WAREHOUSE_ID \n" + - " AND A.WAREHOUSE_ID = :WAREHOUSE_ID"; - - List<Map> list = select(sql,new SqlParameter("DEP_FORM_SCRAPPED_ID",scrapped.getId()).add("WAREHOUSE_ID",scrapped.getWarehouseId())); - for (Map _map : list) { - SuperMap map = new SuperMap(_map); - - CheckUsingParam param = new CheckUsingParam(); - param.setIsCheckIn(false); - param.setOutputCount(map.getInteger("SCRAPPED_COUNTS")); - param.setLending_id(map.getLong("DEP_FORM_LENDING_ID")); - param.setModel_id(map.getLong("BASE_GOODS_MODELS_ID")); - param.setUser_name(map.getString("GOODS_USER_NAME")); - - List<CheckUsingResult> resultList = coreService.unifyUsingCheck(param); - - for (CheckUsingResult result : resultList) { - - //瀛樺叆鍦ㄧ敤娴佹按 - UsingGoodsHis his = new UsingGoodsHis(); - his.setId(NumberGenerator.getLongSequenceNumber()); - his.setBusinessFormId(scrapped.getId()); - his.setBusinessFormCode(scrapped.getBusinessFormCode()); - his.setBusinessFormName("閮ㄩ棬鎶ュ簾鍗曪細" + scrapped.getBusinessFormCode()); - his.setClassification(4); - his.setOperatorId(scrapped.getOperatorId()); - his.setOperatorName(scrapped.getOperatorName()); - his.setDealTime(scrapped.getDealTime()); - his.setDepFormLendingModelId(result.getLendingModel().getId()); - his.setDepFormLendingGoodsId(result.getLendingModel().getDepFormLendingGoodsId()); - his.setDepFormLendingId(result.getLendingModel().getDepFormLendingId()); - his.setWhGoodsId(result.getLendingModel().getWhGoodsId()); - his.setInitialCount(result.getInitial_count()); - his.setEndCount(result.getEnd_count()); - his.setWarehouseId(scrapped.getWarehouseId()); - his.setWarehouseName(scrapped.getWarehouseName()); - his.setDepartmentId(scrapped.getDepartmentId()); - his.setDepartmentName(scrapped.getDepartmentName()); - insert(his); - - - DepFormScrappedModel model = new DepFormScrappedModel(); - model.setId(NumberGenerator.getLongSequenceNumber()); - model.setDepFormScrappedGoodsId(map.getLong("DEP_FORM_SCRAPPED_GOODS_ID")); - model.setScrappedCode(map.getString("SCRAPPED_CODE")); - model.setScrappedName(map.getString("SCRAPPED_NAME")); - model.setUsingGoodsHisId(his.getId()); - model.setDepFormScrappedId(scrapped.getId()); - model.setWhGoodsId(his.getWhGoodsId()); - model.setScrappedCounts(his.getThisCount()); - model.setInitCount(his.getInitialCount()); - model.setDepFormLendingModelId(his.getDepFormLendingModelId()); - model.setDepFormLendingGoodsId(his.getDepFormLendingGoodsId()); - model.setDepFormLendingId(his.getDepFormLendingId()); - insert(model); - } - } - } - - /** - * 鐢ㄤ簬鍙樻洿鐗╁搧浣跨敤浜哄悗锛屾洿鏂板簱瀛樼墿鍝佷娇鐢ㄤ汉淇℃伅銆� - * @param dep_form_lending_goods_user_id - */ - public void changeUser(Long dep_form_lending_goods_user_id){ - DepFormLendingGoodsUser user = get(new DepFormLendingGoodsUser(),"ID=?",new Object[]{dep_form_lending_goods_user_id}); - DepFormLendingGoods goods = get(new DepFormLendingGoods(),"ID=?",new Object[]{user.getDepFormLendingGoodsId()}); - - - String sql = - "UPDATE DEP_FORM_LENDING_MODEL \n" + - "SET NOW_USER_NAME =:NOW_USER_NAME,\n" + - "NOW_USER_PHONE =:NOW_USER_PHONE \n" + - "WHERE\n" + - " DEP_FORM_LENDING_GOODS_ID =:DEP_FORM_LENDING_GOODS_ID \n" + - " AND BASE_GOODS_MODELS_ID =:BASE_GOODS_MODELS_ID \n" + - " AND NOW_USER_NAME =:OLD_USER_NAME\n" + - " AND USING_COUNT > 0"; - - List<SqlParameter> parameterList = new ArrayList<>(); - List<DepFormLendingModel> modelList = select(new DepFormLendingModel(),"DEP_FORM_LENDING_GOODS_ID=?",new Object[]{goods.getId()}); - for (DepFormLendingModel model : modelList) { - if (model.getUsingCount() == 0) continue; - SqlParameter parameter = new SqlParameter(); - parameter.add("NOW_USER_NAME",user.getNowUserName()) - .add("NOW_USER_PHONE",user.getNowUserPhone()) - .add("DEP_FORM_LENDING_GOODS_ID",goods.getId()) - .add("BASE_GOODS_MODELS_ID",goods.getBaseGoodsModelsId()) - .add("OLD_USER_NAME",goods.getGoodsUserName()); - parameterList.add(parameter); - } - execBatchUpdate(sql,parameterList); - } -} +//package com.consum.base.core; +// +//import com.consum.base.core.param.BaseWarehouseParam; +//import com.consum.base.core.param.DepBackWarehouseParam; +//import com.consum.base.core.utils.SqlParameter; +//import com.consum.base.core.utils.SuperMap; +//import com.consum.base.core.utils.DateUtil; +//import com.consum.model.po.*; +//import com.walker.infrastructure.utils.NumberGenerator; +//import com.walker.jdbc.service.BaseServiceImpl; +//import org.springframework.beans.factory.annotation.Autowired; +//import org.springframework.stereotype.Service; +// +//import java.util.ArrayList; +//import java.util.List; +//import java.util.Map; +// +///** +// * 杩涘嚭搴� 涓氬姟澶� 绫� +// */ +//@Service +//public class WarehouseBusinessServiceBAK extends BaseServiceImpl { +// +// +// @Autowired +// private WarehouseCoreService coreService; +// +// /** +// * 鎵ц閲囪喘鍏ュ簱 +// * 绗竴姝ワ細閫氳繃閲囪喘鍗曘�怶H_FORM_PROCURE銆戞煡璇㈤噰璐崟鍨嬪彿銆怶H_FORM_PROCURE_MODEL銆戞暟鎹� +// * 绗簩姝ワ細缁勭粐CheckWarehouseParam锛岃皟鐢╓arehouseCoreService.unifyCheck()鎵ц鍏ュ簱 +// * 绗笁姝ワ細鏇存柊閲囪喘鍗曞瀷鍙枫�怶H_FORM_PROCURE_MODEL銆戝簱瀛樼墿鍝佺紪鍙峰瓧娈靛強涓昏〃WH_FORM_PROCURE鐘舵�佷俊鎭� +// * 绗洓姝ワ細鏇存柊 杩涘嚭搴撴祦姘达紙浠撳簱锛夈�怶H_GOODS_DETAILS銆� +// * @param procure +// */ +// public void doProcure(WhFormProcure procure){ +// +// String sql = "SELECT\n" + +// " * \n" + +// "FROM\n" + +// " WH_FORM_PROCURE_MODEL A \n" + +// "WHERE\n" + +// " A.WH_FORM_PROCURE_ID = :PROCURE_ID"; +// +// List<WhFormProcureModel> modelList = this.select(sql,new SqlParameter().put("PROCURE_ID",procure.getId()),new WhFormProcureModel()); +// +// for (WhFormProcureModel model : modelList){ +// BaseWarehouseParam param = new BaseWarehouseParam(); +// param.setIsCheckIn(true); +// param.setWarehouseId(procure.getId()); +// param.setCount(model.getCounts()); +// param.setFirstInputCode(model.getId().toString()); +// param.setFirst_input_type(1); +// param.setModelId(model.getBaseGoodsModelsId()); +// CheckWarehouseResult result = coreService.unifyCheck(param).get(0); +// +// +// WhGoodsDetails details = new WhGoodsDetails(); +// details.setId(result.getWhGoods().getFirstInputHisId()); +// details.setBusinessFormId(procure.getId()); +// details.setBusinessFormCode(procure.getBusinessFormCode()); +// details.setBusinessFormName(procure.getWarehouseName() + "閲囪喘鍏ュ簱鍗�:" + details.getBusinessFormCode()); +// details.setInitialCount(result.getInitial_count()); +// details.setThisType(1); +// details.setEndCount(result.getEnd_count()); +// details.setWarehouseId(param.getWarehouseId()); +// details.setWarehouseName(procure.getWarehouseName()); +// details.setClassification(1); +// details.setOperatorId(procure.getOperatorId2()); +// details.setOperatorName(procure.getOperatorName2()); +// details.setDealTime(procure.getIncomeTime()); +// details.setWhGoodsId(result.getWhGoods().getId()); +// +// this.insert(details); +// +// +// model.setInWhGoodsDetailsId(details.getId()); +// update(model); +// +// procure.setStates(2); +// update(procure); +// } +// } +// public void doOutPut(WhFormOutput output){ +// String sql = "SELECT\n" + +// " * \n" + +// "FROM\n" + +// " WH_FORM_OUTPUT_GOODS A \n" + +// "WHERE\n" + +// " A.WH_FORM_OUTPUT_ID = :OUTPUT_ID"; +// +// List<WhFormOutputGoods> goodsList = this.select(sql,new SqlParameter() +// .put("OUTPUT_ID",output.getId()),new WhFormOutputGoods()); +// +// for (WhFormOutputGoods goods : goodsList){ +// BaseWarehouseParam param = new BaseWarehouseParam(); +// param.setIsCheckIn(false); +// param.setWarehouseId(output.getWarehouseId()); +// param.setModelId(goods.getBaseGoodsModelsId()); +// param.setCount(goods.getCounts()); +// +// List<CheckWarehouseResult> results = coreService.unifyCheck(param); +// for (CheckWarehouseResult result : results){ +// WhFormOutputModel model = new WhFormOutputModel(); +// model.setId(NumberGenerator.getLongSequenceNumber()); +// model.setCounts(result.getInitial_count() - result.getEnd_count()); +// model.setOutWhGoodsDetailsId(result.getWhGoods().getId()); +// model.setWhGoodsId(result.getWhGoods().getId()); +// model.setWhFormOutputId(output.getId()); +// model.setWhFormOutputGoodsId(goods.getId()); +// insert(model); +// +// WhGoodsDetails details = new WhGoodsDetails(); +// details.setBusinessFormId(output.getId()); +// details.setBusinessFormCode(output.getBusinessFormCode()); +// details.setBusinessFormName("鍑哄簱鍗曪細" + output.getBusinessFormCode()); +// details.setInitialCount(result.getInitial_count()); +// details.setThisType(2); +// details.setThisCount(result.getInitial_count() - result.getEnd_count()); +// details.setEndCount(result.getEnd_count()); +// details.setWarehouseId(result.getWhGoods().getWarehouseId()); +// details.setWarehouseName(result.getWhGoods().getWarehouseName()); +// details.setClassification(3); +// details.setOperatorId(output.getOperatorId()); +// details.setOperatorName(output.getOperatorName()); +// details.setDealTime(output.getDealTime()); +// details.setWhGoodsId(result.getWhGoods().getId()); +// this.insert(details); +// } +// } +// } +// +// +// /** +// * 鎵ц璋冩嫧鍑哄簱鎿嶄綔 +// * 1. 閫氳繃璋冩嫧鍗曘�怶H_FORM_TRANSFER銆戙�佽皟鎷ㄥ崟鐗╁搧銆怶H_FORM_TRANSFER_GOODS銆戠粍缁嘋heckWarehouseParam +// * 2. 璋冪敤璋冪敤WarehouseCoreService.unifyCheck()鎵ц鍑哄簱 +// * 3. 鏇存柊杩涘嚭搴撴祦姘达紙浠撳簱锛夈�怶H_GOODS_DETAILS銆� +// * 4. 鏇存柊璋冩嫧鍗曘�怶H_FORM_TRANSFER銆戜负寰呮帴鏀讹紝鏇存柊璋冩嫧鍗曠墿鍝併�怶H_FORM_TRANSFER_MODEL銆戝嚭搴撴祦姘碔D +// * @param transfer +// */ +// public void doTransferOutPut(WhFormTransfer transfer){ +// String sql = "SELECT\n" + +// " * \n" + +// "FROM\n" + +// " WH_FORM_TRANSFER_GOODS A \n" + +// "WHERE\n" + +// " A.WH_FORM_TRANSFER_ID = :TRANSFER_ID"; +// +// List<WhFormTransferGoods> goodsList = this.select(sql,new SqlParameter() +// .put("TRANSFER_ID",transfer.getId()),new WhFormTransferGoods()); +// +// for (WhFormTransferGoods goods : goodsList){ +// BaseWarehouseParam param = new BaseWarehouseParam(); +// param.setIsCheckIn(false); +// param.setWarehouseId(transfer.getOutWarehouseId()); +// param.setCount(goods.getCounts()); +// List<CheckWarehouseResult> results = coreService.unifyCheck(param); +// for (CheckWarehouseResult result : results){ +// WhFormTransferModel model = new WhFormTransferModel(); +// model.setId(NumberGenerator.getLongSequenceNumber()); +// model.setWhFormTransferId(transfer.getId()); +// model.setWorehouseCount(result.getInitial_count()); +// model.setCounts(result.getInitial_count() - result.getEnd_count()); +// model.setOutWhGoodsDetailsId(result.getWhGoods().getId()); +// model.setWhFormTransferGoodsId(goods.getId()); +// insert(model); +// +// WhGoodsDetails details = new WhGoodsDetails(); +// details.setBusinessFormId(transfer.getId()); +// details.setBusinessFormCode(transfer.getBusinessFormCode()); +// details.setBusinessFormName("璋冩嫧鍑哄簱鍗曪細" + transfer.getBusinessFormCode()); +// details.setInitialCount(result.getInitial_count()); +// details.setThisType(2); +// details.setThisCount(result.getInitial_count() - result.getEnd_count()); +// details.setEndCount(result.getEnd_count()); +// details.setWarehouseId(result.getWhGoods().getWarehouseId()); +// details.setWarehouseName(result.getWhGoods().getWarehouseName()); +// details.setClassification(5); +// details.setOperatorId(transfer.getOperatorId()); +// details.setOperatorName(transfer.getOperatorName()); +// details.setDealTime(transfer.getOutputTime()); +// details.setWhGoodsId(result.getWhGoods().getId()); +// this.insert(details); +// } +// } +// } +// +// /** +// * 鎵ц璋冩嫧鍏ュ簱鎿嶄綔 +// * 1. 閫氳繃璋冩嫧鍗曘�怶H_FORM_TRANSFER銆戙�佽皟鎷ㄥ崟鐗╁搧銆怶H_FORM_TRANSFER_GOODS銆戠粍缁嘋heckWarehouseParam +// * 2. 璋冪敤璋冪敤WarehouseCoreService.unifyCheck()鎵ц鍑哄簱 +// * 3. 鏇存柊杩涘嚭搴撴祦姘达紙浠撳簱锛夈�怶H_GOODS_DETAILS銆� +// * 4. 鏇存柊璋冩嫧鍗曘�怶H_FORM_TRANSFER銆戜负宸插叆搴擄紝锛屾洿鏂拌皟鎷ㄥ崟鐗╁搧銆怶H_FORM_TRANSFER_MODEL銆戝叆搴撴祦姘碔D +// * @param transfer +// */ +// public void doTransferInPut(WhFormTransfer transfer){ +// +// String sql = "SELECT\n" + +// " * \n" + +// "FROM\n" + +// " WH_FORM_TRANSFER_MODEL A \n" + +// "WHERE\n" + +// " A.WH_FORM_TRANSFER_ID = :TRANSFER_ID"; +// +// List<WhFormTransferModel> modelsList = this.select(sql,new SqlParameter() +// .put("TRANSFER_ID",transfer.getId()),new WhFormTransferModel()); +// +// for (WhFormTransferModel model : modelsList) { +// BaseWarehouseParam param = new BaseWarehouseParam(); +// param.setIsCheckIn(true); +// param.setWarehouseId(transfer.getInWarehouseId()); +// param.setCount(model.getCounts()); +// param.setWh_goods_id(model.getWhGoodsId()); +// CheckWarehouseResult result = coreService.unifyCheck(param).get(0); +// +// WhGoodsDetails details = new WhGoodsDetails(); +// details.setBusinessFormId(transfer.getId()); +// details.setBusinessFormCode(transfer.getBusinessFormCode()); +// details.setBusinessFormName("璋冩嫧鍏ュ簱鍗曪細" + transfer.getBusinessFormCode()); +// details.setInitialCount(result.getInitial_count()); +// details.setThisType(1); +// details.setThisCount(result.getEnd_count()-result.getInitial_count()); +// details.setEndCount(result.getEnd_count()); +// details.setWarehouseId(result.getWhGoods().getWarehouseId()); +// details.setWarehouseName(result.getWhGoods().getWarehouseName()); +// details.setClassification(4); +// details.setOperatorId(transfer.getOperatorId2()); +// details.setOperatorName(transfer.getOperatorName2()); +// details.setDealTime(transfer.getIninputTime()); +// details.setWhGoodsId(result.getWhGoods().getId()); +// this.insert(details); +// +// model.setInWhGoodsDetailsId(details.getId()); +// update(model); +// } +// } +// +// /** +// * 鎶ュ簾鍗� +// * @param scrapped +// */ +// public void doScrapped(WhFormScrapped scrapped){ +// String sql = "SELECT\n" + +// " * \n" + +// "FROM\n" + +// " WH_FORM_SCRAPPED_GOODS A \n" + +// "WHERE\n" + +// " A.DEP_FORM_SCRAPPED_ID = :SCRAPPED_ID"; +// +// List<WhFormScrappedGoods> goodsList = this.select(sql,new SqlParameter() +// .put("SCRAPPED_ID",scrapped.getId()),new WhFormScrappedGoods()); +// +// for (WhFormScrappedGoods goods : goodsList){ +// BaseWarehouseParam param = new BaseWarehouseParam(); +// param.setIsCheckIn(false); +// param.setWarehouseId(scrapped.getWarehouseId()); +// param.setCount(goods.getCounts()); +// List<CheckWarehouseResult> results = coreService.unifyCheck(param); +// for (CheckWarehouseResult result : results){ +// +// +// WhGoodsDetails details = new WhGoodsDetails(); +// details.setBusinessFormId(scrapped.getId()); +// details.setBusinessFormCode(scrapped.getBusinessFormCode()); +// details.setBusinessFormName("鎶ュ簾鍗曪細" + scrapped.getBusinessFormCode()); +// details.setInitialCount(result.getInitial_count()); +// details.setThisType(2); +// details.setThisCount(result.getInitial_count() - result.getEnd_count()); +// details.setEndCount(result.getEnd_count()); +// details.setWarehouseId(result.getWhGoods().getWarehouseId()); +// details.setWarehouseName(result.getWhGoods().getWarehouseName()); +// details.setClassification(10); +// details.setOperatorId(scrapped.getOperatorId()); +// details.setOperatorName(scrapped.getOperatorName()); +// details.setDealTime(scrapped.getDealTime()); +// details.setWhGoodsId(result.getWhGoods().getId()); +// this.insert(details); +// +// +// WhFormScrappedModel model = new WhFormScrappedModel(); +// model.setId(NumberGenerator.getLongSequenceNumber()); +// model.setCounts(result.getWhGoods().getWhCount()); +// model.setScrappedCode(goods.getScrappedCode()); +// model.setScrappedName(goods.getScrappedName()); +// model.setDepGoodsDetailsId(details.getId()); +// model.setDepFormScrappedId(scrapped.getId()); +// model.setWhGoodsId(result.getWhGoods().getId()); +// model.setWhFormScrappedGoodsId(goods.getId()); +// insert(model); +// } +// } +// } +// +// /** +// * 鍒涘缓鐩樼偣浠诲姟锛屽垱寤虹洏鐐逛换鍔℃椂锛屾牴鎹綋鏃舵椂闂翠細灏嗗簱瀛樻暟鎹喕缁撲竴浠芥斁鍏ュ緟鐩樼偣鍗曘�� +// * 1.浠庡簱瀛樼墿鍝併�怶H_GOODS銆戜腑鎸夌収浠撳簱灏嗘暟鎹斁鍏ョ洏鐐瑰崟鐗╁搧銆怶H_FORM_INVENTORY_GOODS銆戯紝涓昏鏄� +// * 鏈熷垵鏁伴噺INIT_COUNTS锛屽拰 搴撳瓨鐗╁搧缂栧彿WH_GOODS_ID瀛楁 +// * @param inventory +// */ +// public void createInventoryForm(WhFormInventory inventory){ +// String sql = +// "SELECT\n" + +// " b.BASE_GOODS_TEMPLATE_ID,\n" + +// " b.GOODS_TEMPLATE_NAME,\n" + +// " SUM( b.WH_COUNT ) AS WH_COUNT,\n" + +// " b.BASE_GOODS_MODELS_ID,\n" + +// " b.BASE_GOODS_MODELS_NAME,\n" + +// " b.UNIT \n" + +// "FROM\n" + +// " (\n" + +// " SELECT\n" + +// " ID \n" + +// " FROM\n" + +// " BASE_GOODS_MODELS m \n" + +// " WHERE\n" + +// " STATES != 3 \n" + +// " AND EXISTS ( SELECT 1 FROM BASE_GOODS_TEMPLATE t WHERE t.ID = m.GOODS_TEMPLATES_ID AND t.STATES != 3 ) \n" + +// " ) a\n" + +// " LEFT JOIN wh_goods b ON a.ID = b.BASE_GOODS_MODELS_ID \n" + +// "WHERE\n" + +// " b.STATES = 1 \n" + +// " AND b.WAREHOUSE_ID =:WAREHOUSE_ID \n" + +// "GROUP BY\n" + +// " b.BASE_GOODS_TEMPLATE_ID,\n" + +// " b.GOODS_TEMPLATE_NAME,\n" + +// " b.BASE_GOODS_MODELS_ID,\n" + +// " b.BASE_GOODS_MODELS_NAME"; +// +// List<WhGoods> goodsList = select(sql,new SqlParameter().add("WAREHOUSE_ID",inventory.getWarehouseId())); +// List<WhFormInventoryGoods> list = new ArrayList<>(); +// for (WhGoods goods : goodsList) { +// WhFormInventoryGoods inventoryGoods = new WhFormInventoryGoods(); +// inventoryGoods.setId(NumberGenerator.getLongSequenceNumber()); +// inventoryGoods.setWhFormInventoryId(inventory.getId()); +// inventoryGoods.setBaseGoodsTemplateId(goods.getBaseGoodsTemplateId()); +// inventoryGoods.setGoodsTemplateName(goods.getGoodsTemplateName()); +// inventoryGoods.setUnit(goods.getUnit()); +// inventoryGoods.setBaseGoodsModelsId(goods.getBaseGoodsModelsId()); +// inventoryGoods.setBaseGoodsModelsName(goods.getBaseGoodsModelsName()); +// inventoryGoods.setInitCounts(goods.getWhCount()); +// inventoryGoods.setInitCounts(null); +// inventoryGoods.setErrorCounts(null); +// inventoryGoods.setInventoryResult(1); +// list.add(inventoryGoods); +// } +// insertBatch(list); +// +// } +// +// /** +// * 鐩樼偣鍑哄簱 +// * @param inventory +// */ +// public void doInventoryOutput(WhFormInventory inventory){ +// String sql = "SELECT\n" + +// " * \n" + +// "FROM\n" + +// " WH_FORM_INVENTORY_GOODS A \n" + +// "WHERE\n" + +// " A.WH_FORM_INVENTORY_ID = :INVENTORY_ID \n" + +// " AND A.INVENTORY_RESULT =3 "; +// +// List<WhFormInventoryGoods> goodsList = this.select(sql,new SqlParameter() +// .put("INVENTORY_ID",inventory.getId()),new WhFormInventoryGoods()); +// +// for (WhFormInventoryGoods goods : goodsList){ +// BaseWarehouseParam param = new BaseWarehouseParam(); +// param.setIsCheckIn(false); +// param.setWarehouseId(inventory.getWarehouseId()); +// param.setCount(goods.getErrorCounts()); +// param.setModelId(goods.getBaseGoodsModelsId()); +// param.setOutput_type(3); +// List<CheckWarehouseResult> results = coreService.unifyCheck(param); +// for (CheckWarehouseResult result : results){ +// +// WhGoodsDetails details = new WhGoodsDetails(); +// details.setBusinessFormId(inventory.getId()); +// details.setBusinessFormCode(inventory.getBusinessFormCode()); +// details.setBusinessFormName("鐩樼偣鍑哄崟锛�" + inventory.getBusinessFormCode()); +// +// details.setInitialCount(result.getInitial_count()); +// details.setThisType(2); +// details.setThisCount(result.getInitial_count() - result.getEnd_count()); +// details.setEndCount(result.getEnd_count()); +// details.setWarehouseId(result.getWhGoods().getWarehouseId()); +// details.setWarehouseName(result.getWhGoods().getWarehouseName()); +// details.setClassification(9); +// details.setOperatorId(inventory.getOperatorId()); +// details.setOperatorName(inventory.getOperatorName()); +// details.setDealTime(inventory.getStopTime()); +// details.setWhGoodsId(result.getWhGoods().getId()); +// this.insert(details); +// +// +// WhFormInventoryModel model = new WhFormInventoryModel(); +// model.setId(NumberGenerator.getLongSequenceNumber()); +// model.setCounts(result.getWhGoods().getWhCount()); +// model.setWhFormInventoryId(inventory.getId()); +// model.setInventoryResult(3); +// model.setWhGoodsDetailsId(details.getId()); +// model.setWhFormInventoryGoodsId(goods.getId()); +// model.setWhGoodsId(result.getWhGoods().getId()); +// insert(model); +// } +// } +// } +// +// /** +// * 鐩樼偣鍏ュ簱 +// * @param inventory +// */ +// public void doInventoryInput(WhFormInventory inventory){ +// String sql = "SELECT\n" + +// " * \n" + +// "FROM\n" + +// " WH_FORM_INVENTORY_GOODS A \n" + +// "WHERE\n" + +// " A.WH_FORM_INVENTORY_ID = :INVENTORY_ID \n" + +// " AND A.INVENTORY_RESULT =2 "; +// +// List<WhFormInventoryGoods> goodsList = this.select(sql,new SqlParameter() +// .put("INVENTORY_ID",inventory.getId()),new WhFormInventoryGoods()); +// +// for (WhFormInventoryGoods goods : goodsList){ +// BaseWarehouseParam param = new BaseWarehouseParam(); +// param.setIsCheckIn(true); +// param.setWarehouseId(inventory.getWarehouseId()); +// param.setCount(goods.getErrorCounts()); +// param.setModelId(goods.getBaseGoodsModelsId()); +// param.setFirst_input_type(3); +// CheckWarehouseResult result = coreService.unifyCheck(param).get(0); +// +// WhGoodsDetails details = new WhGoodsDetails(); +// details.setBusinessFormId(inventory.getId()); +// details.setBusinessFormCode(inventory.getBusinessFormCode()); +// details.setBusinessFormName("鐩樼偣鍏ュ簱鍗曪細" + inventory.getBusinessFormCode()); +// +// details.setInitialCount(result.getInitial_count()); +// details.setThisType(1); +// details.setThisCount(result.getEnd_count()-result.getInitial_count()); +// details.setEndCount(result.getEnd_count()); +// details.setWarehouseId(result.getWhGoods().getWarehouseId()); +// details.setWarehouseName(result.getWhGoods().getWarehouseName()); +// details.setClassification(8); +// details.setOperatorId(inventory.getOperatorId()); +// details.setOperatorName(inventory.getOperatorName()); +// details.setDealTime(inventory.getStopTime()); +// details.setWhGoodsId(result.getWhGoods().getId()); +// this.insert(details); +// +// +// WhFormInventoryModel model = new WhFormInventoryModel(); +// model.setId(NumberGenerator.getLongSequenceNumber()); +// model.setCounts(result.getWhGoods().getWhCount()); +// model.setWhFormInventoryId(inventory.getId()); +// model.setInventoryResult(3); +// model.setWhGoodsDetailsId(details.getId()); +// model.setWhFormInventoryGoodsId(goods.getId()); +// model.setWhGoodsId(result.getWhGoods().getId()); +// insert(model); +// } +// } +// +// /** +// * 缁熶竴澶勭悊搴撳瓨棰勮锛堝畾鏃朵换鍔¤皟鐢ㄦ湇鍔★級 +// * 璁″垝锛氭瘡澶╀腑鍗�13锛�00銆佹櫄涓�1:00鎵ц涓ゆ +// */ +// public void insertWarning(){ +// +// String sql = "SELECT\n" + +// " SUM(b.WH_COUNT) AS WH_COUNT,\n" + +// " b.BASE_GOODS_TEMPLATE_ID,\n" + +// " b.GOODS_TEMPLATE_NAME,\n" + +// " b.WAREHOUSE_ID,\n" + +// " a.UPPER_LIMIT,\n" + +// " a.LOWER_LIMIT \n" + +// "FROM\n" + +// " WH_WARNING_CONFIG a\n" + +// " LEFT JOIN wh_goods b ON a.BASE_GOODS_TEMPLATE_ID = b.BASE_GOODS_TEMPLATE_ID \n" + +// "WHERE\n" + +// " a.BASE_WAREHOUSE_ID = b.WAREHOUSE_ID \n" + +// " AND b.STATES = 1 \n" + +// " AND a.GOODS_TYPE=1\n" + +// " AND ( a.UPPER_LIMIT <= WH_COUNT OR a.LOWER_LIMIT >= WH_COUNT ) \n" + +// "GROUP BY\n" + +// " b.BASE_GOODS_TEMPLATE_ID,\n" + +// " b.GOODS_TEMPLATE_NAME,\n" + +// " b.WAREHOUSE_ID,\n" + +// " a.UPPER_LIMIT,\n" + +// " a.LOWER_LIMIT"; +// +// List<Map> goodslist = select(sql,new SqlParameter()); +// +// sql = "SELECT\n" + +// " SUM(b.WH_COUNT) AS WH_COUNT,\n" + +// " b.BASE_GOODS_TEMPLATE_ID,\n" + +// " b.GOODS_TEMPLATE_NAME,\n" + +// " b.BASE_GOODS_MODELS_ID,\n" + +// " b.BASE_GOODS_MODELS_NAME,\n" + +// " b.WAREHOUSE_ID,\n" + +// " a.UPPER_LIMIT,\n" + +// " a.LOWER_LIMIT \n" + +// "FROM\n" + +// " WH_WARNING_CONFIG a\n" + +// " LEFT JOIN wh_goods b ON a.BASE_GOODS_MODELS_ID = b.BASE_GOODS_MODELS_ID \n" + +// "WHERE\n" + +// " a.BASE_WAREHOUSE_ID = b.WAREHOUSE_ID \n" + +// " AND b.STATES = 1 \n" + +// " AND a.GOODS_TYPE=2\n" + +// " AND ( a.UPPER_LIMIT <= WH_COUNT OR a.LOWER_LIMIT >= WH_COUNT ) \n" + +// "GROUP BY\n" + +// " b.BASE_GOODS_TEMPLATE_ID,\n" + +// " b.GOODS_TEMPLATE_NAME,\n" + +// " b.BASE_GOODS_MODELS_ID,\n" + +// " b.BASE_GOODS_MODELS_NAME,\n" + +// " b.WAREHOUSE_ID,\n" + +// " a.UPPER_LIMIT,\n" + +// " a.LOWER_LIMIT"; +// +// List<Map> modeslist = select(sql,new SqlParameter()); +// +// List<Map> list = new ArrayList<>(); +// list.addAll(goodslist); +// list.addAll(modeslist); +// +// List<WhWarning> warningList = new ArrayList<>(); +// for (Map map : list) { +// SuperMap superMap = new SuperMap(map); +// BaseWarehouse warehouse = get(new BaseWarehouse(),"ID=?",new Object[]{superMap.get("WAREHOUSE_ID")}); +// +// WhWarning warning = new WhWarning(); +// warning.setId(NumberGenerator.getLongSequenceNumber()); +// warning.setBaseWarehouseId(warehouse.getId()); +// warning.setBaseWarehouseName(warehouse.getWarehouseName()); +// warning.setBaseGoodsTemplateId(superMap.getLong("BASE_GOODS_TEMPLATE_ID")); +// warning.setBaseGoodsTemplateName(superMap.getString("GOODS_TEMPLATE_NAME")); +// if (superMap.getString("BASE_GOODS_MODELS_ID") == null){ +// warning.setGoodsType(1); +// } else { +// warning.setBaseGoodsModelsId(superMap.getLong("BASE_GOODS_MODELS_ID")); +// warning.setBaseGoodsModelsName(superMap.getString("BASE_GOODS_MODELS_NAME")); +// warning.setGoodsType(2); +// } +// +// int whCount = superMap.getInteger("WH_COUNT"); +// int upCount = superMap.getInteger("UPPER_LIMIT"); +// int lowCount = superMap.getInteger("LOWER_LIMIT"); +// +// if (whCount >= upCount){ +// warning.setWarningType(1); +// } +// if (whCount<=lowCount){ +// warning.setWarningType(2); +// } +// +// warning.setUpperLimit(upCount); +// warning.setLowerLimit(lowCount); +// warning.setWarehouseCount(whCount); +// warning.setStates(1); +// warning.setWarningTime(DateUtil.getCurrentDateFor14()); +// warning.setAgencyId(warehouse.getAgencyId()); +// warning.setAgencyName(warehouse.getAgencyName()); +// +// warningList.add(warning); +// } +// +// insertBatch(warningList); +// } +// +// public void doDepBack(String depFormBackId){ +// +// DepFormBack back = get(new DepFormBack(),"ID=?",new Object[]{depFormBackId}); +// +// String sql = "SELECT\n" + +// " B.*,\n" + +// " A.BACK_COUNTS, \n" + +// " A.ID AS DEP_FORM_BACK_GOODS_ID \n" + +// "FROM\n" + +// " DEP_FORM_BACK_GOODS A\n" + +// " LEFT JOIN DEP_FORM_LENDING_GOODS B ON A.DEP_FORM_LENDING_GOODS_ID = B.ID \n" + +// "WHERE\n" + +// " A.DEP_FORM_BACK_ID = :DEP_FORM_BACK_ID \n" + +// " AND A.WAREHOUSE_ID = B.WAREHOUSE_ID \n" + +// " AND A.WAREHOUSE_ID = :WAREHOUSE_ID"; +// +// List<Map> list = select(sql,new SqlParameter("DEP_FORM_BACK_ID",back.getId()).add("WAREHOUSE_ID",back.getWarehouseId())); +// +// for (Map myMap : list) { +// SuperMap map = new SuperMap(myMap); +// +// CheckUsingParam param = new CheckUsingParam(); +// param.setIsCheckIn(false); +// param.setLending_id(map.getLong("DEP_FORM_LENDING_ID")); +// param.setModel_id(map.getLong("BASE_GOODS_MODELS_ID")); +// param.setUser_name(map.getString("GOODS_USER_NAME")); +// +// List<CheckUsingResult> resultList = coreService.unifyUsingCheck(param); +// for (CheckUsingResult result : resultList) { +// BaseWarehouseParam param1 = new DepBackWarehouseParam(); +// param1.setIsCheckIn(true); +// param1.setWarehouseId(result.getLendingModel().getWarehouseId()); +// param1.setModelId(result.getLendingModel().getBaseGoodsModelsId()); +// param1.setCount(result.getEnd_count() - result.getInitial_count()); +// param1.setFirst_input_type(4); +// +// //鍏ュ簱骞跺瓨鍏ユ祦姘� +// CheckWarehouseResult result1 = coreService.unifyCheck(param1).get(0); +// WhGoodsDetails details = new WhGoodsDetails(); +// details.setId(result1.getWhGoods().getFirstInputHisId()); +// details.setBusinessFormId(back.getId()); +// details.setBusinessFormCode(back.getBusinessFormCode()); +// details.setBusinessFormName(back.getWarehouseName() + "杩斿簱鍏ュ簱鍗�:" + details.getBusinessFormCode()); +// details.setInitialCount(result.getInitial_count()); +// details.setThisType(1); +// details.setEndCount(result.getEnd_count()); +// details.setWarehouseId(back.getWarehouseId()); +// details.setWarehouseName(back.getWarehouseName()); +// details.setClassification(1); +// details.setOperatorId(back.getOperatorId()); +// details.setOperatorName(back.getOperatorName()); +// details.setDealTime(back.getDealTime()); +// details.setWhGoodsId(result1.getWhGoods().getId()); +// +// this.insert(details); +// +// +// //瀛樺叆鍦ㄧ敤娴佹按 +// UsingGoodsHis his = new UsingGoodsHis(); +// his.setId(NumberGenerator.getLongSequenceNumber()); +// his.setBusinessFormId(back.getId()); +// his.setBusinessFormCode(back.getBusinessFormCode()); +// his.setBusinessFormName("杩斿簱鍗曪細" + back.getBusinessFormCode()); +// his.setClassification(3); +// his.setOperatorId(back.getOperatorId()); +// his.setOperatorName(back.getOperatorName()); +// his.setDealTime(back.getDealTime()); +// his.setDepFormLendingModelId(result.getLendingModel().getId()); +// his.setDepFormLendingGoodsId(result.getLendingModel().getDepFormLendingGoodsId()); +// his.setDepFormLendingId(result.getLendingModel().getDepFormLendingId()); +// his.setWhGoodsId(result.getLendingModel().getWhGoodsId()); +// his.setInitialCount(result.getInitial_count()); +// his.setEndCount(result.getEnd_count()); +// his.setWarehouseId(back.getWarehouseId()); +// his.setWarehouseName(back.getWarehouseName()); +// his.setDepartmentId(back.getDepartmentId()); +// his.setDepartmentName(back.getDepartmentName()); +// insert(his); +// +// DepFormBackModel model = new DepFormBackModel(); +// model.setId(NumberGenerator.getLongSequenceNumber()); +// model.setDepFormBackGoodsId(map.getLong("DEP_FORM_BACK_GOODS_ID")); +// model.setDepFormBackId(back.getId()); +// model.setWhGoodsDetailsId(result1.getWh_goods_detail_id()); +// model.setUsingGoodsHisId(his.getId()); +// model.setWhGoodsId(his.getWhGoodsId()); +// model.setCounts(his.getThisCount()); +// model.setDepFormLendingModelId(his.getDepFormLendingModelId()); +// model.setDepFormLendingGoodsId(his.getDepFormLendingGoodsId()); +// model.setDepFormLendingId(his.getDepFormLendingId()); +// model.setWhGoodsId(his.getWhGoodsId()); +// insert(model); +// } +// +// } +// +// +// } +// +// +// /** +// * 閮ㄩ棬鐗╁搧鍒嗗彂 +// */ +// public void doDepLending(DepFormLending lending){ +// String sql = "SELECT\n" + +// " * \n" + +// "FROM\n" + +// " DEP_FORM_LENDING_GOODS A \n" + +// "WHERE\n" + +// " A.DEP_FORM_LENDING_ID = :LENDING_ID"; +// +// List<DepFormLendingGoods> goodsList = this.select(sql,new SqlParameter() +// .put("LENDING_ID",lending.getId()),new DepFormLendingGoods()); +// +// for (DepFormLendingGoods goods : goodsList){ +// BaseWarehouseParam param = new BaseWarehouseParam(); +// param.setIsCheckIn(false); +// param.setWarehouseId(lending.getWarehouseId()); +// param.setModelId(goods.getBaseGoodsModelsId()); +// param.setCount(goods.getCounts()); +// +// //棣栧厛浠庢満鏋勪粨搴撳嚭搴� +// List<CheckWarehouseResult> results = coreService.unifyCheck(param); +// for (CheckWarehouseResult result : results){ +// WhGoodsDetails details = new WhGoodsDetails(); +// details.setId(NumberGenerator.getLongSequenceNumber()); +// details.setBusinessFormId(lending.getId()); +// details.setBusinessFormCode(lending.getBusinessFormCode()); +// details.setBusinessFormName("鍒嗗彂鍗曪細" + lending.getBusinessFormCode()); +// details.setInitialCount(result.getInitial_count()); +// details.setThisType(2); +// details.setThisCount(result.getInitial_count() - result.getEnd_count()); +// details.setEndCount(result.getEnd_count()); +// details.setWarehouseId(result.getWhGoods().getWarehouseId()); +// details.setWarehouseName(result.getWhGoods().getWarehouseName()); +// details.setClassification(11); +// details.setOperatorId(lending.getOperatorId()); +// details.setOperatorName(lending.getOperatorName()); +// details.setDealTime(lending.getDealTime()); +// details.setWhGoodsId(result.getWhGoods().getId()); +// this.insert(details); +// +// //鍥炲~鍑哄簱娴佹按ID锛岀敤浜庡垎鍙戞椂浣跨敤 +// result.setWh_goods_detail_id(details.getId()); +// } +// +// CheckUsingParam usingParam = new CheckUsingParam(); +// usingParam.setIsCheckIn(true); +// usingParam.setInput_type(1); +// usingParam.setOutputList(results); +// +// List<CheckUsingResult> usingResults = coreService.unifyUsingCheck(usingParam); +// for (CheckUsingResult usingResult : usingResults) { +// UsingGoodsHis his = new UsingGoodsHis(); +// his.setId(NumberGenerator.getLongSequenceNumber()); +// his.setBusinessFormId(lending.getId()); +// his.setBusinessFormCode(lending.getBusinessFormCode()); +// his.setBusinessFormName("鍒嗗彂鍗曪細" + lending.getBusinessFormCode()); +// his.setClassification(1); +// his.setOperatorId(lending.getOperatorId()); +// his.setOperatorName(lending.getOperatorName()); +// his.setDealTime(lending.getDealTime()); +// his.setDepFormLendingModelId(usingResult.getLendingModel().getId()); +// his.setDepFormLendingGoodsId(usingResult.getLendingModel().getDepFormLendingGoodsId()); +// his.setDepFormLendingId(lending.getId()); +// his.setWhGoodsId(usingResult.getLendingModel().getWhGoodsId()); +// his.setInitialCount(usingResult.getInitial_count()); +// his.setEndCount(usingResult.getEnd_count()); +// his.setWarehouseId(lending.getWarehouseId()); +// his.setWarehouseName(lending.getWarehouseName()); +// his.setDepartmentId(lending.getDepartmentId()); +// his.setDepartmentName(lending.getDepartmentName()); +// insert(his); +// } +// } +// } +// +// public void doDepScrapped(String dep_form_scrapped_id){ +// +// DepFormScrapped scrapped = get(new DepFormScrapped(),"ID=?",new Object[]{dep_form_scrapped_id}); +// +// String sql = "SELECT\n" + +// " B.*,\n" + +// " A.SCRAPPED_COUNTS, \n" + +// " A.ID AS DEP_FORM_SCRAPPED_GOODS_ID \n" + +// "FROM\n" + +// " DEP_FORM_SCRAPPED_GOODS A\n" + +// " LEFT JOIN DEP_FORM_LENDING_GOODS B ON A.DEP_FORM_LENDING_GOODS_ID = B.ID \n" + +// "WHERE\n" + +// " A.DEP_FORM_SCRAPPED_ID = :DEP_FORM_SCRAPPED_ID \n" + +// " AND A.WAREHOUSE_ID = B.WAREHOUSE_ID \n" + +// " AND A.WAREHOUSE_ID = :WAREHOUSE_ID"; +// +// List<Map> list = select(sql,new SqlParameter("DEP_FORM_SCRAPPED_ID",scrapped.getId()).add("WAREHOUSE_ID",scrapped.getWarehouseId())); +// for (Map _map : list) { +// SuperMap map = new SuperMap(_map); +// +// CheckUsingParam param = new CheckUsingParam(); +// param.setIsCheckIn(false); +// param.setOutputCount(map.getInteger("SCRAPPED_COUNTS")); +// param.setLending_id(map.getLong("DEP_FORM_LENDING_ID")); +// param.setModel_id(map.getLong("BASE_GOODS_MODELS_ID")); +// param.setUser_name(map.getString("GOODS_USER_NAME")); +// +// List<CheckUsingResult> resultList = coreService.unifyUsingCheck(param); +// +// for (CheckUsingResult result : resultList) { +// +// //瀛樺叆鍦ㄧ敤娴佹按 +// UsingGoodsHis his = new UsingGoodsHis(); +// his.setId(NumberGenerator.getLongSequenceNumber()); +// his.setBusinessFormId(scrapped.getId()); +// his.setBusinessFormCode(scrapped.getBusinessFormCode()); +// his.setBusinessFormName("閮ㄩ棬鎶ュ簾鍗曪細" + scrapped.getBusinessFormCode()); +// his.setClassification(4); +// his.setOperatorId(scrapped.getOperatorId()); +// his.setOperatorName(scrapped.getOperatorName()); +// his.setDealTime(scrapped.getDealTime()); +// his.setDepFormLendingModelId(result.getLendingModel().getId()); +// his.setDepFormLendingGoodsId(result.getLendingModel().getDepFormLendingGoodsId()); +// his.setDepFormLendingId(result.getLendingModel().getDepFormLendingId()); +// his.setWhGoodsId(result.getLendingModel().getWhGoodsId()); +// his.setInitialCount(result.getInitial_count()); +// his.setEndCount(result.getEnd_count()); +// his.setWarehouseId(scrapped.getWarehouseId()); +// his.setWarehouseName(scrapped.getWarehouseName()); +// his.setDepartmentId(scrapped.getDepartmentId()); +// his.setDepartmentName(scrapped.getDepartmentName()); +// insert(his); +// +// +// DepFormScrappedModel model = new DepFormScrappedModel(); +// model.setId(NumberGenerator.getLongSequenceNumber()); +// model.setDepFormScrappedGoodsId(map.getLong("DEP_FORM_SCRAPPED_GOODS_ID")); +// model.setScrappedCode(map.getString("SCRAPPED_CODE")); +// model.setScrappedName(map.getString("SCRAPPED_NAME")); +// model.setUsingGoodsHisId(his.getId()); +// model.setDepFormScrappedId(scrapped.getId()); +// model.setWhGoodsId(his.getWhGoodsId()); +// model.setScrappedCounts(his.getThisCount()); +// model.setInitCount(his.getInitialCount()); +// model.setDepFormLendingModelId(his.getDepFormLendingModelId()); +// model.setDepFormLendingGoodsId(his.getDepFormLendingGoodsId()); +// model.setDepFormLendingId(his.getDepFormLendingId()); +// insert(model); +// } +// } +// } +// +// /** +// * 鐢ㄤ簬鍙樻洿鐗╁搧浣跨敤浜哄悗锛屾洿鏂板簱瀛樼墿鍝佷娇鐢ㄤ汉淇℃伅銆� +// * @param dep_form_lending_goods_user_id +// */ +// public void changeUser(Long dep_form_lending_goods_user_id){ +// DepFormLendingGoodsUser user = get(new DepFormLendingGoodsUser(),"ID=?",new Object[]{dep_form_lending_goods_user_id}); +// DepFormLendingGoods goods = get(new DepFormLendingGoods(),"ID=?",new Object[]{user.getDepFormLendingGoodsId()}); +// +// +// String sql = +// "UPDATE DEP_FORM_LENDING_MODEL \n" + +// "SET NOW_USER_NAME =:NOW_USER_NAME,\n" + +// "NOW_USER_PHONE =:NOW_USER_PHONE \n" + +// "WHERE\n" + +// " DEP_FORM_LENDING_GOODS_ID =:DEP_FORM_LENDING_GOODS_ID \n" + +// " AND BASE_GOODS_MODELS_ID =:BASE_GOODS_MODELS_ID \n" + +// " AND NOW_USER_NAME =:OLD_USER_NAME\n" + +// " AND USING_COUNT > 0"; +// +// List<SqlParameter> parameterList = new ArrayList<>(); +// List<DepFormLendingModel> modelList = select(new DepFormLendingModel(),"DEP_FORM_LENDING_GOODS_ID=?",new Object[]{goods.getId()}); +// for (DepFormLendingModel model : modelList) { +// if (model.getUsingCount() == 0) continue; +// SqlParameter parameter = new SqlParameter(); +// parameter.add("NOW_USER_NAME",user.getNowUserName()) +// .add("NOW_USER_PHONE",user.getNowUserPhone()) +// .add("DEP_FORM_LENDING_GOODS_ID",goods.getId()) +// .add("BASE_GOODS_MODELS_ID",goods.getBaseGoodsModelsId()) +// .add("OLD_USER_NAME",goods.getGoodsUserName()); +// parameterList.add(parameter); +// } +// execBatchUpdate(sql,parameterList); +// } +//} -- Gitblit v1.9.1