|
|
@@ -126,7 +126,7 @@ public class ReceiveNoticeServiceImpl implements ReceiveNoticeService {
|
|
126
|
126
|
|
|
127
|
127
|
|
|
128
|
128
|
@Override
|
|
129
|
|
- public Map<String, Object> add(String notice) throws Exception {
|
|
|
129
|
+ public Map<String, Object> receiveNotice(String notice) throws Exception {
|
|
130
|
130
|
|
|
131
|
131
|
Map<String, Object> modelMap = new HashMap<String, Object>();
|
|
132
|
132
|
|
|
|
@@ -135,142 +135,167 @@ public class ReceiveNoticeServiceImpl implements ReceiveNoticeService {
|
|
135
|
135
|
JSONObject jsonObject = JSONObject.parseObject(notice);
|
|
136
|
136
|
BusinessNoticeReceive businessNoticeReceive = new BusinessNoticeReceive();
|
|
137
|
137
|
businessNoticeReceive.setNoticeNumber(jsonObject.getString("tzdid")); //接收通知单编号
|
|
|
138
|
+
|
|
|
139
|
+ /**
|
|
|
140
|
+ * 根据通知单编号查询是否存在 存在则更改出库期限时间
|
|
|
141
|
+ * 否则 新增数据
|
|
|
142
|
+ */
|
|
|
143
|
+
|
|
|
144
|
+ BusinessNoticeReceiveExample example = new BusinessNoticeReceiveExample();
|
|
|
145
|
+ Criteria createCriteria = example.createCriteria();
|
|
|
146
|
+ createCriteria.andNoticeNumberEqualTo(jsonObject.getString("tzdid"));
|
|
|
147
|
+ List<BusinessNoticeReceive> selectByExample = businessNoticeReceiveMapper.selectByExample(example);
|
|
|
148
|
+
|
|
|
149
|
+ if(selectByExample.size()>0){//存在修改
|
|
|
150
|
+ BusinessNoticeReceive record = new BusinessNoticeReceive();
|
|
|
151
|
+ record.setId(selectByExample.get(0).getId());
|
|
|
152
|
+ record.setOutgoingPeriod(jsonObject.getString("ckqx"));
|
|
|
153
|
+ int k = businessNoticeReceiveMapper.updateByPrimaryKeySelective(record);
|
|
|
154
|
+ if(k<0){
|
|
|
155
|
+ modelMap.put("status", "error");
|
|
|
156
|
+ }
|
|
|
157
|
+ }else{
|
|
|
158
|
+ /**
|
|
|
159
|
+ * 新增
|
|
|
160
|
+ */
|
|
|
161
|
+
|
|
|
162
|
+ if(jsonObject.getString("tzdlx")!=null && jsonObject.getString("ywlx")!=null){
|
|
|
163
|
+ if(ObjectUtils.toString(jsonObject.getString("tzdlx")).equals("01")){ //出入库类型(01:出库 02:入库 03:出入库)
|
|
|
164
|
+ businessNoticeReceive.setCrktype("3"); //1入 3出
|
|
|
165
|
+ businessNoticeReceive.setForwardingUnit(jsonObject.getString("khssyqmc")); //发货单位
|
|
|
166
|
+ }else if (ObjectUtils.toString(jsonObject.getString("tzdlx")).equals("02")){
|
|
|
167
|
+ businessNoticeReceive.setCrktype("1"); //1入 3出
|
|
|
168
|
+ businessNoticeReceive.setReceiveUnit(jsonObject.getString("ssyqmc")); //收货单位
|
|
|
169
|
+ }else if(ObjectUtils.toString(jsonObject.getString("tzdlx")).equals("03")){
|
|
|
170
|
+ businessNoticeReceive.setCrktype("13"); //1入 3出
|
|
|
171
|
+ businessNoticeReceive.setForwardingUnit(jsonObject.getString("khssyqmc")); //发货单位
|
|
|
172
|
+ }
|
|
138
|
173
|
|
|
139
|
|
- if(jsonObject.getString("tzdlx")!=null && jsonObject.getString("ywlx")!=null){
|
|
140
|
|
- if(ObjectUtils.toString(jsonObject.getString("tzdlx")).equals("01")){ //出入库类型(01:出库 02:入库 03:出入库)
|
|
141
|
|
- businessNoticeReceive.setCrktype("3"); //1入 3出
|
|
142
|
|
- businessNoticeReceive.setForwardingUnit(jsonObject.getString("khssyqmc")); //发货单位
|
|
143
|
|
- }else if (ObjectUtils.toString(jsonObject.getString("tzdlx")).equals("02")){
|
|
144
|
|
- businessNoticeReceive.setCrktype("1"); //1入 3出
|
|
145
|
|
- businessNoticeReceive.setReceiveUnit(jsonObject.getString("ssyqmc")); //收货单位
|
|
146
|
|
- }else if(ObjectUtils.toString(jsonObject.getString("tzdlx")).equals("03")){
|
|
147
|
|
- businessNoticeReceive.setCrktype("13"); //1入 3出
|
|
148
|
|
- businessNoticeReceive.setForwardingUnit(jsonObject.getString("khssyqmc")); //发货单位
|
|
149
|
|
- }
|
|
150
|
|
-
|
|
151
|
|
- if(ObjectUtils.toString(jsonObject.getString("ywlx")).equals("6")){ //业务类型 (6:竞买;7:销售 4:轮换)
|
|
152
|
|
- businessNoticeReceive.setYwtype("1"); //1收储 2 销售 3轮换
|
|
153
|
|
- }else if (ObjectUtils.toString(jsonObject.getString("ywlx")).equals("4")){
|
|
154
|
|
- businessNoticeReceive.setYwtype("3");
|
|
155
|
|
- }else if (ObjectUtils.toString(jsonObject.getString("ywlx")).equals("7")){
|
|
156
|
|
- businessNoticeReceive.setYwtype("2");
|
|
157
|
|
- }
|
|
|
174
|
+ if(ObjectUtils.toString(jsonObject.getString("ywlx")).equals("6")){ //业务类型 (6:竞买;7:销售 4:轮换)
|
|
|
175
|
+ businessNoticeReceive.setYwtype("1"); //1收储 2 销售 3轮换
|
|
|
176
|
+ }else if (ObjectUtils.toString(jsonObject.getString("ywlx")).equals("4")){
|
|
|
177
|
+ businessNoticeReceive.setYwtype("3");
|
|
|
178
|
+ }else if (ObjectUtils.toString(jsonObject.getString("ywlx")).equals("7")){
|
|
|
179
|
+ businessNoticeReceive.setYwtype("2");
|
|
|
180
|
+ }
|
|
158
|
181
|
|
|
159
|
|
- businessNoticeReceive.setContractNumber(jsonObject.getString("sshtbm")); //协议编号/合同编号
|
|
|
182
|
+ businessNoticeReceive.setContractNumber(jsonObject.getString("sshtbm")); //协议编号/合同编号
|
|
160
|
183
|
|
|
161
|
|
- String hwbm = jsonObject.getString("cfbm");
|
|
162
|
|
- if(hwbm!=null){
|
|
163
|
|
- Integer grainAttribute = 0 ;
|
|
164
|
|
- Integer grainKind = 0;
|
|
165
|
|
- //根据仓房编码查询仓房、货位、组织机构数据
|
|
166
|
|
- Map<String, Object> wareDataMap = feignBasicService.getWareDataByHwbm(hwbm);
|
|
167
|
|
- if (null == wareDataMap) {
|
|
168
|
|
- modelMap.put("msg", "未获取到对应仓房和货位信息");
|
|
169
|
|
- modelMap.put("status", "error");
|
|
170
|
|
- } else {
|
|
171
|
|
- Integer houseId = (Integer) wareDataMap.get("houseId");
|
|
172
|
|
- Integer wareHouseId = (Integer) wareDataMap.get("wareHouseId");
|
|
173
|
|
- Integer orgId = (Integer) wareDataMap.get("orgId");
|
|
174
|
|
- businessNoticeReceive.setHouseId(houseId); //仓房
|
|
175
|
|
- businessNoticeReceive.setWareHouseId(wareHouseId); //货位
|
|
176
|
|
- businessNoticeReceive.setOrgId(orgId); //组织id
|
|
177
|
|
- if(ObjectUtils.toString(jsonObject.getString("ywlx")).equals("6")){//竞买的业务类型
|
|
178
|
|
- if(jsonObject.getString("pz")!=null){
|
|
179
|
|
- String code = jsonObject.getString("pzbm");//品种编码
|
|
180
|
|
- if (StringUtils.isNotBlank(code)) {
|
|
181
|
|
- code = code.substring(0,3);//获取前三位
|
|
182
|
|
- Map<String, Object> basicMap = feignBasicService.getIdByNameAndParentId(1061, null, code);//1004是生产年份的父ID
|
|
183
|
|
- businessNoticeReceive.setGrainKind((Integer) basicMap.get("enumId")); //接收的品种大类
|
|
|
184
|
+ String hwbm = jsonObject.getString("cfbm");
|
|
|
185
|
+ if(hwbm!=null){
|
|
|
186
|
+ Integer grainAttribute = 0 ;
|
|
|
187
|
+ Integer grainKind = 0;
|
|
|
188
|
+ //根据仓房编码查询仓房、货位、组织机构数据
|
|
|
189
|
+ Map<String, Object> wareDataMap = feignBasicService.getWareDataByHwbm(hwbm);
|
|
|
190
|
+ if (null == wareDataMap) {
|
|
|
191
|
+ modelMap.put("msg", "未获取到对应仓房和货位信息");
|
|
|
192
|
+ modelMap.put("status", "error");
|
|
|
193
|
+ } else {
|
|
|
194
|
+ Integer houseId = (Integer) wareDataMap.get("houseId");
|
|
|
195
|
+ Integer wareHouseId = (Integer) wareDataMap.get("wareHouseId");
|
|
|
196
|
+ Integer orgId = (Integer) wareDataMap.get("orgId");
|
|
|
197
|
+ businessNoticeReceive.setHouseId(houseId); //仓房
|
|
|
198
|
+ businessNoticeReceive.setWareHouseId(wareHouseId); //货位
|
|
|
199
|
+ businessNoticeReceive.setOrgId(orgId); //组织id
|
|
|
200
|
+ if(ObjectUtils.toString(jsonObject.getString("ywlx")).equals("6")){//竞买的业务类型
|
|
|
201
|
+ if(jsonObject.getString("pz")!=null){
|
|
|
202
|
+ String code = jsonObject.getString("pzbm");//品种编码
|
|
|
203
|
+ if (StringUtils.isNotBlank(code)) {
|
|
|
204
|
+ code = code.substring(0,3);//获取前三位
|
|
|
205
|
+ Map<String, Object> basicMap = feignBasicService.getIdByNameAndParentId(1061, null, code);//1004是生产年份的父ID
|
|
|
206
|
+ businessNoticeReceive.setGrainKind((Integer) basicMap.get("enumId")); //接收的品种大类
|
|
|
207
|
+ }
|
|
184
|
208
|
}
|
|
|
209
|
+ }else{
|
|
|
210
|
+ //根据仓房、货位、orgId获取粮食品种等信息
|
|
|
211
|
+ Map<String, Object> map = feignAgileService.getDateByChHwh(orgId, houseId, wareHouseId);
|
|
|
212
|
+ grainAttribute = (Integer) map.get("hwxz"); //粮油性质
|
|
|
213
|
+ grainKind = (Integer) map.get("pz"); //品种
|
|
|
214
|
+ Integer grainDetailKind = (Integer) map.get("mxpz"); //明细品种
|
|
|
215
|
+ Integer grainGrade = (Integer) map.get("dj"); //等级
|
|
|
216
|
+ String inputTime = map.get("rq")+""; //入库时间
|
|
|
217
|
+ Integer scnf = Integer.parseInt(map.get("scnf")+"");
|
|
|
218
|
+ Date date = null;
|
|
|
219
|
+ if(inputTime!=null){
|
|
|
220
|
+ date = ParameterUtil.string2datetime(inputTime);
|
|
|
221
|
+ businessNoticeReceive.setInputTime(date);//入库时间
|
|
|
222
|
+ }
|
|
|
223
|
+ businessNoticeReceive.setProductiveYear(scnf);//生产年份
|
|
|
224
|
+ businessNoticeReceive.setGrainAnnual(scnf);//收获年度
|
|
|
225
|
+
|
|
|
226
|
+ Integer grainProducingArea = (Integer) map.get("gb"); //产地
|
|
|
227
|
+
|
|
|
228
|
+ businessNoticeReceive.setGrainKind(grainKind); //品种
|
|
|
229
|
+ businessNoticeReceive.setGrainDetailKind(grainDetailKind); //明细品种
|
|
|
230
|
+ businessNoticeReceive.setGrainGrade(grainGrade); //等级
|
|
|
231
|
+ businessNoticeReceive.setGrainAttribute(grainAttribute); //粮油性质
|
|
|
232
|
+ businessNoticeReceive.setGrainProducingArea(grainProducingArea);//产地
|
|
|
233
|
+
|
|
185
|
234
|
}
|
|
186
|
|
- }else{
|
|
187
|
|
- //根据仓房、货位、orgId获取粮食品种等信息
|
|
188
|
|
- Map<String, Object> map = feignAgileService.getDateByChHwh(orgId, houseId, wareHouseId);
|
|
189
|
|
- grainAttribute = (Integer) map.get("hwxz"); //粮油性质
|
|
190
|
|
- grainKind = (Integer) map.get("pz"); //品种
|
|
191
|
|
- Integer grainDetailKind = (Integer) map.get("mxpz"); //明细品种
|
|
192
|
|
- Integer grainGrade = (Integer) map.get("dj"); //等级
|
|
193
|
|
- String inputTime = map.get("rq")+""; //入库时间
|
|
194
|
|
- Integer scnf = Integer.parseInt(map.get("scnf")+"");
|
|
195
|
|
- Date date = null;
|
|
196
|
|
- if(inputTime!=null){
|
|
197
|
|
- date = ParameterUtil.string2datetime(inputTime);
|
|
198
|
|
- businessNoticeReceive.setInputTime(date);//入库时间
|
|
199
|
|
- }
|
|
200
|
|
- businessNoticeReceive.setProductiveYear(scnf);//生产年份
|
|
201
|
|
- businessNoticeReceive.setGrainAnnual(scnf);//收获年度
|
|
|
235
|
+ String lsyqsl = jsonObject.getString("lsyqsl");
|
|
|
236
|
+// BigDecimal s = new BigDecimal(1000);
|
|
|
237
|
+// BigDecimal sumjhsl = new BigDecimal(lsyqsl);
|
|
|
238
|
+// BigDecimal sumCkslss = sumjhsl.multiply(s);
|
|
|
239
|
+ //String count = sumCkslss.toString(); //吨转化为公斤
|
|
202
|
240
|
|
|
203
|
|
- Integer grainProducingArea = (Integer) map.get("gb"); //产地
|
|
|
241
|
+ businessNoticeReceive.setCount(lsyqsl); //计划数量(吨)
|
|
|
242
|
+ businessNoticeReceive.setOutgoingPeriod(jsonObject.getString("ckqx")); //出库期限(日期格式)
|
|
204
|
243
|
|
|
205
|
|
- businessNoticeReceive.setGrainKind(grainKind); //品种
|
|
206
|
|
- businessNoticeReceive.setGrainDetailKind(grainDetailKind); //明细品种
|
|
207
|
|
- businessNoticeReceive.setGrainGrade(grainGrade); //等级
|
|
208
|
|
- businessNoticeReceive.setGrainAttribute(grainAttribute); //粮油性质
|
|
209
|
|
- businessNoticeReceive.setGrainProducingArea(grainProducingArea);//产地
|
|
|
244
|
+ businessNoticeReceive.setInApplication(1); //启用
|
|
210
|
245
|
|
|
|
246
|
+ businessNoticeReceive.setReceiveTime(new Date());//接收数据的时间
|
|
|
247
|
+ businessNoticeReceiveMapper.insert(businessNoticeReceive);
|
|
211
|
248
|
}
|
|
212
|
|
- String lsyqsl = jsonObject.getString("lsyqsl");
|
|
213
|
|
-// BigDecimal s = new BigDecimal(1000);
|
|
214
|
|
-// BigDecimal sumjhsl = new BigDecimal(lsyqsl);
|
|
215
|
|
-// BigDecimal sumCkslss = sumjhsl.multiply(s);
|
|
216
|
|
- //String count = sumCkslss.toString(); //吨转化为公斤
|
|
217
|
249
|
|
|
218
|
|
- businessNoticeReceive.setCount(lsyqsl); //计划数量(吨)
|
|
219
|
|
- businessNoticeReceive.setOutgoingPeriod(jsonObject.getString("ckqx")); //出库期限(日期格式)
|
|
220
|
250
|
|
|
221
|
|
- businessNoticeReceive.setInApplication(1); //启用
|
|
|
251
|
+ /**
|
|
|
252
|
+ * 修改粮食性质(轮换或者销售进行修改)
|
|
|
253
|
+ * parameters[0] = ; //单位ID
|
|
|
254
|
+ parameters[1] = ; //粮食品种
|
|
|
255
|
+ parameters[2] = null; //空就行
|
|
|
256
|
+ parameters[3] = ; //仓房ID
|
|
|
257
|
+ parameters[4] = ; //货位ID
|
|
|
258
|
+ parameters[5] = ; //需要改变成的粮食性质
|
|
|
259
|
+ parameters[6] = ; //原来的粮食性质
|
|
|
260
|
+ parameters[7] = ; //库存数量或者要改变的数量
|
|
|
261
|
+ parameters[8]=; //批准文号(山西用)
|
|
|
262
|
+ parameters[9]=; //性质变动原因
|
|
|
263
|
+ parameters[10] = ; //1:新增;2:修改;3:删除
|
|
|
264
|
+ */
|
|
|
265
|
+ /*if(!ObjectUtils.toString(jsonObject.getString("ywlx")).equals("6")){
|
|
|
266
|
+ Object parameters[] = new Object[11];
|
|
|
267
|
+ parameters[0] = orgId+"";//组织id
|
|
|
268
|
+ parameters[1] = grainKind+"";//粮食品种
|
|
|
269
|
+ parameters[2] = null;//
|
|
|
270
|
+ parameters[3] = houseId+"";//仓房id
|
|
|
271
|
+ parameters[4] = wareHouseId+"";//货位id
|
|
|
272
|
+ parameters[5] = 6871+"";//需要改变成的粮食性质(其他商品粮)
|
|
|
273
|
+ parameters[6] = grainAttribute+"";//原来的粮食性质
|
|
|
274
|
+ parameters[7] = count+"";//原来的粮食性质
|
|
|
275
|
+ parameters[8] = jsonObject.getString("tzdid")+"";//原来的粮食性质
|
|
|
276
|
+ parameters[9] = "转储性质变动";
|
|
|
277
|
+ parameters[10] = 2+"";
|
|
|
278
|
+ String str = createKC.createKC("ChangeGrainAttribute", url, parameters);
|
|
|
279
|
+ if ("true".equals(str)) {
|
|
|
280
|
+ modelMap.put("status", "success");
|
|
|
281
|
+ } else {
|
|
|
282
|
+ modelMap.put("status", "error");
|
|
|
283
|
+ modelMap.put("msg", "保存失败,库存同步异常,请联系管理员!");
|
|
|
284
|
+ return modelMap;
|
|
|
285
|
+ }
|
|
|
286
|
+ }*/
|
|
222
|
287
|
|
|
223
|
|
- businessNoticeReceive.setReceiveTime(new Date());//接收数据的时间
|
|
224
|
|
- businessNoticeReceiveMapper.insert(businessNoticeReceive);
|
|
|
288
|
+ }else{
|
|
|
289
|
+ modelMap.put("msg", "仓房编码为空");
|
|
|
290
|
+ modelMap.put("status", "error");
|
|
225
|
291
|
}
|
|
226
|
292
|
|
|
227
|
|
-
|
|
228
|
|
- /**
|
|
229
|
|
- * 修改粮食性质(轮换或者销售进行修改)
|
|
230
|
|
- * parameters[0] = ; //单位ID
|
|
231
|
|
- parameters[1] = ; //粮食品种
|
|
232
|
|
- parameters[2] = null; //空就行
|
|
233
|
|
- parameters[3] = ; //仓房ID
|
|
234
|
|
- parameters[4] = ; //货位ID
|
|
235
|
|
- parameters[5] = ; //需要改变成的粮食性质
|
|
236
|
|
- parameters[6] = ; //原来的粮食性质
|
|
237
|
|
- parameters[7] = ; //库存数量或者要改变的数量
|
|
238
|
|
- parameters[8]=; //批准文号(山西用)
|
|
239
|
|
- parameters[9]=; //性质变动原因
|
|
240
|
|
- parameters[10] = ; //1:新增;2:修改;3:删除
|
|
241
|
|
- */
|
|
242
|
|
- /*if(!ObjectUtils.toString(jsonObject.getString("ywlx")).equals("6")){
|
|
243
|
|
- Object parameters[] = new Object[11];
|
|
244
|
|
- parameters[0] = orgId+"";//组织id
|
|
245
|
|
- parameters[1] = grainKind+"";//粮食品种
|
|
246
|
|
- parameters[2] = null;//
|
|
247
|
|
- parameters[3] = houseId+"";//仓房id
|
|
248
|
|
- parameters[4] = wareHouseId+"";//货位id
|
|
249
|
|
- parameters[5] = 6871+"";//需要改变成的粮食性质(其他商品粮)
|
|
250
|
|
- parameters[6] = grainAttribute+"";//原来的粮食性质
|
|
251
|
|
- parameters[7] = count+"";//原来的粮食性质
|
|
252
|
|
- parameters[8] = jsonObject.getString("tzdid")+"";//原来的粮食性质
|
|
253
|
|
- parameters[9] = "转储性质变动";
|
|
254
|
|
- parameters[10] = 2+"";
|
|
255
|
|
- String str = createKC.createKC("ChangeGrainAttribute", url, parameters);
|
|
256
|
|
- if ("true".equals(str)) {
|
|
257
|
|
- modelMap.put("status", "success");
|
|
258
|
|
- } else {
|
|
259
|
|
- modelMap.put("status", "error");
|
|
260
|
|
- modelMap.put("msg", "保存失败,库存同步异常,请联系管理员!");
|
|
261
|
|
- return modelMap;
|
|
262
|
|
- }
|
|
263
|
|
- }*/
|
|
264
|
|
-
|
|
265
|
293
|
}else{
|
|
266
|
|
- modelMap.put("msg", "仓房编码为空");
|
|
|
294
|
+ modelMap.put("msg", "通知单或者业务类型为空");
|
|
267
|
295
|
modelMap.put("status", "error");
|
|
268
|
296
|
}
|
|
269
|
|
-
|
|
270
|
|
- }else{
|
|
271
|
|
- modelMap.put("msg", "通知单或者业务类型为空");
|
|
272
|
|
- modelMap.put("status", "error");
|
|
273
|
297
|
}
|
|
|
298
|
+
|
|
274
|
299
|
|
|
275
|
300
|
}else{
|
|
276
|
301
|
modelMap.put("msg", "参数为空");
|