ZeroLiYi 1 anno fa
parent
commit
73347d2fec

+ 1 - 42
src/main/java/com/chinaitop/depot/rp/controller/BusinessRpReportController.java

@@ -123,28 +123,7 @@ public class BusinessRpReportController {
123 123
         return orgInfoList;
124 124
     }
125 125
 
126
-//    /**
127
-//     * 根据warehouseId查询出库质检报告
128
-//     *
129
-//     * @param warehouseId
130
-//     * @return
131
-//     */
132
-//    @RequestMapping(value = "/findByWarehouseInfo",produces = MediaType.APPLICATION_JSON_VALUE,method = RequestMethod.GET)
133
-//    @ApiOperation(value="根据warehouseId查询粮情卡数据", notes = "根据warehouseId查询粮情卡数据")
134
-//    @ApiImplicitParams({
135
-//            @ApiImplicitParam(name = "warehouseId", value = "货位id", paramType = "form")
136
-//    })
137
-//    public BusinessRpOutboundVO findByQualityCheckInfo(Integer warehouseId) {
138
-//        BusinessRpOutboundVO businessRpOutboundVO=new BusinessRpOutboundVO();
139
-//        try {
140
-//
141
-//            businessRpOutboundVO = businessRpReportService.findByfindByQualityCheckInfo(warehouseId);
142
-//            return businessRpOutboundVO;
143
-//        } catch (Exception e) {
144
-//            e.printStackTrace();
145
-//        }
146
-//        return businessRpOutboundVO;
147
-//    }
126
+
148 127
 
149 128
     //
150 129
     /**
@@ -160,26 +139,6 @@ public class BusinessRpReportController {
160 139
         return list;
161 140
     }
162 141
 
163
-    /**
164
-     * 查询质检报告
165
-     * @return
166
-     * @throws Exception
167
-     */
168
-//    @RequestMapping(value="/getQualityInspectionFindById",produces = MediaType.APPLICATION_JSON_VALUE, method=RequestMethod.GET)
169
-//    @ApiOperation(value="新增时得到查询质检报告", notes = "新增时得到查询质检报告")
170
-//    @ApiImplicitParams({
171
-//            @ApiImplicitParam(name = "rpReportId", value = "轮换计划上报id", paramType = "form"),
172
-//            @ApiImplicitParam(name = "warehouseId", value = "货位id", paramType = "form"),
173
-//            @ApiImplicitParam(name = "jylb", value = "检验类别", paramType = "form"),
174
-//            @ApiImplicitParam(name = "inspectionReportId", value = "质检报告id", paramType = "form")
175
-//
176
-//
177
-//    })
178
-//    public List<BusinessQcQualityInspection> getRpReportDetailsByAdd(String rpReportId, Integer warehouseId, String jylb,Integer inspectionReportId) throws Exception {
179
-//
180
-//        List<BusinessQcQualityInspection> list = businessRpReportService.getQualityInspectionFindById(rpReportId,warehouseId,jylb,inspectionReportId);
181
-//        return list;
182
-//    }
183 142
 
