kangwei : 补充 入库验收单审核列表接口
导出pdf文件接口
正在显示
12 个修改的文件
包含
167 行增加
和
70 行删除
... | @@ -15,6 +15,7 @@ import com.skua.core.query.QueryGenerator; | ... | @@ -15,6 +15,7 @@ import com.skua.core.query.QueryGenerator; |
15 | import com.skua.core.service.ISequenceService; | 15 | import com.skua.core.service.ISequenceService; |
16 | import com.skua.core.util.ConvertUtils; | 16 | import com.skua.core.util.ConvertUtils; |
17 | import com.skua.modules.erp.entity.DistributContract; | 17 | import com.skua.modules.erp.entity.DistributContract; |
18 | import com.skua.modules.erp.entity.DistributMaterial; | ||
18 | import com.skua.modules.erp.entity.PurchaseMaterial; | 19 | import com.skua.modules.erp.entity.PurchaseMaterial; |
19 | import com.skua.modules.erp.service.IDistributContractService; | 20 | import com.skua.modules.erp.service.IDistributContractService; |
20 | import java.util.Date; | 21 | import java.util.Date; |
... | @@ -25,6 +26,7 @@ import com.skua.modules.erp.service.IPurchaseMaterialService; | ... | @@ -25,6 +26,7 @@ import com.skua.modules.erp.service.IPurchaseMaterialService; |
25 | import com.skua.modules.erp.vo.DistributContractVO; | 26 | import com.skua.modules.erp.vo.DistributContractVO; |
26 | import lombok.extern.slf4j.Slf4j; | 27 | import lombok.extern.slf4j.Slf4j; |
27 | 28 | ||
29 | import org.apache.commons.lang3.StringUtils; | ||
28 | import org.jeecgframework.poi.excel.ExcelImportUtil; | 30 | import org.jeecgframework.poi.excel.ExcelImportUtil; |
29 | import org.jeecgframework.poi.excel.def.NormalExcelConstants; | 31 | import org.jeecgframework.poi.excel.def.NormalExcelConstants; |
30 | import org.jeecgframework.poi.excel.entity.ExportParams; | 32 | import org.jeecgframework.poi.excel.entity.ExportParams; |
... | @@ -93,8 +95,18 @@ public class DistributContractController { | ... | @@ -93,8 +95,18 @@ public class DistributContractController { |
93 | public Result<DistributContractVO> add(@RequestBody DistributContractVO distributContract) { | 95 | public Result<DistributContractVO> add(@RequestBody DistributContractVO distributContract) { |
94 | Result<DistributContractVO> result = new Result<DistributContractVO>(); | 96 | Result<DistributContractVO> result = new Result<DistributContractVO>(); |
95 | try { | 97 | try { |
96 | distributContractService.saveDistributContractVO(distributContract); | 98 | String goodsCode = checkSameGoodCode(distributContract.getMaterialList()); |
97 | result.success("添加成功!"); | 99 | if (StringUtils.isNotEmpty(goodsCode)) { |
100 | result.error500("操作失败,货号["+ goodsCode +"]重复!"); | ||
101 | }else{ | ||
102 | String errMsg = distributContractService.saveDistributContractVO(distributContract); | ||
103 | if(errMsg != null ){ | ||
104 | result.error500(errMsg); | ||
105 | }else { | ||
106 | result.success("添加成功!"); | ||
107 | } | ||
108 | } | ||
109 | |||
98 | } catch (Exception e) { | 110 | } catch (Exception e) { |
99 | log.error(e.getMessage(),e); | 111 | log.error(e.getMessage(),e); |
100 | result.error500("操作失败"); | 112 | result.error500("操作失败"); |
... | @@ -111,15 +123,37 @@ public class DistributContractController { | ... | @@ -111,15 +123,37 @@ public class DistributContractController { |
111 | if(distributContractEntity==null) { | 123 | if(distributContractEntity==null) { |
112 | result.error500("未找到对应实体"); | 124 | result.error500("未找到对应实体"); |
113 | }else { | 125 | }else { |
114 | boolean ok = distributContractService.updateDistributContractVO(distributContract); | 126 | String goodsCode = checkSameGoodCode(distributContract.getMaterialList()); |
115 | //TODO 返回false说明什么? | 127 | if (StringUtils.isNotEmpty(goodsCode)) { |
116 | if(ok) { | 128 | result.error500("操作失败,货号["+ goodsCode +"]重复!"); |
117 | result.success("修改成功!"); | 129 | }else{ |
130 | String errMsg = distributContractService.updateDistributContractVO(distributContract); | ||
131 | if(errMsg != null ){ | ||
132 | result.error500(errMsg); | ||
133 | }else{ | ||
134 | result.success("修改成功!"); | ||
135 | } | ||
136 | |||
118 | } | 137 | } |
119 | } | 138 | } |
120 | |||
121 | return result; | 139 | return result; |
122 | } | 140 | } |
141 | /*** | ||
142 | * 校验是否有重复的货号 | ||
143 | * @param materialList | ||
144 | * @return | ||
145 | */ | ||
146 | public String checkSameGoodCode(List<DistributMaterial> materialList){ | ||
147 | String goodCode = ""; | ||
148 | for( DistributMaterial material : materialList){ | ||
149 | if(goodCode.contains( material.getGoodCode() )){ | ||
150 | goodCode = material.getGoodCode(); | ||
151 | break; | ||
152 | } | ||
153 | goodCode = goodCode + ","+material.getGoodCode(); | ||
154 | } | ||
155 | return null; | ||
156 | } | ||
123 | 157 | ||
124 | @AutoLog(value = "erp分销合同-通过id删除") | 158 | @AutoLog(value = "erp分销合同-通过id删除") |
125 | @ApiOperation(value="erp分销合同-通过id删除", notes="erp分销合同-通过id删除") | 159 | @ApiOperation(value="erp分销合同-通过id删除", notes="erp分销合同-通过id删除") |
... | @@ -216,12 +250,15 @@ public class DistributContractController { | ... | @@ -216,12 +250,15 @@ public class DistributContractController { |
216 | @AutoLog(value = "erp分销合同-根据货号查询采购合同物料清单") | 250 | @AutoLog(value = "erp分销合同-根据货号查询采购合同物料清单") |
217 | @ApiOperation(value="erp分销合同-根据货号查询采购合同物料清单", notes="erp分销合同-根据货号查询采购合同物料清单") | 251 | @ApiOperation(value="erp分销合同-根据货号查询采购合同物料清单", notes="erp分销合同-根据货号查询采购合同物料清单") |
218 | @GetMapping(value = "/queryMaterialByGoodCode") | 252 | @GetMapping(value = "/queryMaterialByGoodCode") |
219 | public Result<PurchaseMaterial> queryMaterialByGoodCode(@RequestParam(name="goodCode") String goodCode) { | 253 | public Result<PurchaseMaterial> queryMaterialByGoodCode(@RequestParam(name="goodCode") String goodCode,@RequestParam(name="departId") String departId) { |
220 | Result<PurchaseMaterial> result = new Result<PurchaseMaterial>(); | 254 | Result<PurchaseMaterial> result = new Result<PurchaseMaterial>(); |
221 | List<PurchaseMaterial> purchaseMaterialList = purchaseMaterialService.queryMaterialByGoodCode(goodCode,BaseContextHandler.getRealDepartId()); | 255 | List<PurchaseMaterial> purchaseMaterialList = purchaseMaterialService.queryMaterialByGoodCode(goodCode,departId); |
222 | result.setSuccess(true); | 256 | |
223 | if(purchaseMaterialList != null && !purchaseMaterialList.isEmpty()){ | 257 | if(purchaseMaterialList != null && !purchaseMaterialList.isEmpty()){ |
258 | result.setSuccess(true); | ||
224 | result.setResult(purchaseMaterialList.get(0)); | 259 | result.setResult(purchaseMaterialList.get(0)); |
260 | }else{ | ||
261 | result.error500("根据[厂站]以及[货号]未找到采购合同!"); | ||
225 | } | 262 | } |
226 | return result; | 263 | return result; |
227 | } | 264 | } | ... | ... |
... | @@ -166,9 +166,9 @@ public class MaterialINController { | ... | @@ -166,9 +166,9 @@ public class MaterialINController { |
166 | @AutoLog(value = "erp--物料(药剂)入库--药剂到货日验收记录") | 166 | @AutoLog(value = "erp--物料(药剂)入库--药剂到货日验收记录") |
167 | @ApiOperation(value="erp--物料(药剂)入库-药剂到货日验收记录", notes="erp--物料(药剂)入库-药剂到货日验收记录") | 167 | @ApiOperation(value="erp--物料(药剂)入库-药剂到货日验收记录", notes="erp--物料(药剂)入库-药剂到货日验收记录") |
168 | @GetMapping(value = "/arrivalRecordList") | 168 | @GetMapping(value = "/arrivalRecordList") |
169 | public Result<List<MaterialIN>> arrivalRecordList(MaterialIN materialIN) { | 169 | public Result<List<ArrivalRecordExcelExportVO>> arrivalRecordList(MaterialIN materialIN) { |
170 | Result<List<MaterialIN>> result = new Result<List<MaterialIN>>(); | 170 | Result<List<ArrivalRecordExcelExportVO>> result = new Result<List<ArrivalRecordExcelExportVO>>(); |
171 | QueryWrapper<MaterialIN> queryWrapper = new QueryWrapper();//QueryGenerator.initQueryWrapper(materialIN, req.getParameterMap()); | 171 | /* QueryWrapper<MaterialIN> queryWrapper = new QueryWrapper();//QueryGenerator.initQueryWrapper(materialIN, req.getParameterMap()); |
172 | if(StringUtils.isNotBlank(materialIN.getGoodCode())){ | 172 | if(StringUtils.isNotBlank(materialIN.getGoodCode())){ |
173 | queryWrapper.like("good_code",materialIN.getGoodCode()); | 173 | queryWrapper.like("good_code",materialIN.getGoodCode()); |
174 | } | 174 | } |
... | @@ -188,7 +188,9 @@ public class MaterialINController { | ... | @@ -188,7 +188,9 @@ public class MaterialINController { |
188 | queryWrapper.eq("purchase_contract_id",materialIN.getPurchaseContractId()); | 188 | queryWrapper.eq("purchase_contract_id",materialIN.getPurchaseContractId()); |
189 | } | 189 | } |
190 | queryWrapper.eq("audit_status","3"); | 190 | queryWrapper.eq("audit_status","3"); |
191 | List<MaterialIN> pageList = materialINService.list( queryWrapper); | 191 | List<MaterialIN> pageList = materialINService.list( queryWrapper);*/ |
192 | List<ArrivalRecordExcelExportVO> pageList = materialINService.queryArrivalRecordByList(materialIN); | ||
193 | |||
192 | result.setSuccess(true); | 194 | result.setSuccess(true); |
193 | result.setResult(pageList); | 195 | result.setResult(pageList); |
194 | return result; | 196 | return result; |
... | @@ -401,7 +403,7 @@ public class MaterialINController { | ... | @@ -401,7 +403,7 @@ public class MaterialINController { |
401 | 403 | ||
402 | @AutoLog(value = "erp--药剂到货验收记录表") | 404 | @AutoLog(value = "erp--药剂到货验收记录表") |
403 | @ApiOperation(value="erp--药剂到货验收记录表", notes="erp--药剂到货验收记录表") | 405 | @ApiOperation(value="erp--药剂到货验收记录表", notes="erp--药剂到货验收记录表") |
404 | @RequestMapping(value = "/exportArrivalRecordExcel") | 406 | @GetMapping(value = "/exportArrivalRecordExcel") |
405 | public ModelAndView exportExcel(HttpServletRequest request, HttpServletResponse response) { | 407 | public ModelAndView exportExcel(HttpServletRequest request, HttpServletResponse response) { |
406 | MaterialIN materialIN = null; | 408 | MaterialIN materialIN = null; |
407 | // Step.1 组装查询条件 | 409 | // Step.1 组装查询条件 |
... | @@ -429,7 +431,7 @@ public class MaterialINController { | ... | @@ -429,7 +431,7 @@ public class MaterialINController { |
429 | } | 431 | } |
430 | @AutoLog(value = "erp--导出物资验收pdf文件") | 432 | @AutoLog(value = "erp--导出物资验收pdf文件") |
431 | @ApiOperation(value="erp--导出物资验收pdf文件", notes="erp--导出物资验收pdf文件") | 433 | @ApiOperation(value="erp--导出物资验收pdf文件", notes="erp--导出物资验收pdf文件") |
432 | @RequestMapping(value = "/exportArrivalRecordPDF") | 434 | @GetMapping(value = "/exportArrivalRecordPDF") |
433 | public void exportPDF(HttpServletRequest request, HttpServletResponse response) { | 435 | public void exportPDF(HttpServletRequest request, HttpServletResponse response) { |
434 | // Step.1 组装查询条件 | 436 | // Step.1 组装查询条件 |
435 | //QueryWrapper<MaterialIN> queryWrapper = null; | 437 | //QueryWrapper<MaterialIN> queryWrapper = null; | ... | ... |
... | @@ -28,6 +28,10 @@ public class DistributMaterial { | ... | @@ -28,6 +28,10 @@ public class DistributMaterial { |
28 | @TableId(type = IdType.UUID) | 28 | @TableId(type = IdType.UUID) |
29 | @ApiModelProperty(value = "主键") | 29 | @ApiModelProperty(value = "主键") |
30 | private String id; | 30 | private String id; |
31 | |||
32 | /**部门编号冗余*/ | ||
33 | private String departId; | ||
34 | |||
31 | /**分销合同编号*/ | 35 | /**分销合同编号*/ |
32 | @Excel(name = "分销合同编号", width = 15) | 36 | @Excel(name = "分销合同编号", width = 15) |
33 | @ApiModelProperty(value = "分销合同编号") | 37 | @ApiModelProperty(value = "分销合同编号") | ... | ... |
... | @@ -22,4 +22,12 @@ public interface DistributMaterialMapper extends BaseMapper<DistributMaterial> { | ... | @@ -22,4 +22,12 @@ public interface DistributMaterialMapper extends BaseMapper<DistributMaterial> { |
22 | * @return | 22 | * @return |
23 | */ | 23 | */ |
24 | public int checkGoodCode(@Param("id")String id,@Param("goodCode") String goodCode); | 24 | public int checkGoodCode(@Param("id")String id,@Param("goodCode") String goodCode); |
25 | |||
26 | /*** | ||
27 | * 根据departId或code校验货号是否唯一 | ||
28 | * @param goodsCode | ||
29 | * @param departId | ||
30 | * @return | ||
31 | */ | ||
32 | int checkGoodCodeAndDepartId(@Param("goodCode") String goodsCode, @Param("departId") String departId); | ||
25 | } | 33 | } | ... | ... |
... | @@ -47,7 +47,7 @@ public interface PurchaseMaterialMapper extends BaseMapper<PurchaseMaterial> { | ... | @@ -47,7 +47,7 @@ public interface PurchaseMaterialMapper extends BaseMapper<PurchaseMaterial> { |
47 | * @param departId | 47 | * @param departId |
48 | * @return | 48 | * @return |
49 | */ | 49 | */ |
50 | List<PurchaseMaterial> queryByList( @Param("goodCode")String goodCode, @Param("departId")String departId); | 50 | List<PurchaseMaterial> queryMaterialByGoodCode( @Param("goodCode")String goodCode, @Param("departId")String departId); |
51 | 51 | ||
52 | 52 | ||
53 | /*** | 53 | /*** | ... | ... |
... | @@ -21,4 +21,10 @@ | ... | @@ -21,4 +21,10 @@ |
21 | where good_code = #{goodCode} | 21 | where good_code = #{goodCode} |
22 | <if test="id != null and id !=''">and id = #{id}</if> | 22 | <if test="id != null and id !=''">and id = #{id}</if> |
23 | </select> | 23 | </select> |
24 | |||
25 | <!-- 校验货号是否唯一 --> | ||
26 | <select id="checkGoodCodeAndDepartId" resultType="java.lang.Integer"> | ||
27 | select count(1) from erp_distribut_material | ||
28 | where good_code = #{goodCode} and depart_id = #{departId} | ||
29 | </select> | ||
24 | </mapper> | 30 | </mapper> |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -13,21 +13,21 @@ | ... | @@ -13,21 +13,21 @@ |
13 | <where> | 13 | <where> |
14 | mi.audit_status =3 | 14 | mi.audit_status =3 |
15 | <if test="startTime != null and startTime !=''"> | 15 | <if test="startTime != null and startTime !=''"> |
16 | and mi.arrive_time >= #{param.startTime} | 16 | and mi.arrive_time >= #{startTime} |
17 | </if> | 17 | </if> |
18 | <if test="endTime != null param.endTime !=''"> | 18 | <if test="endTime != null and endTime !=''"> |
19 | and mi.arrive_time <= #{param.endTime} | 19 | and mi.arrive_time <= #{endTime} |
20 | </if> | 20 | </if> |
21 | <if test="goodCode != null goodCode !=''"> | 21 | <if test="goodCode != null and goodCode !=''"> |
22 | and mi.good_code like CONCAT('',#{goodCode},'%') | 22 | and mi.good_code like CONCAT('',#{goodCode},'%') |
23 | </if> | 23 | </if> |
24 | <if test="sparepartName != null sparepartName !=''"> | 24 | <if test="sparepartName != null and sparepartName !=''"> |
25 | and mi.sparepart_name like CONCAT('%',#{sparepartName},'%') | 25 | and mi.sparepart_name like CONCAT('%',#{sparepartName},'%') |
26 | </if> | 26 | </if> |
27 | <if test="departId != null departId !=''"> | 27 | <if test="departId != null and departId !=''"> |
28 | and mi.depart_id = #{departId} | 28 | and mi.depart_id = #{departId} |
29 | </if> | 29 | </if> |
30 | <if test="supplierId != null supplierId !=''"> | 30 | <if test="supplierId != null and supplierId !=''"> |
31 | and mi.supplier_id = #{supplierId} | 31 | and mi.supplier_id = #{supplierId} |
32 | </if> | 32 | </if> |
33 | </where> | 33 | </where> |
... | @@ -35,31 +35,31 @@ | ... | @@ -35,31 +35,31 @@ |
35 | </select> | 35 | </select> |
36 | 36 | ||
37 | <!--获取入库审批列表:根据部门、采购合同、供应商、药剂分组搜索 --> | 37 | <!--获取入库审批列表:根据部门、采购合同、供应商、药剂分组搜索 --> |
38 | <select id="queryArrivalRecordByList" resultType="com.skua.modules.erp.vo.ArrivalRecordExcelExportVO"> | 38 | <select id="selectAuditMaterialINByPage" resultType="com.skua.modules.erp.vo.ArrivalRecordExcelExportVO"> |
39 | select sparepart_id , purchase_contract_id,depart_id ,supplier_id, | 39 | select sparepart_id , purchase_contract_id,depart_id ,supplier_id, |
40 | sum(purchase_num) 'purchase_num',measuring_unit,specification,sparepart_name,tax_amount, | 40 | sum(purchase_num) 'purchase_num',measuring_unit,specification,sparepart_name,tax_amount, |
41 | purchase_price,distribut_price,sum(purchase_total_price) 'purchase_total_price',sum(distribut_total_price) 'distribut_total_price',sum(total_price_tax) 'total_price_tax' | 41 | purchase_price,distribut_price,sum(purchase_total_price) 'purchase_total_price',sum(distribut_total_price) 'distribut_total_price',sum(total_price_tax) 'total_price_tax' |
42 | from erp_material_in | 42 | from erp_material_in |
43 | <where> | 43 | <where> |
44 | mi.audit_status =3 | 44 | mi.audit_status =3 |
45 | <if test="startTime != null and startTime !=''"> | 45 | <if test="materialIN.startTime != null and materialIN.startTime !=''"> |
46 | and arrive_time >= #{param.startTime} | 46 | and arrive_time >= #{materialIN.startTime} |
47 | </if> | 47 | </if> |
48 | <if test="endTime != null param.endTime !=''"> | 48 | <if test="materialIN.endTime != null and materialIN.endTime !=''"> |
49 | and arrive_time <= #{param.endTime} | 49 | and arrive_time <= #{materialIN.endTime} |
50 | </if> | 50 | </if> |
51 | <if test="departId != null departId !=''"> | 51 | <if test="materialIN.departId != null and materialIN.departId !=''"> |
52 | and depart_id = #{departId} | 52 | and depart_id = #{materialIN.departId} |
53 | </if> | 53 | </if> |
54 | <if test="supplierId != null supplierId !=''"> | 54 | <if test="materialIN.supplierId != null and materialIN.supplierId !=''"> |
55 | and supplier_id = #{supplierId} | 55 | and supplier_id = #{materialIN.supplierId} |
56 | </if> | 56 | </if> |
57 | <if test="purchaseContractId != null purchaseContractId !=''"> | 57 | <if test="materialIN.purchaseContractId != null and materialIN.purchaseContractId !=''"> |
58 | and purchase_contract_id = #{purchaseContractId} | 58 | and purchase_contract_id = #{materialIN.purchaseContractId} |
59 | </if> | 59 | </if> |
60 | 60 | ||
61 | </where> | 61 | </where> |
62 | group by sparepart_id , purchase_contract_id,depart_id,supplier_id | 62 | group by sparepart_id,purchase_contract_id,depart_id,supplier_id |
63 | </select> | 63 | </select> |
64 | 64 | ||
65 | 65 | ... | ... |
... | @@ -35,16 +35,12 @@ | ... | @@ -35,16 +35,12 @@ |
35 | left join ajh_supplier_manage sm on sm.id = aaa.supplier_id | 35 | left join ajh_supplier_manage sm on sm.id = aaa.supplier_id |
36 | </select> | 36 | </select> |
37 | 37 | ||
38 | <select id="queryByList" resultType="com.skua.modules.erp.entity.PurchaseMaterial"> | 38 | <select id="queryMaterialByGoodCode" resultType="com.skua.modules.erp.entity.PurchaseMaterial"> |
39 | select ss.sparepart_code,ss.sparepart_name, st.item_text as 'sparepart_type_name',sm.supp_name as 'supplier_name', aaa.* | 39 | select ss.sparepart_code,ss.sparepart_name, st.item_text as 'sparepart_type_name',sm.supp_name as 'supplier_name', aaa.* |
40 | from ( | 40 | from ( |
41 | select m.* from erp_purchase_material m , erp_purchase_contract pc where m.contract_id = pc.id | 41 | select m.* from erp_purchase_material m , erp_purchase_contract pc where m.contract_id = pc.id |
42 | <if test="goodCode != null and goodCode != ''"> | 42 | AND m.good_code = #{goodCode} |
43 | AND m.good_code like concat('', #{goodCode}, '%') | 43 | AND pc.departs like CONCAT('%', #{departId}, '%') |
44 | </if> | ||
45 | <if test="departId != null and departId != ''"> | ||
46 | AND pc.departs like concat('%', #{departId}, '%') | ||
47 | </if> | ||
48 | limit 1 | 44 | limit 1 |
49 | ) aaa | 45 | ) aaa |
50 | left join equipment_sparepart_supplies ss on aaa.sparepart_id = ss.id | 46 | left join equipment_sparepart_supplies ss on aaa.sparepart_id = ss.id |
... | @@ -66,15 +62,15 @@ | ... | @@ -66,15 +62,15 @@ |
66 | <select id="queryPurchaseMaterialListByIn" resultType="com.skua.modules.erp.vo.PurchaseMaterialVO"> | 62 | <select id="queryPurchaseMaterialListByIn" resultType="com.skua.modules.erp.vo.PurchaseMaterialVO"> |
67 | select dm.distribut_price ,dm.distribut_total_price ,ss.sparepart_name, st.item_text as 'sparepart_type_name',sm.supp_name as 'supplier_name', | 63 | select dm.distribut_price ,dm.distribut_total_price ,ss.sparepart_name, st.item_text as 'sparepart_type_name',sm.supp_name as 'supplier_name', |
68 | aaa.* from ( | 64 | aaa.* from ( |
69 | select pm.* | 65 | select pm.* ,pc.depart_id |
70 | from erp_purchase_material pm , erp_purchase_contract pc | 66 | from erp_purchase_material pm , erp_purchase_contract pc |
71 | where pm.contract_id =pc.id | 67 | where pm.contract_id =pc.id |
72 | <if test="param.sparepartCode != null and param.sparepartCode !=''"> and pc.departs like concat('%', #{param.departId}, '%')</if> | 68 | <if test="param.sparepartCode != null and param.sparepartCode !=''"> and pc.departs like concat('%', #{param.departId}, '%')</if> |
73 | <if test="param.sparepartCode != null and param.sparepartCode !=''"> and pm.sparepart_code =#{param.sparepartCode}</if> | 69 | <if test="param.sparepartCode != null and param.sparepartCode !=''"> and pm.sparepart_code =#{param.sparepartCode}</if> |
74 | <if test="param.sparepartType != null and param.sparepartType !=''"> and pm.sparepart_type in (${param.sparepartType}) </if> | 70 | <if test="param.sparepartType != null and param.sparepartType !=''"> and pm.sparepart_type in (${param.sparepartType}) </if> |
75 | <if test="param.sparepartName != null and param.sparepartName !=''"> and pm.sparepart_name like concat('%', #{param.sparepartName}, '%')</if> | 71 | <if test="param.sparepartName != null and param.sparepartName !=''"> and pm.sparepart_name like concat('%', #{param.sparepartName}, '%')</if> |
76 | )aaa | 72 | )aaa |
77 | left join erp_distribut_material dm on aaa.good_code = dm.good_code | 73 | left join erp_distribut_material dm on (aaa.good_code = dm.good_code and aaa.depart_id) |
78 | left join equipment_sparepart_supplies ss on aaa.sparepart_id = ss.id | 74 | left join equipment_sparepart_supplies ss on aaa.sparepart_id = ss.id |
79 | left join equipment_sparepart_type st on st.id = aaa.sparepart_type | 75 | left join equipment_sparepart_type st on st.id = aaa.sparepart_type |
80 | left join ajh_supplier_manage sm on sm.id = aaa.supplier_id | 76 | left join ajh_supplier_manage sm on sm.id = aaa.supplier_id | ... | ... |
... | @@ -20,14 +20,14 @@ public interface IDistributContractService extends IService<DistributContract> { | ... | @@ -20,14 +20,14 @@ public interface IDistributContractService extends IService<DistributContract> { |
20 | * 新增DistributContractVO | 20 | * 新增DistributContractVO |
21 | * @param distributContractVO | 21 | * @param distributContractVO |
22 | */ | 22 | */ |
23 | public void saveDistributContractVO(DistributContractVO distributContractVO); | 23 | public String saveDistributContractVO(DistributContractVO distributContractVO); |
24 | 24 | ||
25 | /** | 25 | /** |
26 | * 修改DistributContractVOVO | 26 | * 修改DistributContractVOVO |
27 | * @param distributContractVO | 27 | * @param distributContractVO |
28 | * @return | 28 | * @return |
29 | */ | 29 | */ |
30 | public boolean updateDistributContractVO(DistributContractVO distributContractVO); | 30 | public String updateDistributContractVO(DistributContractVO distributContractVO); |
31 | 31 | ||
32 | /*** | 32 | /*** |
33 | * 删除DistributContractVOVO | 33 | * 删除DistributContractVOVO | ... | ... |
... | @@ -69,8 +69,4 @@ public interface IERPPurchaseContractService extends IService<ERPPurchaseContrac | ... | @@ -69,8 +69,4 @@ public interface IERPPurchaseContractService extends IService<ERPPurchaseContrac |
69 | * @return | 69 | * @return |
70 | */ | 70 | */ |
71 | int syncEquipmentIn(PurchaseContractVO purchaseContractVO)throws Exception; | 71 | int syncEquipmentIn(PurchaseContractVO purchaseContractVO)throws Exception; |
72 | |||
73 | |||
74 | |||
75 | |||
76 | } | 72 | } | ... | ... |
... | @@ -12,7 +12,9 @@ import com.skua.modules.erp.mapper.PurchaseMaterialMapper; | ... | @@ -12,7 +12,9 @@ import com.skua.modules.erp.mapper.PurchaseMaterialMapper; |
12 | import com.skua.modules.erp.service.IDistributContractService; | 12 | import com.skua.modules.erp.service.IDistributContractService; |
13 | import com.skua.modules.erp.vo.DistributContractVO; | 13 | import com.skua.modules.erp.vo.DistributContractVO; |
14 | import com.skua.modules.erp.vo.PurchasePlanVO; | 14 | import com.skua.modules.erp.vo.PurchasePlanVO; |
15 | import com.skua.modules.system.mapper.SysDepartMapper; | ||
15 | import org.springframework.beans.BeanUtils; | 16 | import org.springframework.beans.BeanUtils; |
17 | import org.springframework.beans.factory.annotation.Autowired; | ||
16 | import org.springframework.stereotype.Service; | 18 | import org.springframework.stereotype.Service; |
17 | 19 | ||
18 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | 20 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
... | @@ -31,21 +33,39 @@ public class DistributContractServiceImpl extends ServiceImpl<DistributContractM | ... | @@ -31,21 +33,39 @@ public class DistributContractServiceImpl extends ServiceImpl<DistributContractM |
31 | 33 | ||
32 | @Resource | 34 | @Resource |
33 | private ApproveRecordMapper recordMapper;//申请记录 | 35 | private ApproveRecordMapper recordMapper;//申请记录 |
34 | 36 | @Autowired | |
37 | private SysDepartMapper departMapper; | ||
35 | 38 | ||
36 | /*** | 39 | /*** |
37 | * 新增DistributContract | 40 | * 新增DistributContract |
38 | * @param distributContractVO | 41 | * @param distributContractVO |
39 | */ | 42 | */ |
40 | public void saveDistributContractVO(DistributContractVO distributContractVO){ | 43 | @Transactional |
41 | int count = this.baseMapper.insert( distributContractVO ); | 44 | public String saveDistributContractVO(DistributContractVO distributContractVO){ |
42 | if(count > 0 && distributContractVO.getMaterialList() != null && !distributContractVO.getMaterialList().isEmpty()){ | 45 | |
46 | String errMsg = null; | ||
47 | if(distributContractVO.getMaterialList() != null && !distributContractVO.getMaterialList().isEmpty()){ | ||
43 | for(DistributMaterial material : distributContractVO.getMaterialList()){ | 48 | for(DistributMaterial material : distributContractVO.getMaterialList()){ |
44 | material.setId(null); | 49 | //根据deptid与goodscode校验 |
45 | material.setContractId( distributContractVO.getId() ); | 50 | int count = checkGoodCodeAndDepartId( material.getGoodCode(),distributContractVO.getDepartId() ); |
46 | materialMapper.insert( material ); | 51 | if(count > 0 ){ |
52 | errMsg = "所属厂站["+departMapper.selectById(distributContractVO.getDepartId()).getDepartName()+"]下的货号["+material.getGoodCode()+"]已经分销过!"; | ||
53 | break; | ||
54 | } | ||
47 | } | 55 | } |
48 | } | 56 | } |
57 | if(errMsg != null ){ | ||
58 | int count = this.baseMapper.insert( distributContractVO ); | ||
59 | if(count > 0 && distributContractVO.getMaterialList() != null && !distributContractVO.getMaterialList().isEmpty()){ | ||
60 | for(DistributMaterial material : distributContractVO.getMaterialList()){ | ||
61 | material.setId(null); | ||
62 | material.setContractId( distributContractVO.getId() ); | ||
63 | material.setDepartId(distributContractVO.getDepartId() ) ;//冗余所属厂站 | ||
64 | materialMapper.insert( material ); | ||
65 | } | ||
66 | } | ||
67 | } | ||
68 | return errMsg; | ||
49 | } | 69 | } |
50 | 70 | ||
51 | 71 | ||
... | @@ -54,23 +74,51 @@ public class DistributContractServiceImpl extends ServiceImpl<DistributContractM | ... | @@ -54,23 +74,51 @@ public class DistributContractServiceImpl extends ServiceImpl<DistributContractM |
54 | * @param distributContractVO | 74 | * @param distributContractVO |
55 | * @return | 75 | * @return |
56 | */ | 76 | */ |
57 | public boolean updateDistributContractVO(DistributContractVO distributContractVO){ | 77 | public String updateDistributContractVO(DistributContractVO distributContractVO){ |
58 | int count = this.baseMapper.updateById( distributContractVO ); | ||
59 | |||
60 | // ge根据计划编号删除清单集合 | ||
61 | materialMapper.delByContractId(distributContractVO.getId() ) ; | ||
62 | 78 | ||
63 | if(count > 0 && distributContractVO.getMaterialList() != null && !distributContractVO.getMaterialList().isEmpty()){ | 79 | String errMsg = null; |
80 | if(distributContractVO.getMaterialList() != null && !distributContractVO.getMaterialList().isEmpty()){ | ||
64 | for(DistributMaterial material : distributContractVO.getMaterialList()){ | 81 | for(DistributMaterial material : distributContractVO.getMaterialList()){ |
65 | material.setId(null); | 82 | //根据deptid与goodscode校验 |
66 | material.setContractId( distributContractVO.getId() ); | 83 | int count = checkGoodCodeAndDepartId( material.getGoodCode(),distributContractVO.getDepartId() ); |
67 | materialMapper.insert( material ); | 84 | if(count > 1 ){ |
85 | errMsg = "所属厂站["+departMapper.selectById(distributContractVO.getDepartId()).getDepartName()+"]下的货号["+material.getGoodCode()+"]已经分销过!"; | ||
86 | break; | ||
87 | } | ||
68 | } | 88 | } |
69 | } | 89 | } |
70 | return count > 0 ? true :false; | 90 | if(errMsg != null ){ |
91 | int count = this.baseMapper.updateById( distributContractVO ); | ||
92 | |||
93 | |||
94 | // ge根据计划编号删除清单集合 | ||
95 | materialMapper.delByContractId(distributContractVO.getId() ) ; | ||
96 | |||
97 | if(count > 0 && distributContractVO.getMaterialList() != null && !distributContractVO.getMaterialList().isEmpty()){ | ||
98 | for(DistributMaterial material : distributContractVO.getMaterialList()){ | ||
99 | material.setId(null); | ||
100 | material.setContractId( distributContractVO.getId() ); | ||
101 | material.setDepartId(distributContractVO.getDepartId() ) ;//冗余所属厂站 | ||
102 | materialMapper.insert( material ); | ||
103 | } | ||
104 | } | ||
105 | } | ||
106 | return errMsg; | ||
71 | } | 107 | } |
72 | 108 | ||
73 | /*** | 109 | /*** |
110 | * 根据所属厂长、以及goodcode校验是否存在 | ||
111 | * @param goodsCode | ||
112 | * @param departId | ||
113 | * @return | ||
114 | */ | ||
115 | public int checkGoodCodeAndDepartId(String goodsCode ,String departId){ | ||
116 | return materialMapper.checkGoodCodeAndDepartId( goodsCode ,departId ); | ||
117 | } | ||
118 | |||
119 | |||
120 | |||
121 | /*** | ||
74 | * 删除DistributContractVOVO | 122 | * 删除DistributContractVOVO |
75 | * @param contractId | 123 | * @param contractId |
76 | */ | 124 | */ | ... | ... |
... | @@ -36,7 +36,7 @@ public class PurchaseMaterialServiceImpl extends ServiceImpl<PurchaseMaterialMap | ... | @@ -36,7 +36,7 @@ public class PurchaseMaterialServiceImpl extends ServiceImpl<PurchaseMaterialMap |
36 | * @return | 36 | * @return |
37 | */ | 37 | */ |
38 | public List<PurchaseMaterial> queryMaterialByGoodCode(String goodCode, String departId){ | 38 | public List<PurchaseMaterial> queryMaterialByGoodCode(String goodCode, String departId){ |
39 | return this.baseMapper.queryByList(goodCode,departId); | 39 | return this.baseMapper.queryMaterialByGoodCode(goodCode,departId); |
40 | } | 40 | } |
41 | /** | 41 | /** |
42 | * 药剂入库查询结果:采购物料清单+分销单价+分销总价 | 42 | * 药剂入库查询结果:采购物料清单+分销单价+分销总价 | ... | ... |
-
请 注册 或 登录 后发表评论