Selaa lähdekoodia

成品粮油下的数量管理添加新增功能

lvzhikai 5 vuotta sitten
vanhempi
commit
6094e0aa0f

+ 54 - 15
src/main/java/com/chinaitop/depot/product/controller/StorageProductFcbgzController.java

@@ -127,11 +127,28 @@ public class StorageProductFcbgzController {
127 127
     }
128 128
 
129 129
     /**
130
+     * 新增用到的仓房下拉
131
+     * @param orgId
132
+     * @return
133
+     */
134
+    @RequestMapping(value = "/getProductHouse" ,produces = MediaType.APPLICATION_JSON_VALUE, method = RequestMethod.GET)
135
+    @ApiOperation(value="仓房下拉", notes = "新增用到的仓房下拉")
136
+    @ApiImplicitParams({
137
+            @ApiImplicitParam(name = "orgId", value = "组织机构id", paramType = "query")
138
+    })
139
+    public List<Map<String,Object>> getProductHouse(String orgId){
140
+        Map<String,Object> map = new HashMap<String, Object>();
141
+        map.put("orgId",orgId);
142
+        List<Map<String,Object>> list = storageProductFcbgzService.getProductHouse(map);
143
+        return ParameterUtil.slashCapitals(list);
144
+    }
145
+
146
+    /**
130 147
      * 新增
131 148
      * @param productJson
132 149
      * @return
133 150
      */
134
-    @RequestMapping(value = "saveProduct" ,produces = MediaType.APPLICATION_JSON_VALUE, method = RequestMethod.POST)
151
+    @RequestMapping(value = "/saveProduct" ,produces = MediaType.APPLICATION_JSON_VALUE, method = RequestMethod.POST)
135 152
     @ApiOperation(value="新增数据", notes = "新增数据")