184 143
     /**
185 144
      * 根据货位查询粮情卡质检报告

+ 4 - 2
src/main/java/com/chinaitop/depot/rp/mapper/BusinessRpInboundMapper.xml

@@ -168,7 +168,7 @@
168 168
             <if test="quantity != null" >
169 169
                 quantity,
170 170
             </if>
171
-            <if test="storagePeriod != null" >
171
+            <if test="productPeriod != null" >
172 172
                 product_period,
173 173
             </if>
174 174
             <if test="planQuantity != null" >
@@ -200,7 +200,7 @@
200 200
             <if test="grainNatureId != null" >
201 201
                 #{grainNatureId,jdbcType=INTEGER},
202 202
             </if>
203
-            <if test="grainNatureId != null" >
203
+            <if test="quantity != null" >
204 204
                 #{quantity,jdbcType=DECIMAL},
205 205
             </if>
206 206
             <if test="productPeriod != null" >
@@ -340,6 +340,7 @@ d.grain_nature_id,
340 340
 d.quantity,
341 341
 d.product_period,
342 342
 d.plan_quantity,
343
+ o.org_name orgName,
343 344
 pz.enumname as "grainVarietyName",
344 345
 xz.enumname as "grainNatureName"
345 346
 FROM
@@ -347,6 +348,7 @@ FROM
347 348
 INNER JOIN depot_qh.business_rp_inbound d ON d.rp_report_id = c.id
348 349
 LEFT JOIN depot_qh.basic_enum pz on pz.enumId = d.grain_variety_id
349 350
 LEFT JOIN depot_qh.basic_enum xz on xz.enumId = d.grain_nature_id
351
+        LEFT JOIN    depot_qh.org_info o on d.org_id=o.org_id
350 352
     where 1=1
351 353
 
352 354
         <if test="rpReportId !=null and rpReportId !=''">

+ 8 - 6
src/main/java/com/chinaitop/depot/rp/mapper/BusinessRpOutboundMapper.xml

@@ -623,7 +623,8 @@
623 623
     d.inspection_report_id,
624 624
     d.regular_inspection_report_ids,
625 625
     d.plan_quantity,
626
-    st.storehouse_name as "basicStorehouseName",
626
+        o.org_name orgName,
627
+    st.storehouse_name as "storehouseName",
627 628
     wa.warehouse_name  as "warehouseName",
628 629
     pz.enumname as "grainVarietyName",
629 630
     xz.enumname as "grainNatureName",
@@ -631,11 +632,12 @@
631 632
     FROM
632 633
         depot_qh.business_rp_report c
633 634
     INNER JOIN depot_qh.business_rp_outbound d ON d.rp_report_id = c.id
634
-    LEFT JOIN depot_qh.basic_storehouse st on st.storehouse_id = d.basic_storehouse_id  -- 仓房
635
-    LEFT JOIN depot_qh.basic_warehouse wa on wa.warehouse_id = d.warehouse_id  -- 货位
636
-    LEFT JOIN depot_qh.basic_enum pz on pz.enumId = d.grain_variety_id -- 品种
637
-    LEFT JOIN depot_qh.basic_enum xz on xz.enumId = d.grain_nature_id  -- 性质
638
-    LEFT JOIN depot_qh.basic_enum dj on dj.enumId = d.grain_grade_id  -- 等级
635
+    LEFT JOIN depot_qh.basic_storehouse st on st.storehouse_id = d.basic_storehouse_id
636
+    LEFT JOIN depot_qh.basic_warehouse wa on wa.warehouse_id = d.warehouse_id
637
+    LEFT JOIN depot_qh.basic_enum pz on pz.enumId = d.grain_variety_id
638
+    LEFT JOIN depot_qh.basic_enum xz on xz.enumId = d.grain_nature_id
639
+    LEFT JOIN depot_qh.basic_enum dj on dj.enumId = d.grain_grade_id
640
+    LEFT JOIN    depot_qh.org_info o on d.org_id=o.org_id
639 641
     where 1=1
640 642
         <if test="rpReportId !=null and rpReportId !=''">
641 643
             and c.id = #{rpReportId}

+ 28 - 14
src/main/java/com/chinaitop/depot/rp/service/impl/BusinessRpReportServiceImpl.java

@@ -117,7 +117,6 @@ public class BusinessRpReportServiceImpl implements BusinessRpReportService {
117 117
     @Override
118 118
     public Map<String, Object> add(BusinessRpReport businessRpReport) {
119 119
         Map<String,Object> result = new HashMap<>();
120
-        result.put("status", "error");
121 120
         List<BusinessRpInbound>  businessRpInbound = businessRpReport.getBusinessRpInboundList();
122 121
 //        if (businessRpInbound.size() <= 0){
123 122
 //            result.put("msg", "出库信息不能为空");
@@ -134,12 +133,14 @@ public class BusinessRpReportServiceImpl implements BusinessRpReportService {
134 133
                 for (BusinessRpInbound br: inList) {
135 134
                     br.setCreatedate(new Date());
136 135
                     br.setUpdatedate(new Date());
136
+                    br.setRpReportId(businessRpReport.getId());
137 137
                     businessRpInboundMapper.insertSelective(br);
138 138
                 }
139 139
                 List<BusinessRpOutbound> outlist =businessRpReport.getBusinessRpOutboundList();
140 140
                 for (BusinessRpOutbound ou: outlist) {
141 141
                     ou.setCreatedate(new Date());
142 142
                     ou.setUpdatedate(new Date());
143
+                    ou.setRpReportId(businessRpReport.getId());
143 144
                     businessRpOutboundMapper.insertSelective(ou);
144 145
                 }
145 146
             }else{//保存
@@ -165,24 +166,37 @@ public class BusinessRpReportServiceImpl implements BusinessRpReportService {
165 166
         }else{//提交
166 167
 
167 168
             if(businessRpReport.getId()!=null){//修改
169
+                //根据id查找主表数据
170
+                BusinessRpReportVO businessRpReportVO =businessRpReportMapper.getRpReportFindByById(businessRpReport.getId());
171
+                if(businessRpReportVO!=null){
172
+                    result.put("status", "error");
173
+                    result.put("msg", "请填写数据后再执行上传操作");
174
+                }
168 175
                 businessRpReportMapper.updateByPrimaryKeySelective(businessRpReport);
169
-                businessRpInboundMapper.deleteByReportId(businessRpReport.getId());
170
-                businessRpOutboundMapper.deleteByReportId(businessRpReport.getId());
171 176
                 List<BusinessRpInbound> inList =businessRpReport.getBusinessRpInboundList();
172
-                for (BusinessRpInbound br: inList) {
173
-                    br.setCreatedate(new Date());
174
-                    br.setUpdatedate(new Date());
175
-                    br.setRpReportId(businessRpReport.getId());
176
-                    businessRpInboundMapper.insertSelective(br);
177
+                if(!inList.isEmpty()){
178
+                    businessRpInboundMapper.deleteByReportId(businessRpReport.getId());
179
+                    for (BusinessRpInbound br: inList) {
180
+                        br.setCreatedate(new Date());
181
+                        br.setUpdatedate(new Date());
182
+                        br.setRpReportId(businessRpReport.getId());
183
+                        businessRpInboundMapper.insertSelective(br);
184
+                    }
177 185
                 }
178 186
                 List<BusinessRpOutbound> outlist =businessRpReport.getBusinessRpOutboundList();
179
-                for (BusinessRpOutbound ou: outlist) {
180
-                    ou.setCreatedate(new Date());
181
-                    ou.setUpdatedate(new Date());
182
-                    ou.setRpReportId(businessRpReport.getId());
183
-                    businessRpOutboundMapper.insertSelective(ou);
184
-                }
187
+               if(!outlist.isEmpty()){
188
+                   businessRpOutboundMapper.deleteByReportId(businessRpReport.getId());
189
+                   for (BusinessRpOutbound ou: outlist) {
190
+                       ou.setCreatedate(new Date());
191
+                       ou.setUpdatedate(new Date());
192
+                       ou.setRpReportId(businessRpReport.getId());
193
+                       businessRpOutboundMapper.insertSelective(ou);
194
+                   }
195
+               }
196
+
197
+
185 198
             }else{//保存
199
+
186 200
                 businessRpReport.setCreateTime(new Date());
187 201
                 businessRpReport.setUpdateTime(new Date());
188 202
                 businessRpReportMapper.insert(businessRpReport);