|
@@ -1,5 +1,6 @@
|
1
|
1
|
package com.chinaitop.depot.business.service.impl;
|
2
|
2
|
|
|
3
|
+import java.math.BigDecimal;
|
3
|
4
|
import java.util.Date;
|
4
|
5
|
import java.util.HashMap;
|
5
|
6
|
import java.util.List;
|
|
@@ -8,6 +9,7 @@ import java.util.Map;
|
8
|
9
|
import javax.annotation.Resource;
|
9
|
10
|
|
10
|
11
|
import org.apache.commons.lang.ObjectUtils;
|
|
12
|
+import org.springframework.beans.factory.annotation.Value;
|
11
|
13
|
import org.springframework.stereotype.Service;
|
12
|
14
|
|
13
|
15
|
import com.alibaba.fastjson.JSONObject;
|
|
@@ -18,6 +20,7 @@ import com.chinaitop.depot.business.model.BusinessNoticeReceiveExample.Criteria;
|
18
|
20
|
import com.chinaitop.depot.business.service.FeignAgileService;
|
19
|
21
|
import com.chinaitop.depot.business.service.FeignBasicService;
|
20
|
22
|
import com.chinaitop.depot.business.service.ReceiveNoticeService;
|
|
23
|
+import com.chinaitop.depot.utils.createKC;
|
21
|
24
|
import com.github.pagehelper.PageHelper;
|
22
|
25
|
|
23
|
26
|
@Service
|
|
@@ -30,7 +33,10 @@ public class ReceiveNoticeServiceImpl implements ReceiveNoticeService {
|
30
|
33
|
@Resource
|
31
|
34
|
private FeignAgileService feignAgileService;
|
32
|
35
|
|
33
|
|
-
|
|
36
|
+ // 获取ip地址
|
|
37
|
+ @Value("${crk-webservice}")
|
|
38
|
+ private String url;
|
|
39
|
+
|
34
|
40
|
@Override
|
35
|
41
|
public List<BusinessNoticeReceive> queryByExample(Integer pageNum, Integer pageSize,
|
36
|
42
|
BusinessNoticeReceive businessNoticeReceive,String cktzd,String lyflag) {
|
|
@@ -157,6 +163,8 @@ public class ReceiveNoticeServiceImpl implements ReceiveNoticeService {
|
157
|
163
|
|
158
|
164
|
String hwbm = jsonObject.getString("cfbm");
|
159
|
165
|
if(hwbm!=null){
|
|
166
|
+ Integer grainAttribute = 0 ;
|
|
167
|
+ Integer grainKind = 0;
|
160
|
168
|
//根据仓房编码查询仓房、货位、组织机构数据
|
161
|
169
|
Map<String, Object> wareDataMap = feignBasicService.getWareDataByHwbm(hwbm);
|
162
|
170
|
Integer houseId = (Integer) wareDataMap.get("houseId");
|
|
@@ -165,25 +173,28 @@ public class ReceiveNoticeServiceImpl implements ReceiveNoticeService {
|
165
|
173
|
businessNoticeReceive.setHouseId(houseId); //仓房
|
166
|
174
|
businessNoticeReceive.setWareHouseId(wareHouseId); //货位
|
167
|
175
|
businessNoticeReceive.setOrgId(orgId); //组织id
|
168
|
|
-
|
169
|
|
- //根据仓房、货位、orgId获取粮食品种等信息
|
170
|
|
- Map<String, Object> map = feignAgileService.getDateByChHwh(orgId, houseId, wareHouseId);
|
171
|
|
- Integer grainAttribute = (Integer) map.get("hwxz"); //粮油性质
|
172
|
|
- Integer grainKind = (Integer) map.get("pz"); //品种
|
173
|
|
- Integer grainDetailKind = (Integer) map.get("mxpz"); //明细品种
|
174
|
|
- Integer grainGrade = (Integer) map.get("dj"); //等级
|
175
|
|
-
|
176
|
|
- businessNoticeReceive.setGrainKind(grainKind); //品种
|
177
|
|
- businessNoticeReceive.setGrainDetailKind(grainDetailKind); //明细品种
|
178
|
|
- businessNoticeReceive.setGrainGrade(grainGrade); //等级
|
179
|
|
- businessNoticeReceive.setGrainAttribute(grainAttribute); //粮油性质
|
180
|
|
-
|
|
176
|
+ if(ObjectUtils.toString(jsonObject.getString("ywlx")).equals("6")){//竞买的业务类型
|
|
177
|
+ if(jsonObject.getString("pz")!=null){
|
|
178
|
+ businessNoticeReceive.setGrainKind(Integer.valueOf(jsonObject.getString("pz"))); //接收的品种
|
|
179
|
+ }
|
|
180
|
+ }else{
|
|
181
|
+ //根据仓房、货位、orgId获取粮食品种等信息
|
|
182
|
+ Map<String, Object> map = feignAgileService.getDateByChHwh(orgId, houseId, wareHouseId);
|
|
183
|
+ grainAttribute = (Integer) map.get("hwxz"); //粮油性质
|
|
184
|
+ grainKind = (Integer) map.get("pz"); //品种
|
|
185
|
+ Integer grainDetailKind = (Integer) map.get("mxpz"); //明细品种
|
|
186
|
+ Integer grainGrade = (Integer) map.get("dj"); //等级
|
|
187
|
+ businessNoticeReceive.setGrainKind(grainKind); //品种
|
|
188
|
+ businessNoticeReceive.setGrainDetailKind(grainDetailKind); //明细品种
|
|
189
|
+ businessNoticeReceive.setGrainGrade(grainGrade); //等级
|
|
190
|
+ businessNoticeReceive.setGrainAttribute(grainAttribute); //粮油性质
|
|
191
|
+ }
|
181
|
192
|
String lsyqsl = jsonObject.getString("lsyqsl");
|
182
|
|
- /*BigDecimal s = new BigDecimal(1000);
|
|
193
|
+ BigDecimal s = new BigDecimal(1000);
|
183
|
194
|
BigDecimal sumjhsl = new BigDecimal(lsyqsl);
|
184
|
195
|
BigDecimal sumCkslss = sumjhsl.multiply(s);
|
185
|
196
|
String count = sumCkslss.toString(); //吨转化为公斤
|
186
|
|
- */
|
|
197
|
+
|
187
|
198
|
businessNoticeReceive.setCount(lsyqsl); //计划数量(吨)
|
188
|
199
|
businessNoticeReceive.setOutgoingPeriod(jsonObject.getString("ckqx")); //出库期限(日期格式)
|
189
|
200
|
|
|
@@ -192,7 +203,43 @@ public class ReceiveNoticeServiceImpl implements ReceiveNoticeService {
|
192
|
203
|
businessNoticeReceive.setReceiveTime(new Date());//接收数据的时间
|
193
|
204
|
businessNoticeReceiveMapper.insert(businessNoticeReceive);
|
194
|
205
|
|
195
|
|
- modelMap.put("status", "success");
|
|
206
|
+ /**
|
|
207
|
+ * 修改粮食性质(轮换或者销售进行修改)
|
|
208
|
+ * parameters[0] = ; //单位ID
|
|
209
|
+ parameters[1] = ; //粮食品种
|
|
210
|
+ parameters[2] = null; //空就行
|
|
211
|
+ parameters[3] = ; //仓房ID
|
|
212
|
+ parameters[4] = ; //货位ID
|
|
213
|
+ parameters[5] = ; //需要改变成的粮食性质
|
|
214
|
+ parameters[6] = ; //原来的粮食性质
|
|
215
|
+ parameters[7] = ; //库存数量或者要改变的数量
|
|
216
|
+ parameters[8]=; //批准文号(山西用)
|
|
217
|
+ parameters[9]=; //性质变动原因
|
|
218
|
+ parameters[10] = ; //1:新增;2:修改;3:删除
|
|
219
|
+ */
|
|
220
|
+ if(!ObjectUtils.toString(jsonObject.getString("ywlx")).equals("6")){
|
|
221
|
+ Object parameters[] = new Object[11];
|
|
222
|
+ parameters[0] = orgId+"";//组织id
|
|
223
|
+ parameters[1] = grainKind+"";//粮食品种
|
|
224
|
+ parameters[2] = null;//
|
|
225
|
+ parameters[3] = houseId+"";//仓房id
|
|
226
|
+ parameters[4] = wareHouseId+"";//货位id
|
|
227
|
+ parameters[5] = 6871+"";//需要改变成的粮食性质(其他商品粮)
|
|
228
|
+ parameters[6] = grainAttribute+"";//原来的粮食性质
|
|
229
|
+ parameters[7] = count+"";//原来的粮食性质
|
|
230
|
+ parameters[8] = jsonObject.getString("tzdid")+"";//原来的粮食性质
|
|
231
|
+ parameters[9] = "转储性质变动";
|
|
232
|
+ parameters[10] = 2+"";
|
|
233
|
+ String str = createKC.createKC("ChangeGrainAttribute", url, parameters);
|
|
234
|
+ if ("true".equals(str)) {
|
|
235
|
+ modelMap.put("status", "success");
|
|
236
|
+ } else {
|
|
237
|
+ modelMap.put("status", "error");
|
|
238
|
+ modelMap.put("msg", "保存失败,库存同步异常,请联系管理员!");
|
|
239
|
+ return modelMap;
|
|
240
|
+ }
|
|
241
|
+ }
|
|
242
|
+
|
196
|
243
|
}else{
|
197
|
244
|
modelMap.put("msg", "仓房编码为空");
|
198
|
245
|
modelMap.put("status", "error");
|