136 153
     @ApiImplicitParams({
137 154
             @ApiImplicitParam(name = "productJson", value = "JSON数据对象", paramType = "form"),
@@ -144,30 +161,32 @@ public class StorageProductFcbgzController {
144 161
         //如果是提交,则直接设置状态
145 162
         if(ParameterUtil.isequal("typeSubmit",typeState)){
146 163
             storageProductFcbgz.setDeleteState("2");
164
+        }else if(ParameterUtil.isequal("numberData",typeState)){
165
+            storageProductFcbgz.setDeleteState("3");//库存数量新增方法
147 166
         }else {
148 167
             storageProductFcbgz.setDeleteState("1");
149 168
         }
150
-        if(ParameterUtil.isnull(storageProductFcbgz.getId())){
151
-            if(ParameterUtil.isnull(storageProductFcbgz.getStorageQuantity()))
152
-                storageProductFcbgz.setStorageQuantity("0");
153
-            if(ParameterUtil.isnull(storageProductFcbgz.getOutboundQuantity()))
154
-                storageProductFcbgz.setOutboundQuantity("0");
155 169
 
156
-            Integer inventory = Integer.parseInt(storageProductFcbgz.getStorageQuantity()) - Integer.parseInt(storageProductFcbgz.getOutboundQuantity());
157
-            storageProductFcbgz.setInventoryQuantity(inventory.toString());
170
+        if(ParameterUtil.isnull(storageProductFcbgz.getStorageQuantity()))
171
+            storageProductFcbgz.setStorageQuantity("0");
172
+        if(ParameterUtil.isnull(storageProductFcbgz.getOutboundQuantity()))
173
+            storageProductFcbgz.setOutboundQuantity("0");
174
+
175
+        if(ParameterUtil.isnull(storageProductFcbgz.getId())){
176
+            if(!ParameterUtil.isequal("numberData",typeState)) {
177
+                Integer inventory = Integer.parseInt(storageProductFcbgz.getStorageQuantity()) - Integer.parseInt(storageProductFcbgz.getOutboundQuantity());
178
+                storageProductFcbgz.setInventoryQuantity(inventory.toString());
179
+            }
158 180
 
159 181
             storageProductFcbgz.setOrgId(orgId);
160 182
             storageProductFcbgz.setId(ParameterUtil.getCode());
161 183
             storageProductFcbgz.setCreateTime(new Date());
162 184
             storageProductFcbgzService.insert(storageProductFcbgz);
163 185
         }else{
164
-            if(ParameterUtil.isnull(storageProductFcbgz.getStorageQuantity()))
165
-                storageProductFcbgz.setStorageQuantity("0");
166
-            if(ParameterUtil.isnull(storageProductFcbgz.getOutboundQuantity()))
167
-                storageProductFcbgz.setOutboundQuantity("0");
168
-
169
-            Integer inventory = Integer.parseInt(storageProductFcbgz.getStorageQuantity()) - Integer.parseInt(storageProductFcbgz.getOutboundQuantity());
170
-            storageProductFcbgz.setInventoryQuantity(inventory.toString());
186
+            if(!ParameterUtil.isequal("numberData",typeState)) {
187
+                Integer inventory = Integer.parseInt(storageProductFcbgz.getStorageQuantity()) - Integer.parseInt(storageProductFcbgz.getOutboundQuantity());
188
+                storageProductFcbgz.setInventoryQuantity(inventory.toString());
189
+            }
171 190
 
172 191
             storageProductFcbgzService.update(storageProductFcbgz);
173 192
         }
@@ -190,6 +209,26 @@ public class StorageProductFcbgzController {
190 209
     }
191 210
 
192 211
     /**
212
+     * 获取数量详情
213
+     * @return
214
+     */
215
+    @RequestMapping(value = "/getNumberEdit" ,produces = MediaType.APPLICATION_JSON_VALUE, method = RequestMethod.GET)
216
+    @ApiOperation(value="获取数量详情", notes = "获取数量详情")
217
+    @ApiImplicitParams({
218
+            @ApiImplicitParam(name = "orgId", value = "orgId", paramType = "query"),
219
+            @ApiImplicitParam(name = "houseId", value = "houseId", paramType = "query")
220
+    })
221
+    public StorageProductFcbgz getNumberEdit(String orgId, String houseId){
222
+        StorageProductFcbgzExample storageProductFcbgzExample = new StorageProductFcbgzExample();
223
+        StorageProductFcbgzExample.Criteria criteria = storageProductFcbgzExample.createCriteria();
224
+        criteria.andOrgIdEqualTo(Integer.parseInt(orgId));
225
+        criteria.andHouseIdEqualTo(houseId);
226
+        criteria.andDeleteStateEqualTo("3");
227
+        List<StorageProductFcbgz> storageProductFcbgz = storageProductFcbgzService.getlist(storageProductFcbgzExample);
228
+        return storageProductFcbgz.get(0);
229
+    }
230
+
231
+    /**
193 232
      * 移除
194 233
      * @param id
195 234
      * @return

+ 1 - 0
src/main/java/com/chinaitop/depot/product/mapper/StorageProductFcbgzMapper.java

@@ -31,4 +31,5 @@ public interface StorageProductFcbgzMapper {
31 31
     int updateByPrimaryKey(StorageProductFcbgz record);
32 32
 
33 33
     List<Map<String,Object>> getNumberList(Map<String,Object> map);
34
+    List<Map<String,Object>> getProductHouse(Map<String,Object> map);
34 35
 }

+ 28 - 4
src/main/java/com/chinaitop/depot/product/mapper/StorageProductFcbgzMapper.xml

@@ -570,10 +570,11 @@
570 570
     lspz,
571 571
     nature,
572 572
     levels,
573
-    sum(inventory_quantity) inventoryquantity
573
+    max(delete_state) over (partition by house_id order by delete_state desc) AS deletestate,
574
+    sum(inventory_quantity) over (partition by house_id order by house_id) inventoryquantity
574 575
     FROM
575 576
     storage_product_fcbgz
576
-    WHERE delete_state = 2
577
+    WHERE delete_state &lt;&gt; 1
577 578
     <if test="orgId != null">
578 579
       AND org_id = #{orgId}
579 580
     </if>
@@ -588,10 +589,33 @@
588 589
     warehouse_id,
589 590
     lspz,
590 591
     nature,
591
-    levels
592
-    order by to_number(house_id)
592
+    levels,
593
+    delete_state,
594
+    inventory_quantity
593 595
     ) a
594 596
     WHERE a.inventoryquantity &lt;&gt; 0 AND
595 597
     a.rn = 1
596 598
   </select>
599
+
600
+  <select id="getProductHouse" parameterType="java.util.Map" resultType="java.util.Map">
601
+    SELECT
602
+        house.*
603
+    FROM
604
+        basic_storehouse house
605
+    LEFT JOIN storage_product_fcbgz fcbgz ON house.storehouse_id = fcbgz.house_id
606
+    WHERE
607
+        house.org_id = #{orgId}
608
+    AND house.storehouse_id NOT IN (
609
+        SELECT
610
+            house_id
611
+        FROM
612
+            storage_product_fcbgz
613
+        WHERE
614
+            delete_state = 3
615
+    )
616
+    AND house.del_flag = 1
617
+    AND house.library_type = 0
618
+    ORDER BY
619
+        house.storehouse_id ASC
620
+  </select>
597 621
 </mapper>

+ 2 - 0
src/main/java/com/chinaitop/depot/product/service/StorageProductFcbgzService.java

@@ -19,6 +19,8 @@ public interface StorageProductFcbgzService {
19 19
 
20 20
     StorageProductFcbgz getProductById(String id);
21 21
 
22
+    List<Map<String,Object>> getProductHouse(Map<String,Object> map);
23
+
22 24
     void insert(StorageProductFcbgz storageProductFcbgz);
23 25
 
24 26
     void update(StorageProductFcbgz storageProductFcbgz);

+ 4 - 0
src/main/java/com/chinaitop/depot/product/service/impl/StorageProductFcbgzServiceImpl.java

@@ -28,6 +28,10 @@ public class StorageProductFcbgzServiceImpl implements StorageProductFcbgzServic
28 28
     public List<Map<String,Object>> getNumberList(Map<String,Object> map) {
29 29
         return storageProductFcbgzMapper.getNumberList(map);
30 30
     }
31
+    @Override
32
+    public List<Map<String,Object>> getProductHouse(Map<String,Object> map) {
33
+        return storageProductFcbgzMapper.getProductHouse(map);
34
+    }
31 35
 
32 36
     @Override
33 37
     public void insert(StorageProductFcbgz storageProductFcbgz) {