提交 | 用户 | 时间
|
58d006
|
1 |
package com.mandi.fendan.service.impl; |
A |
2 |
|
|
3 |
import com.google.gson.JsonArray; |
|
4 |
import com.google.gson.JsonElement; |
|
5 |
import com.google.gson.JsonObject; |
|
6 |
import com.google.gson.JsonParser; |
|
7 |
import com.mandi.basicconfig.penum.PrefixEnum; |
9ce4bb
|
8 |
import com.mandi.basicconfig.persist.Nckh; |
58d006
|
9 |
import com.mandi.common.*; |
A |
10 |
import com.mandi.common.ParamFileter.Fileoperation; |
|
11 |
import com.mandi.common.ParamFileter.RegexCheck; |
|
12 |
import com.mandi.dao.common.Daomethod; |
|
13 |
import com.mandi.dao.common.ObjectResult; |
|
14 |
import com.mandi.dao.common.PageRequest; |
|
15 |
import com.mandi.dao.common.PageResult; |
|
16 |
import com.mandi.fendan.mapper.*; |
|
17 |
import com.mandi.fendan.persist.*; |
|
18 |
import com.mandi.fendan.service.IErpService; |
|
19 |
import com.mandi.fendan.util.Contants; |
|
20 |
import com.mandi.fendan.util.ConvertTool; |
|
21 |
import com.mandi.fendan.util.FdtoNc; |
|
22 |
import com.mandi.fendan.util.persist.*; |
9ce4bb
|
23 |
import com.mandi.springmvc.logs.OpLogs; |
58d006
|
24 |
import com.mandi.system.persist.Login; |
9ce4bb
|
25 |
import com.mandi.system.persist.ModuleEnum; |
58d006
|
26 |
import com.mandi.system.persist.UserType; |
A |
27 |
import org.apache.commons.beanutils.BeanUtils; |
|
28 |
import org.apache.commons.collections.map.HashedMap; |
|
29 |
import org.apache.commons.lang3.StringUtils; |
|
30 |
import org.apache.ibatis.session.ExecutorType; |
|
31 |
import org.apache.ibatis.session.SqlSession; |
|
32 |
import org.apache.ibatis.session.SqlSessionFactory; |
|
33 |
import org.apache.log4j.Logger; |
|
34 |
import org.apache.poi.util.StringUtil; |
|
35 |
import org.springframework.stereotype.Service; |
|
36 |
import org.springframework.transaction.annotation.Transactional; |
|
37 |
|
|
38 |
import javax.annotation.Resource; |
|
39 |
import java.io.UnsupportedEncodingException; |
|
40 |
import java.lang.reflect.InvocationTargetException; |
|
41 |
import java.net.URLEncoder; |
|
42 |
import java.text.SimpleDateFormat; |
|
43 |
import java.util.*; |
|
44 |
import java.util.Map.Entry; |
|
45 |
import java.util.stream.Collectors; |
|
46 |
|
|
47 |
@Service |
|
48 |
public class ErpService implements IErpService { |
|
49 |
private Logger log = Logger.getLogger(ErpService.class); |
|
50 |
|
|
51 |
@Resource(name = "dtf") |
|
52 |
private SimpleDateFormat sdf; |
|
53 |
@Resource(name = "ydf") |
|
54 |
private SimpleDateFormat ydf; |
|
55 |
@Resource(name = "df") |
|
56 |
private SimpleDateFormat df; |
|
57 |
@Resource |
|
58 |
private Fd_BsheetMapper fdbsper; |
|
59 |
@Resource |
|
60 |
private Fd_VehicleMapper vhper; |
|
61 |
@Resource |
|
62 |
private VehicleXSTDMapper vhxper; |
|
63 |
@Resource |
|
64 |
private Fd_CompanyMapper fdcper; |
|
65 |
@Resource |
|
66 |
private Fd_ComVehicleMapper fdvcper; |
|
67 |
@Resource |
|
68 |
private Fd_XSTDMapper tdper; |
|
69 |
@Resource |
|
70 |
private Fd_XSTDMXMapper tdmxper; |
|
71 |
@Resource |
|
72 |
private Fd_GbxstdMapper gbtdper; |
|
73 |
@Resource |
|
74 |
private Fd_GbxstdmxMapper gbtdmxper; |
|
75 |
@Resource |
|
76 |
private Fd_fhdqMapper dqper; |
|
77 |
|
|
78 |
@Resource |
|
79 |
private BusinessMapper bsper; |
|
80 |
@Resource |
|
81 |
private Fd_YKTMapper yktmper; |
|
82 |
@Resource |
|
83 |
private FdtoNc fdtonc; |
|
84 |
@Resource |
|
85 |
private fd_errsheetMapper errPer; |
|
86 |
@Resource |
|
87 |
private FdMxWlgsMapper fdMxWlgsMapper; |
|
88 |
|
|
89 |
@Resource |
|
90 |
private SqlSessionFactory sqlSessionFactory; |
|
91 |
|
1c4e40
|
92 |
private FdVehicleRemarkMapper fdVehicleRemarkMapper; |
A |
93 |
|
58d006
|
94 |
@Override |
A |
95 |
public ObjectResult<String> tzPrint(Login lg, String bssNo, String ipadd) { |
|
96 |
ObjectResult<String> orr = new ObjectResult<String>(); |
|
97 |
if (lg == null) { |
|
98 |
orr.setCode(1); |
|
99 |
orr.setErrmsg("请登录账号!"); |
|
100 |
return orr; |
|
101 |
} |
|
102 |
if (StringUtils.isEmpty(bssNo)) { |
|
103 |
orr.setCode(1); |
|
104 |
orr.setErrmsg("业务参数为空!"); |
|
105 |
return orr; |
|
106 |
} |
|
107 |
Fd_Bsheet fd_b = this.fdbsper.getbybsNo(bssNo);// this.fdbsper.getbyVehicleId(vehicleId, Serviceenum.在办); |
|
108 |
if (fd_b == null) { |
|
109 |
orr.setCode(1); |
|
110 |
orr.setErrmsg("车辆业务单未找到,不能打印!"); |
|
111 |
return orr; |
|
112 |
} |
|
113 |
if (fd_b.getStatus() != Serviceenum.在办) { |
|
114 |
orr.setCode(1); |
|
115 |
orr.setErrmsg("车辆业务单不是在办状态,不能打印!"); |
|
116 |
return orr; |
|
117 |
} |
|
118 |
String comNo = ""; |
|
119 |
if (!UserType.admin.toString().equals(lg.getWorkerno())) { |
|
120 |
// List<Vehicle_XSTD> |
|
121 |
// ll=this.vhxper.getlistbyVehandcompanyNo(vehicleId,lg.getDepartno()); |
|
122 |
// if(ll!=null){ |
|
123 |
// for (Vehicle_XSTD vhx : ll) { |
|
124 |
// if(StringUtils.isEmpty(comNo)){ |
|
125 |
// comNo+=vhx.getXstdNo(); |
|
126 |
// }else{ |
|
127 |
// comNo+=(","+vhx.getXstdNo()); |
|
128 |
// } |
|
129 |
// } |
|
130 |
// } |
|
131 |
if (StringUtils.isNotBlank(lg.getDepartno())) { |
|
132 |
comNo = lg.getDepartno(); |
|
133 |
} |
|
134 |
} |
|
135 |
// Map<String, Object> mp=this.bsper.getBsheet(fd_b.getBsNo()); |
|
136 |
// if(mp==null){ |
|
137 |
// orr.setCode(1); |
|
138 |
// orr.setErrmsg("业务单未找到!"); |
|
139 |
// return orr; |
|
140 |
// } |
|
141 |
String dyAdd = this.bsper.getUsedbyAdd(); |
|
142 |
if (StringUtils.isBlank(dyAdd)) { |
|
143 |
orr.setCode(1); |
|
144 |
orr.setErrmsg("系统未设置打印地址!"); |
|
145 |
return orr; |
|
146 |
} |
|
147 |
try { |
|
148 |
orr.setItem("http://" + dyAdd + Contants.GYPrintAdd + "&vehicleId=" |
|
149 |
+ URLEncoder.encode(fd_b.getVehicleId(), "utf-8") + "&bsNo=" + fd_b.getBsNo() + "&phone=" |
|
150 |
+ fd_b.getPhone() + "&comNo=" + comNo); |
|
151 |
// log.info("::::::::::;"+orr.getItem()); |
|
152 |
} catch (UnsupportedEncodingException e) { |
|
153 |
e.printStackTrace(); |
|
154 |
} |
|
155 |
|
|
156 |
orr.setCode(0); |
|
157 |
return orr; |
|
158 |
} |
|
159 |
// 暂时没有使用 |
|
160 |
public PageResult<Map<String, Object>> getBillofLadingList(Login lg, String type, String searchStr, String companyNo, |
|
161 |
Date sdate, Date edate, int wcSign, PageRequest pr, String sortStr, String cqNo) { |
|
162 |
PageResult<Map<String, Object>> prr = new PageResult<Map<String, Object>>(); |
|
163 |
// 销售提单查询值不为空 |
|
164 |
if (lg == null) { |
|
165 |
prr.setCode(1); |
|
166 |
prr.setErrmsg("请登录账号!"); |
|
167 |
return prr; |
|
168 |
} |
|
169 |
if (StringUtils.isEmpty(companyNo)) { |
|
170 |
if (!UserType.admin.toString().equals(lg.getWorkerno())) { |
|
171 |
companyNo = lg.getDepartno(); |
|
172 |
} |
|
173 |
} |
|
174 |
if (pr == null) { |
|
175 |
pr = new PageRequest(0, 30, null); |
|
176 |
pr.setNeedPages(true); |
|
177 |
} |
|
178 |
|
|
179 |
// 查询参数 |
|
180 |
Map<String, Object> pmp = new HashMap<String, Object>(); |
|
181 |
// 查询值 type |
|
182 |
if (StringUtils.isNotBlank(searchStr)) { |
|
183 |
pmp.put(type, searchStr); |
|
184 |
} |
|
185 |
if (sdate != null) { |
|
186 |
Date now = new Date(); |
|
187 |
Calendar theCa = Calendar.getInstance(); |
|
188 |
theCa.setTime(now); |
|
189 |
theCa.add(Calendar.DATE, -Contants.XSTDlastSearchday); |
|
190 |
Date csdate = theCa.getTime(); |
|
191 |
if (csdate.after(sdate)) { |
|
192 |
sdate = csdate; |
|
193 |
} |
|
194 |
pmp.put("sdate", df.format(sdate)); |
|
195 |
} else { |
|
196 |
Date now = new Date(); |
|
197 |
Calendar theCa = Calendar.getInstance(); |
|
198 |
theCa.setTime(now); |
|
199 |
theCa.add(Calendar.DATE, -Contants.XSTDlastSearchday); |
|
200 |
sdate = theCa.getTime(); |
|
201 |
pmp.put("sdate", df.format(sdate)); |
|
202 |
} |
|
203 |
if (edate != null) { |
|
204 |
pmp.put("edate", df.format(edate)); |
|
205 |
} |
|
206 |
if (!StringUtils.isEmpty(companyNo)) { |
|
207 |
pmp.put("companyNo", companyNo); |
|
208 |
Fd_Company fdc = this.fdcper.getByCompanyNo(companyNo); |
|
209 |
if (fdc != null) { |
|
210 |
pmp.put("ztbz", fdc.isHasSPR() ? 1 : 0); |
|
211 |
} |
|
212 |
} |
|
213 |
pmp.put("page", pr.getStart()); |
|
214 |
pmp.put("pagesize", pr.getPageSize()); |
|
215 |
pmp.put("wcSign", wcSign); |
|
216 |
if(StringUtils.isNotBlank(cqNo)) |
|
217 |
pmp.put("cqV", cqNo); |
|
218 |
// 排序字段 |
|
219 |
pmp.put("sort", sortStr); |
|
220 |
if (pr.isNeedPages()) { |
|
221 |
int count = this.tdper.countPage(pmp); |
|
222 |
int pages = Daomethod.countpages(count, pr.getPageSize()); |
|
223 |
prr.setPages(pages); |
|
224 |
} |
|
225 |
|
|
226 |
List<WaitXSTD> l = this.tdper.getList(pmp); |
|
227 |
List<Map<String, Object>> rl = new ArrayList<Map<String, Object>>(); |
|
228 |
if (l != null) { |
|
229 |
for (WaitXSTD wt : l) { |
|
230 |
String fhdqbh = wt.getTd_shddbh(); |
|
231 |
String ztbz = wt.getTd_ztbz(); |
|
232 |
Map<String, Object> mm = new HashMap<String, Object>(); |
|
233 |
try { |
|
234 |
mm = BeanUtils.describe(wt); |
|
235 |
} catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) { |
|
236 |
prr.setCode(1); |
|
237 |
prr.setErrmsg("对象转Map出错,出错提单编号::" + wt.getTd_tdbh()); |
|
238 |
return prr; |
|
239 |
} |
|
240 |
if (!"自提".equals(ztbz)) { |
|
241 |
/*List<Fd_Company> fcl = this.dqper.getCbyNoandsNo(fhdqbh, wt.getTd_ywdybh(), |
|
242 |
*//*wt.getTd_ywdybh().equals(Contants.nc_ywdy_ZZ) ? Contants.nc_ywdy_ZZ : |
|
243 |
wt.getTd_ywdybh().equals(Contants.nc_ywdy_MS) ? Contants.nc_ywdy_MS : |
|
244 |
Contants.nc_ywdy_KJ*//* |
|
245 |
ConvertTool.ncGetDefault(wt.getTd_ywdybh()) |
|
246 |
); |
|
247 |
if (fcl != null) { |
|
248 |
for (Fd_Company fdc : fcl) { |
|
249 |
if (StringUtils |
|
250 |
.isNotBlank(mm.get("companyNo") == null ? "" : mm.get("companyNo").toString())) { |
|
251 |
mm.put("companyName", mm.get("companyName") + "," + fdc.getName()); |
|
252 |
mm.put("companyNo", mm.get("companyNo") + "," + fdc.getCompanyNo()); |
|
253 |
} else { |
|
254 |
mm.put("companyName", fdc.getName()); |
|
255 |
mm.put("companyNo", fdc.getCompanyNo()); |
|
256 |
} |
|
257 |
} |
|
258 |
}*/ |
|
259 |
} |
|
260 |
try { |
|
261 |
mm.put("td_wfdsl", wt.getTd_wfdsl()); |
|
262 |
mm.put("td_wfdzl", BigDecimalfiter.addscal(0, wt.getTd_wfdzl(), Contants.scale)); |
|
263 |
} catch (Exception e) { |
|
264 |
// TODO: handle exception |
|
265 |
} |
|
266 |
rl.add(mm); |
|
267 |
} |
|
268 |
} |
|
269 |
prr.setCode(0); |
|
270 |
prr.setList(rl); |
|
271 |
return prr; |
|
272 |
} |
|
273 |
@Override |
|
274 |
public PageResult<Map<String, Object>> getXSTDList(Login lg, String type, String searchStr, String companyNo, |
|
275 |
Date sdate, Date edate, int wcSign, String fdAdmin,PageRequest pr, String sortStr, String cqNo) { |
|
276 |
PageResult<Map<String, Object>> prr = new PageResult<Map<String, Object>>(); |
|
277 |
// 销售提单查询值不为空 |
|
278 |
if (lg == null) { |
|
279 |
prr.setCode(1); |
|
280 |
prr.setErrmsg("请登录账号!"); |
|
281 |
return prr; |
|
282 |
} |
|
283 |
// 如果是管理员或者非提单更物流公司的操作 |
|
284 |
boolean isAdminOrFdAdmin = UserType.admin.toString().equals(lg.getWorkerno()) || StringUtils.isNotBlank(fdAdmin); |
|
285 |
if (StringUtils.isEmpty(companyNo)) { |
|
286 |
if (!isAdminOrFdAdmin) { // 如果不是更改车辆分单管理员和也不是系统管理员,需要加上公司no |
|
287 |
companyNo = lg.getDepartno(); |
|
288 |
} |
|
289 |
} |
|
290 |
if (pr == null) { |
|
291 |
pr = new PageRequest(0, 30, null); |
|
292 |
pr.setNeedPages(true); |
|
293 |
} |
|
294 |
|
|
295 |
// 查询参数 |
|
296 |
Map<String, Object> pmp = new HashMap<String, Object>(); |
|
297 |
// 查询值 type |
|
298 |
if (StringUtils.isNotBlank(searchStr)) { |
|
299 |
pmp.put(type, searchStr); |
|
300 |
} |
|
301 |
if (sdate != null) { |
|
302 |
Date now = new Date(); |
|
303 |
Calendar theCa = Calendar.getInstance(); |
|
304 |
theCa.setTime(now); |
|
305 |
theCa.add(Calendar.DATE, -Contants.XSTDlastSearchday); |
|
306 |
Date csdate = theCa.getTime(); |
|
307 |
if (csdate.after(sdate)) { |
|
308 |
sdate = csdate; |
|
309 |
} |
|
310 |
pmp.put("sdate", df.format(sdate)); |
|
311 |
} else { |
|
312 |
Date now = new Date(); |
|
313 |
Calendar theCa = Calendar.getInstance(); |
|
314 |
theCa.setTime(now); |
|
315 |
theCa.add(Calendar.DATE, -Contants.XSTDlastSearchday); |
|
316 |
sdate = theCa.getTime(); |
|
317 |
pmp.put("sdate", df.format(sdate)); |
|
318 |
} |
|
319 |
if (edate != null) { |
|
320 |
pmp.put("edate", df.format(edate)); |
|
321 |
} |
|
322 |
if (!StringUtils.isEmpty(companyNo)) { |
|
323 |
pmp.put("companyNo", companyNo); |
|
324 |
Fd_Company fdc = this.fdcper.getByCompanyNo(companyNo); |
|
325 |
if (fdc != null) { |
|
326 |
pmp.put("ztbz", fdc.isHasSPR() ? 1 : 0); |
|
327 |
} |
|
328 |
} |
|
329 |
pmp.put("page", pr.getStart()); |
|
330 |
pmp.put("pagesize", pr.getPageSize()); |
|
331 |
pmp.put("wcSign", wcSign); |
|
332 |
pmp.put("fdAdmin", fdAdmin); |
|
333 |
|
|
334 |
if(StringUtils.isNotBlank(cqNo)) |
|
335 |
pmp.put("cqV", cqNo); |
|
336 |
// 排序字段 |
|
337 |
pmp.put("sort", sortStr); |
|
338 |
if (pr.isNeedPages()) { |
|
339 |
int count = this.tdper.countPage(pmp); |
|
340 |
int pages = Daomethod.countpages(count, pr.getPageSize()); |
|
341 |
prr.setPages(pages); |
|
342 |
} |
|
343 |
|
|
344 |
List<WaitXSTD> l = this.tdper.getList(pmp); |
|
345 |
List<Map<String, Object>> rl = new ArrayList<Map<String, Object>>(); |
|
346 |
if (l != null) { |
|
347 |
for (WaitXSTD wt : l) { |
|
348 |
String fhdqbh = wt.getTd_shddbh(); |
|
349 |
String ztbz = wt.getTd_ztbz(); |
|
350 |
Map<String, Object> mm = new HashMap<String, Object>(); |
|
351 |
try { |
|
352 |
mm = BeanUtils.describe(wt); |
|
353 |
} catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) { |
|
354 |
prr.setCode(1); |
|
355 |
prr.setErrmsg("对象转Map出错,出错提单编号::" + wt.getTd_tdbh()); |
|
356 |
return prr; |
|
357 |
} |
|
358 |
if (!"自提".equals(ztbz)) { |
|
359 |
/*List<Fd_Company> fcl = this.dqper.getCbyNoandsNo(fhdqbh, wt.getTd_ywdybh(), |
|
360 |
wt.getTd_ywdybh().equals(Contants.nc_ywdy_ZZ) ? Contants.nc_ywdy_ZZ : |
|
361 |
*//*wt.getTd_ywdybh().equals(Contants.nc_ywdy_MS) ? Contants.nc_ywdy_MS : |
|
362 |
Contants.nc_ywdy_KJ*//* |
|
363 |
ConvertTool.ncGetDefault(wt.getTd_ywdybh()) |
|
364 |
); |
|
365 |
if (fcl != null) { |
|
366 |
for (Fd_Company fdc : fcl) { |
|
367 |
if (StringUtils |
|
368 |
.isNotBlank(mm.get("companyNo") == null ? "" : mm.get("companyNo").toString())) { |
|
369 |
mm.put("companyName", mm.get("companyName") + "," + fdc.getName()); |
|
370 |
mm.put("companyNo", mm.get("companyNo") + "," + fdc.getCompanyNo()); |
|
371 |
} else { |
|
372 |
mm.put("companyName", fdc.getName()); |
|
373 |
mm.put("companyNo", fdc.getCompanyNo()); |
|
374 |
} |
|
375 |
} |
|
376 |
}*/ |
|
377 |
} |
|
378 |
try { |
|
379 |
mm.put("td_wfdsl", wt.getTd_wfdsl()); |
|
380 |
mm.put("td_wfdzl", BigDecimalfiter.addscal(0, wt.getTd_wfdzl(), Contants.scale)); |
|
381 |
} catch (Exception e) { |
|
382 |
// TODO: handle exception |
|
383 |
} |
|
384 |
rl.add(mm); |
|
385 |
} |
|
386 |
} |
|
387 |
prr.setCode(0); |
|
388 |
prr.setList(rl); |
|
389 |
return prr; |
|
390 |
} |
|
391 |
|
|
392 |
@Override |
|
393 |
public PageResult<Map<String, Object>> getCloseXSTDlist(Login lg, String type, String searchStr, String companyNo, |
|
394 |
Date sdate, Date edate, int wcSign, PageRequest pr, List<String> sortc) { |
|
395 |
// type 只有两种类型 提单编号/关闭人 sdate 关闭开始时间 edate 关闭结束时间 companyNo 运输公司 查询值 |
|
396 |
PageResult<Map<String, Object>> prr = new PageResult<Map<String, Object>>(); |
|
397 |
if (lg == null) { |
|
398 |
prr.setCode(1); |
|
399 |
prr.setErrmsg("请登录账号!"); |
|
400 |
return prr; |
|
401 |
} |
|
402 |
if (pr == null) { |
|
403 |
pr = new PageRequest(0, 30, null); |
|
404 |
pr.setNeedPages(true); |
|
405 |
} |
|
406 |
Map<String, Object> pmp = new HashMap<String, Object>(); |
|
407 |
pmp.put("page", pr.getStart()); |
|
408 |
pmp.put("pagesize", pr.getPageSize()); |
|
409 |
if (sdate != null) { |
|
410 |
pmp.put("stime", sdate); |
|
411 |
} |
|
412 |
if (edate != null) { |
|
413 |
pmp.put("etime", edate); |
|
414 |
} |
|
415 |
if (UserType.admin.toString().equals(lg.getWorkerno())) { |
|
416 |
if (!StringUtils.isEmpty(companyNo)) { |
|
417 |
pmp.put("companyNo", companyNo); |
|
418 |
} |
|
419 |
} else { |
|
420 |
Fd_Company fdc = this.fdcper.getByCompanyNo(lg.getDepartno()); |
|
421 |
if (fdc != null) { |
|
422 |
if (fdc.isHasSPR()) { |
|
423 |
pmp.put("isHSR", true); |
|
424 |
} else { |
|
425 |
pmp.put("companyNo", lg.getDepartno()); |
|
426 |
} |
|
427 |
} else { |
|
428 |
pmp.put("companyNo", "aaaaa"); |
|
429 |
} |
|
430 |
|
|
431 |
} |
|
432 |
// 提单号 模糊查询 |
|
433 |
if (StringUtils.isNotBlank(searchStr)) { |
|
434 |
pmp.put(type, searchStr); |
|
435 |
} |
|
436 |
// if(!StringUtils.isEmpty(searchStr)&&"tdbh".equals(type)){ |
|
437 |
// if(!StringUtils.isEmpty(searchStr)){ |
|
438 |
// pmp.put("tdbh", searchStr); |
|
439 |
// } |
|
440 |
// }else if(){ |
|
441 |
// if(!StringUtils.isEmpty(searchStr)){ |
|
442 |
// pmp.put("td_gbr", searchStr); |
|
443 |
// } |
|
444 |
// }else |
|
445 |
if (pr.isNeedPages()) { |
|
446 |
int count = gbtdper.counts(pmp); |
|
447 |
int pages = Daomethod.countpages(count, pr.getPageSize()); |
|
448 |
prr.setPages(pages); |
|
449 |
} |
|
450 |
|
|
451 |
List<Fd_Company> llc = this.fdcper.getall(); |
|
452 |
Map<String, Object> fdcmp = new HashMap<String, Object>(); |
|
453 |
if (llc != null) { |
|
454 |
for (Fd_Company fd_Company : llc) { |
|
455 |
fdcmp.put(fd_Company.getCompanyNo() + "", fd_Company.getName()); |
|
456 |
} |
|
457 |
} |
|
458 |
List<Map<String, Object>> tdl = gbtdper.getList(pmp); |
|
459 |
// List<Map<String, Object>> rel=new ArrayList<Map<String,Object>>(); |
|
460 |
// if(tdl!=null){ |
|
461 |
// for (Fd_Gbxstd gbtd : tdl) { |
|
462 |
// Map<String, Object> rmp=this.tdper.getGBXSTD(gbtd.getXstdNo()); |
|
463 |
// rel.add(rmp); |
|
464 |
// } |
|
465 |
// } |
|
466 |
List<Map<String, Object>> rl = new ArrayList<Map<String, Object>>(); |
|
467 |
if (tdl != null) { |
|
468 |
for (Map<String, Object> wt : tdl) { |
|
469 |
String fhdqbh = wt.get("td_shddbh") == null ? "" : wt.get("td_shddbh").toString(); |
|
470 |
String td_ywdybh = wt.get("td_ywdybh") == null ? "" : wt.get("td_ywdybh").toString(); |
|
471 |
// String td_tdbh=wt.get("td_tdbh")==null?"":wt.get("td_tdbh").toString(); |
|
472 |
String ztbz = wt.get("td_ztbz") == null ? "" : wt.get("td_ztbz").toString(); |
|
473 |
Map<String, Object> mm = wt; |
|
474 |
mm.put("companyName", ""); |
|
475 |
mm.put("companyNo", ""); |
|
476 |
// try { |
|
477 |
// mm=BeanUtils.describe(wt); |
|
478 |
// } catch (IllegalAccessException | InvocationTargetException| |
|
479 |
// NoSuchMethodException e) { |
|
480 |
// prr.setCode(1); |
|
481 |
// prr.setErrmsg("对象转Map出错,出错提单编号::"+td_tdbh); |
|
482 |
// return prr; |
|
483 |
// } |
|
484 |
if (!"自提".equals(ztbz)) { |
|
485 |
/*List<Fd_Company> fcl = this.dqper.getCbyNoandsNo(fhdqbh, td_ywdybh, |
|
486 |
*//*td_ywdybh.equals(Contants.nc_ywdy_ZZ) ? Contants.nc_ywdy_ZZ : |
|
487 |
td_ywdybh.equals(Contants.nc_ywdy_MS) ? Contants.nc_ywdy_MS : |
|
488 |
Contants.nc_ywdy_KJ*//* |
|
489 |
ConvertTool.ncGetDefault(td_ywdybh) |
|
490 |
);// getCbyNo(fhdqbh); |
|
491 |
if (fcl != null) { |
|
492 |
for (Fd_Company fdc : fcl) { |
|
493 |
if (StringUtils |
|
494 |
.isNotBlank(mm.get("companyNo") == null ? "" : mm.get("companyNo").toString())) { |
|
495 |
mm.put("companyName", mm.get("companyName") + "," + fdc.getName()); |
|
496 |
mm.put("companyNo", mm.get("companyNo") + "," + fdc.getCompanyNo()); |
|
497 |
} else { |
|
498 |
mm.put("companyName", fdc.getName()); |
|
499 |
mm.put("companyNo", fdc.getCompanyNo()); |
|
500 |
} |
|
501 |
} |
|
502 |
}*/ |
|
503 |
} |
|
504 |
// try { |
|
505 |
// mm.put("td_wfdsl",wt.getTd_wfdsl()); |
|
506 |
// mm.put("td_wfdzl",BigDecimalfiter.addscal(0, wt.getTd_wfdzl(), |
|
507 |
// Contants.scale)); |
|
508 |
// } catch (Exception e) { |
|
509 |
// // TODO: handle exception |
|
510 |
// } |
|
511 |
rl.add(mm); |
|
512 |
} |
|
513 |
} |
|
514 |
prr.setCode(0); |
|
515 |
prr.setList(rl); |
|
516 |
return prr; |
|
517 |
} |
|
518 |
|
|
519 |
/** |
|
520 |
* @param lg |
|
521 |
* @param XSTD |
|
522 |
* @return |
|
523 |
*/ |
|
524 |
@Override |
|
525 |
public Map<String, Object> getXSTD(Login lg, String XSTD) { |
|
526 |
Map<String, Object> mp = new HashMap<String, Object>(); |
|
527 |
if (lg == null) { |
|
528 |
mp.put("code", 1); |
|
529 |
mp.put("errmsg", "请登录账号!"); |
|
530 |
return mp; |
|
531 |
} |
|
532 |
if (StringUtils.isBlank(XSTD)) { |
|
533 |
mp.put("code", 1); |
|
534 |
mp.put("errmsg", "查询值:提单号 为空!"); |
|
535 |
return mp; |
|
536 |
} |
|
537 |
|
|
538 |
Fd_XSTD xstd = this.tdper.getbyttdbh(XSTD); |
|
539 |
if (xstd == null) { |
|
540 |
mp.put("code", 1); |
|
541 |
mp.put("errmsg", "提单查询为空!"); |
|
542 |
return mp; |
|
543 |
} |
|
544 |
String companyNo = null; |
|
545 |
if (!UserType.admin.toString().equals(lg.getWorkerno())) { |
|
546 |
Fd_Company fdc = this.fdcper.getByCompanyNo(lg.getDepartno()); |
|
547 |
companyNo = fdc.getCompanyNo(); |
|
548 |
} |
|
549 |
|
|
550 |
String shdqbh = xstd.getTd_shddbh(); |
|
551 |
// 自提 |
|
552 |
if (xstd.getTd_ztbz() == 2) { |
|
553 |
if (!UserType.admin.toString().equals(lg.getWorkerno())) { |
|
554 |
Fd_Company fdc = this.fdcper.getByCompanyNo(lg.getDepartno()); |
|
555 |
if (fdc != null) { |
|
556 |
if (!fdc.isHasSPR()) { |
|
557 |
mp.put("code", 1); |
|
558 |
mp.put("errmsg", "没有查看该提单的权限!"); |
|
559 |
return mp; |
|
560 |
} |
|
561 |
} else { |
|
562 |
mp.put("code", 1); |
|
563 |
mp.put("errmsg", "物流公司未找到!"); |
|
564 |
return mp; |
|
565 |
} |
|
566 |
} |
|
567 |
} else { |
|
568 |
if (!UserType.admin.toString().equals(lg.getWorkerno())) { |
|
569 |
Fd_wlgs_fhdq ccr = this.dqper.getbyNos(lg.getDepartno(), shdqbh, |
|
570 |
/*xstd.getTd_ywdybh().equals(Contants.nc_ywdy_ZZ) ? Contants.nc_ywdy_ZZ: |
|
571 |
xstd.getTd_ywdybh().equals(Contants.nc_ywdy_MS) ? Contants.nc_ywdy_MS |
|
572 |
: Contants.nc_ywdy_KJ*/ |
|
573 |
ConvertTool.ncGetDefault(xstd.getTd_ywdybh()) |
|
574 |
); |
|
575 |
// 这个地方改一下,允许fd_mx_wlgs中存在的单查看 |
|
576 |
int total = fdMxWlgsMapper.selectCountByTdTdls(xstd.getTd_tdls()); |
|
577 |
if (ccr == null && total == 0) { |
|
578 |
mp.put("code", 1); |
|
579 |
mp.put("errmsg", "没有查看该提单的权限!"); |
|
580 |
return mp; |
|
581 |
} |
|
582 |
} |
|
583 |
} |
|
584 |
|
|
585 |
// 编号转名字 |
|
586 |
// 转watiXSTD对象 |
|
587 |
// 查找明细:未装车 |
|
588 |
// 过滤掉已经配车并且配车车辆不是该公司的: 虽然两个物流公司可以使用同一个销售发货单,但是两个物流公司的分单时间是错开的 |
|
589 |
WaitXSTD wxt = this.tdper.getWaitXSTD(XSTD); |
|
590 |
|
|
591 |
Map<String, Object> mxpmp = new HashMap<String, Object>(); |
|
592 |
|
|
593 |
// 过滤条件 |
|
594 |
mxpmp.put("tdls", wxt.getTd_tdls()); |
|
595 |
mxpmp.put("zcbz", 0); |
|
596 |
mxpmp.put("pagesize", 0); |
|
597 |
mxpmp.put("page", 0); |
|
598 |
if(StringUtils.isNotBlank(companyNo)) { |
|
599 |
mxpmp.put("companyNo", companyNo); |
|
600 |
} |
|
601 |
List<Map<String, Object>> XSTDMX_list = this.tdmxper.getList(mxpmp); |
|
602 |
|
|
603 |
mp.put("code", 0); |
|
604 |
mp.put("item", wxt); |
|
605 |
mp.put("list", XSTDMX_list); |
|
606 |
return mp; |
|
607 |
} |
|
608 |
@Override |
|
609 |
public Map<String, Object> getBillofLadingXSTD(Login lg,String XSTD){ |
|
610 |
String companyNo = null; |
|
611 |
boolean isFdAdmin = lg.isFdAdmin(); |
|
612 |
// 是否为管理员或分单管理员 |
|
613 |
boolean isAdminOrFdAdmin = UserType.admin.toString().equals(lg.getWorkerno()) || isFdAdmin; |
|
614 |
if (!isAdminOrFdAdmin) { |
|
615 |
Fd_Company fdc = this.fdcper.getByCompanyNo(lg.getDepartno()); |
|
616 |
companyNo = fdc.getCompanyNo(); |
|
617 |
} |
|
618 |
Map<String, Object> mp = new HashMap<String, Object>(); |
|
619 |
if (lg == null) { |
|
620 |
mp.put("code", 1); |
|
621 |
mp.put("errmsg", "请登录账号!"); |
|
622 |
return mp; |
|
623 |
} |
|
624 |
if (StringUtils.isBlank(XSTD)) { |
|
625 |
mp.put("code", 1); |
|
626 |
mp.put("errmsg", "查询值:提单号 为空!"); |
|
627 |
return mp; |
|
628 |
} |
|
629 |
|
|
630 |
Fd_XSTD xstd = this.tdper.getbyttdbh(XSTD); |
|
631 |
if (xstd == null) { |
|
632 |
mp.put("code", 1); |
|
633 |
mp.put("errmsg", "提单查询为空!"); |
|
634 |
return mp; |
|
635 |
} |
|
636 |
String shdqbh = xstd.getTd_shddbh(); |
|
637 |
// 自提 |
|
638 |
if (xstd.getTd_ztbz() == 2) { |
|
639 |
if (!isAdminOrFdAdmin) { |
|
640 |
Fd_Company fdc = this.fdcper.getByCompanyNo(lg.getDepartno()); |
|
641 |
if (fdc != null) { |
|
642 |
if (!fdc.isHasSPR()) { |
|
643 |
mp.put("code", 1); |
|
644 |
mp.put("errmsg", "没有查看该提单的权限!"); |
|
645 |
return mp; |
|
646 |
} |
|
647 |
} else { |
|
648 |
mp.put("code", 1); |
|
649 |
mp.put("errmsg", "物流公司未找到!"); |
|
650 |
return mp; |
|
651 |
} |
|
652 |
} |
|
653 |
} else { |
|
654 |
if (!isAdminOrFdAdmin) { |
|
655 |
Fd_wlgs_fhdq ccr = this.dqper.getbyNos(lg.getDepartno(), shdqbh, |
|
656 |
/*xstd.getTd_ywdybh().equals(Contants.nc_ywdy_ZZ) ? Contants.nc_ywdy_ZZ: |
|
657 |
xstd.getTd_ywdybh().equals(Contants.nc_ywdy_MS) ? Contants.nc_ywdy_MS |
|
658 |
: Contants.nc_ywdy_KJ*/ |
|
659 |
ConvertTool.ncGetDefault(xstd.getTd_ywdybh()) |
|
660 |
); |
|
661 |
int total = fdMxWlgsMapper.selectCountByTdTdls(xstd.getTd_tdls()); |
|
662 |
if (ccr == null && total == 0) { |
|
663 |
mp.put("code", 1); |
|
664 |
mp.put("errmsg", "没有查看该提单的权限!"); |
|
665 |
return mp; |
|
666 |
} |
|
667 |
} |
|
668 |
} |
|
669 |
|
|
670 |
// 编号转名字 |
|
671 |
// 转watiXSTD对象 |
|
672 |
// 查找明细:未装车 |
|
673 |
// 过滤掉已经配车并且配车车辆不是该公司的: 虽然两个物流公司可以使用同一个销售发货单,但是两个物流公司的分单时间是错开的 |
|
674 |
WaitXSTD wxt = this.tdper.getWaitXSTD(XSTD); |
|
675 |
|
|
676 |
Map<String, Object> mxpmp = new HashMap<String, Object>(); |
|
677 |
|
|
678 |
// 过滤条件 |
|
679 |
mxpmp.put("tdls", wxt.getTd_tdls()); |
|
680 |
// 已经装车的也要显示,方便调整 |
|
681 |
// mxpmp.put("zcbz", 0); |
|
682 |
mxpmp.put("pagesize", 0); |
|
683 |
mxpmp.put("page", 0); |
|
684 |
if(StringUtils.isNotBlank(companyNo)) { |
|
685 |
mxpmp.put("companyNo", companyNo); |
|
686 |
} |
|
687 |
List<Map<String, Object>> XSTDMX_list = this.tdmxper.getList(mxpmp); |
|
688 |
|
|
689 |
mp.put("code", 0); |
|
690 |
mp.put("item", wxt); |
|
691 |
mp.put("list", XSTDMX_list); |
|
692 |
return mp; |
|
693 |
} |
|
694 |
@Override |
|
695 |
public PageResult<Map<String, Object>> getFdlist(Login lg, String companyNo, String vehicleId, PageRequest pr, |
|
696 |
String cqV) { |
|
697 |
PageResult<Map<String, Object>> prr = new PageResult<Map<String, Object>>(); |
|
698 |
if (pr == null) { |
|
699 |
pr = new PageRequest(0, 30, null); |
|
700 |
pr.setNeedPages(true); |
|
701 |
} |
|
702 |
if (lg == null) { |
|
703 |
prr.setCode(1); |
|
704 |
prr.setErrmsg("请登录账号!"); |
|
705 |
return prr; |
|
706 |
} |
|
707 |
Map<String, Object> mp = new HashMap<String, Object>(); |
|
708 |
// 按公司划分 |
|
709 |
String crc = ""; |
|
710 |
if (StringUtils.isNotBlank(companyNo)) { |
|
711 |
mp.put("companyNo", companyNo); |
|
712 |
crc = companyNo; |
|
713 |
} else { |
|
714 |
if (lg.getWorkerno().equals(UserType.admin.toString())) { |
|
715 |
mp.put("companyNo", ""); |
|
716 |
crc = ""; |
|
717 |
} else { |
|
718 |
mp.put("companyNo", lg.getDepartno()); |
|
719 |
crc = lg.getDepartno(); |
|
720 |
} |
|
721 |
} |
|
722 |
if (!StringUtils.isEmpty(vehicleId)) { |
|
723 |
mp.put("vehicleId", vehicleId); |
|
724 |
} |
|
725 |
mp.put("pagesize", pr.getPageSize()); |
|
726 |
mp.put("page", pr.getStart()); |
|
727 |
if(StringUtils.isNotBlank(cqV)) { |
|
728 |
mp.put("cqV",/*Contants.nc_ywdy_ZZ.equals(cqV)?Contants.zzSdepartNo: |
|
729 |
Contants.nc_ywdy_MS.equals(cqV)?Contants.msSdepartNo:Contants.kjSdepartNo*/ |
|
730 |
ConvertTool.ncCovertToYkt(cqV) |
|
731 |
); |
|
732 |
} |
|
733 |
if (pr.isNeedPages()) { |
|
734 |
int count = bsper.getbspages(mp); |
|
735 |
int pages = Daomethod.countpages(count, pr.getPageSize()); |
|
736 |
prr.setPages(pages); |
|
737 |
} |
|
738 |
List<Map<String, Object>> list = bsper.getbslist(mp); |
|
739 |
List<Map<String, Object>> relist = new ArrayList<Map<String, Object>>(); |
|
740 |
if (list != null && list.size() > 0) { |
|
741 |
List<Vehicle_XSTD> vxlist = StringUtils.isBlank(crc) ? this.vhxper.getlistAll() |
|
742 |
: this.vhxper.getlistbycomNo(crc); |
|
743 |
// List<Fd_Company> cl=this.vhxper.getAllCom(); |
|
744 |
for (Map<String, Object> map : list) { |
|
745 |
Map<String, Object> remp = map; |
|
746 |
String bsNo = remp.get("bussinessNo") + ""; |
|
747 |
String vc = remp.get("vehicleId") + ""; |
|
748 |
// 销售分单值: 本单位分单数量和重量 其他单位分车数量和重量 |
|
749 |
if (vxlist != null) { |
|
750 |
for (Vehicle_XSTD vehicle_XSTD : vxlist) { |
|
751 |
try { |
|
752 |
if (vehicle_XSTD.getVehicleId().equals(vc)) { |
|
753 |
remp.put("fdCnum", |
|
754 |
Integer.parseInt( |
|
755 |
remp.get("fdCnum") == null ? "0" : remp.get("fdCnum").toString()) |
|
756 |
+ vehicle_XSTD.getFd_num()); |
|
757 |
remp.put("fdCweight", BigDecimalfiter.addscal( |
|
758 |
Double.parseDouble( |
|
759 |
remp.get("fdCweight") == null ? "0" : remp.get("fdCweight").toString()), |
|
760 |
vehicle_XSTD.getFd_weight(), 4)); |
|
761 |
if (lg.getDepartno() != null && lg.getDepartno().equals(vehicle_XSTD.getCompanyNo())) { |
|
762 |
remp.put("fdnum", |
|
763 |
Double.parseDouble( |
|
764 |
remp.get("fdnum") == null ? "0" : remp.get("fdnum").toString()) |
|
765 |
+ vehicle_XSTD.getFd_num()); |
|
766 |
remp.put("fdweight", |
|
767 |
BigDecimalfiter.addscal( |
|
768 |
Double.parseDouble(remp.get("fdweight") == null ? "0" |
|
769 |
: remp.get("fdweight").toString()), |
|
770 |
vehicle_XSTD.getFd_weight(), 4)); |
|
771 |
} |
|
772 |
} |
|
773 |
} catch (Exception e) { |
|
774 |
prr.setCode(1); |
|
775 |
prr.setErrmsg("数据转换错误,请刷新页面重新获取数据!"); |
|
776 |
return prr; |
|
777 |
} |
|
778 |
} |
|
779 |
} |
|
780 |
// 销售分单单位值: |
|
781 |
List<Fd_Company> cl = vhxper.getCompany(vc, bsNo); |
|
782 |
if (cl != null && cl.size() > 1) { |
|
783 |
remp.remove("companyName"); |
|
784 |
remp.remove("companyNo"); |
|
785 |
for (Fd_Company fd_Company : cl) { |
|
786 |
remp.put("companyName", fd_Company.getName() |
|
787 |
+ (remp.get("companyName") == null ? "" : "," + remp.get("companyName").toString())); |
|
788 |
remp.put("companyNo", fd_Company.getCompanyNo() |
|
789 |
+ (remp.get("companyNo") == null ? "" : "," + remp.get("companyNo").toString())); |
|
790 |
} |
|
791 |
} |
|
792 |
relist.add(remp); |
|
793 |
} |
|
794 |
} |
|
795 |
prr.setCode(0); |
|
796 |
prr.setList(relist); |
|
797 |
return prr; |
|
798 |
} |
|
799 |
|
|
800 |
@Override |
9ce4bb
|
801 |
@Transactional |
58d006
|
802 |
public ObjectResult<Boolean> delFdsheet(Login lg, String bsNo) throws Exception{ |
A |
803 |
ObjectResult<Boolean> or = new ObjectResult<Boolean>(); |
|
804 |
if (lg == null) { |
|
805 |
or.setCode(1); |
|
806 |
or.setErrmsg("请登录账号!"); |
|
807 |
return or; |
|
808 |
} |
|
809 |
if (UserType.admin.toString().equals(lg.getWorkerno())) { |
|
810 |
or.setCode(1); |
|
811 |
or.setErrmsg("管理员不能执行分单操作!"); |
|
812 |
return or; |
|
813 |
} |
|
814 |
Fd_Company fdc = fdcper.getByCompanyNo(lg.getDepartno()); |
|
815 |
if (fdc == null) { |
|
816 |
or.setCode(1); |
|
817 |
or.setErrmsg("登录账号所属的物流公司不存在!"); |
|
818 |
return or; |
|
819 |
} |
|
820 |
Fd_Bsheet fb = fdbsper.getbybsNo(bsNo); |
|
821 |
if (fb == null) { |
|
822 |
or.setCode(1); |
|
823 |
or.setErrmsg("分单业务单未找到!"); |
|
824 |
return or; |
|
825 |
} |
|
826 |
if (fb.getStatus() != Serviceenum.在办) { |
|
827 |
or.setCode(1); |
|
828 |
or.setErrmsg("分单业务单状态不是在办状态!"); |
|
829 |
return or; |
|
830 |
} |
|
831 |
String vehicleId = fb.getVehicleId(); |
|
832 |
Fd_Vehicle fdv = vhper.getByVehicleId(vehicleId); |
|
833 |
if (fdv == null) { |
|
834 |
or.setCode(1); |
|
835 |
or.setErrmsg("分单系统未找到车牌号:" + vehicleId + " 车辆信息!"); |
|
836 |
return or; |
|
837 |
} |
|
838 |
int zcsl = this.tdmxper.getbyBsNowith(bsNo,vehicleId); |
|
839 |
if (zcsl > 0) { |
|
840 |
or.setCode(1); |
|
841 |
or.setErrmsg("该车已经扫码装车,请先联系成品库删除装车记录并解绑磅单!"); |
|
842 |
return or; |
|
843 |
} |
|
844 |
int wdNum = this.bsper.getweightDoc(vehicleId, bsNo); |
|
845 |
if (wdNum > 0) { |
|
846 |
or.setCode(1); |
|
847 |
or.setErrmsg("车辆:" + vehicleId + " 已经过磅,请先联系成品库解绑磅单!"); |
|
848 |
return or; |
|
849 |
} |
|
850 |
List<Vehicle_XSTD> fdvcl = this.vhxper.getlistbyVehicleIdandbsNoGp(vehicleId, bsNo); |
|
851 |
|
|
852 |
// 判断是否删除业务单:如果两个物流公司使用同一辆车,不删除业务单,只修改该物流公司分单的信息 |
|
853 |
String sdNo = fb.getSdepartNo(); |
|
854 |
boolean delYWD = true; |
|
855 |
List<Vehicle_XSTD> vxl = new ArrayList<Vehicle_XSTD>(); |
|
856 |
if (fdvcl != null) { |
|
857 |
for (Vehicle_XSTD vhxstd : fdvcl) { |
|
858 |
// 同一个业务单 |
|
859 |
if (bsNo.equals(vhxstd.getBsNo())) { |
|
860 |
if (lg.getDepartno().equals(vhxstd.getCompanyNo())) { |
|
861 |
vxl.add(vhxstd); |
|
862 |
} else { |
|
863 |
delYWD = false; |
|
864 |
} |
|
865 |
} |
|
866 |
} |
|
867 |
} else { |
|
868 |
or.setCode(1); |
|
869 |
or.setErrmsg("该业务单未找到分单记录!"); |
|
870 |
return or; |
|
871 |
} |
|
872 |
|
|
873 |
// 发送NC |
|
874 |
List<Fd_XSTD> tdl = new ArrayList<Fd_XSTD>(); |
|
875 |
Map<String, List<Fd_XSTDMX>> mxMp = new HashMap<String, List<Fd_XSTDMX>>(); |
|
876 |
|
|
877 |
if (vxl != null && vxl.size() > 0) { |
|
878 |
Fileoperation.AppendContentToFile(Fileoperation.gettestFileName(),"取消配车业务单 vheicle_xstd ::" + Jacksonmethod.tojson(vxl, false)); |
|
879 |
for (Vehicle_XSTD VX : vxl) { |
|
880 |
String xstdNo = VX.getXstdNo(); |
|
881 |
List<Fd_XSTDMX> mxl = new ArrayList<Fd_XSTDMX>(); |
|
882 |
Fd_XSTD xstd = this.tdper.getbyTDBH(xstdNo); |
|
883 |
List<Fd_XSTDMX> MXL = this.tdmxper.getbyBsNoandcmNo(xstd.getTd_tdls(), bsNo, lg.getDepartno()); |
|
884 |
double ZZL = 0; |
|
885 |
int ZZS = 0; |
|
886 |
for (Fd_XSTDMX MX : MXL) { |
|
887 |
// // 已经关闭的不做处理 |
|
888 |
// if (MX.getTdmx_gbbz() != 0) { |
|
889 |
// continue; |
|
890 |
// } |
|
891 |
// 没有分单的跳过 |
|
892 |
// if (MX.getTdmx_fdbz() == 0) { |
|
893 |
// MX.setTdmx_fdcph(null); |
|
894 |
// MX.setTdmx_fdwlgsbh(null); |
|
895 |
// MX.setTdmx_fdywbh(null); |
|
896 |
// this.tdmxper.updateFD(MX); |
|
897 |
// continue; |
|
898 |
// } |
|
899 |
// 已经装车的不做处理 |
|
900 |
// if (MX.getTdmx_zcbz() != 0) { |
|
901 |
// or.setCode(1); |
|
902 |
// or.setErrmsg("提单:" + xstd.getTd_tdbh() + " 明细:" + MX.getTdmx_pch() + " 已经装车不能取消配车!"); |
|
903 |
// return or; |
|
904 |
// } |
|
905 |
// 提单流水号 |
|
906 |
ZZL = BigDecimalfiter.addscal(ZZL, MX.getTdmx_mz(), Contants.scale); |
|
907 |
ZZS++; |
|
908 |
MX.setTdmx_fdbz(0); |
|
909 |
MX.setTdmx_fdcph(null); |
|
910 |
MX.setTdmx_fdwlgsbh(null); |
|
911 |
MX.setTdmx_fdywbh(null); |
|
912 |
// this.tdmxper.updateFD(MX); |
|
913 |
mxl.add(MX); |
|
914 |
} |
|
915 |
this.tdmxper.updatebyBsNoandcmNo(xstd.getTd_tdls(), bsNo, lg.getDepartno()); |
|
916 |
|
|
917 |
this.vhxper.delbyIDs(vehicleId, xstdNo, lg.getDepartno()); |
|
918 |
|
|
919 |
xstd.setTd_wfdsl(xstd.getTd_wfdsl() + ZZS); |
|
920 |
xstd.setTd_wfdzl(BigDecimalfiter.addscal(xstd.getTd_wfdzl(), ZZL, Contants.scale)); |
|
921 |
this.tdper.updateFD(xstd); |
|
922 |
if (ZZS > 0) { |
|
923 |
tdl.add(xstd); |
|
924 |
mxMp.put(xstdNo, mxl); |
|
925 |
} |
|
926 |
} |
|
927 |
} else { |
|
928 |
Fileoperation.AppendContentToFile(Fileoperation.gettestFileName(), |
|
929 |
"取消配车业务单 vehicleId ::" + vehicleId + "::::dNo::::" + lg.getDepartno()); |
|
930 |
sdNo = fb.getSdepartNo(); |
|
931 |
} |
|
932 |
if (StringUtils.isBlank(sdNo)) { |
|
933 |
or.setCode(1); |
|
934 |
or.setErrmsg("业务单元未找到不能删除一卡通业务单"); |
|
935 |
return or; |
|
936 |
} |
|
937 |
|
|
938 |
this.fdvcper.del(vehicleId, lg.getDepartno(), fb.getSdepartNo()); |
|
939 |
|
|
940 |
// 发送NC系统删除分单信息 |
|
941 |
if (tdl != null && tdl.size() > 0) { |
|
942 |
Fileoperation.AppendContentToFile(Fileoperation.gettestFileName(), |
|
943 |
"取消配车业务单 请求提单 ::" + Jacksonmethod.tojson(tdl, false)); |
|
944 |
Fileoperation.AppendContentToFile(Fileoperation.gettestFileName(), |
|
945 |
"取消配车业务单 请求提单明细 ::" + Jacksonmethod.tojson(mxMp, false)); |
|
946 |
String fdhx = this.fdtonc.getNcdata(tdl, mxMp); |
|
947 |
Fileoperation.AppendContentToFile(Fileoperation.gettestFileName(), "取消配车业务单 请求参数 ::" + fdhx); |
|
948 |
JsonObject joADDYWD = Wxhtmethod.postJsonStr(Contants.NCfdhx_url, fdhx); |
|
949 |
Fileoperation.AppendContentToFile(Fileoperation.gettestFileName(), "取消配车业务单 返回值 ::" + joADDYWD); |
|
950 |
if (joADDYWD == null || JSONobj.getint(joADDYWD, "code") != 0) { |
|
951 |
throw new Exception( |
|
952 |
(joADDYWD.get("msg")==null||StringUtils.isBlank(joADDYWD.get("msg").getAsString())) ? "分单回写NC系统出错!" |
|
953 |
: joADDYWD.get("msg").getAsString()); |
|
954 |
} else { |
|
955 |
String restult = joADDYWD.get("result").getAsString(); |
|
956 |
JsonParser jp = new JsonParser(); |
|
957 |
JsonObject jr = jp.parse(restult).getAsJsonObject(); |
|
958 |
if (jr == null || JSONobj.getint(jr, "respcode") != 111) { |
|
959 |
throw new Exception(jr.get("respmsg").getAsString()); |
|
960 |
} |
|
961 |
} |
|
962 |
} |
|
963 |
|
|
964 |
if (delYWD) { |
|
965 |
if (fdv.getType() == VehicleType.临时车) { |
|
966 |
Fd_Bsheet fdbb=this.fdbsper.getbyVehicleWithNoSdepartNo(vehicleId, fb.getSdepartNo()); |
|
967 |
if(fdbb==null) |
|
968 |
this.vhper.delByVehicleId(vehicleId); |
|
969 |
} else { |
|
970 |
fdv.setStatus(VehicleStatus.未配车); |
|
971 |
this.vhper.update(fdv); |
|
972 |
} |
|
973 |
this.fdbsper.delbybsNo(bsNo); |
|
974 |
|
|
975 |
// 发送一卡通服务删除表头信息 |
|
976 |
JsonObject jo = new JsonObject(); |
|
977 |
jo.addProperty("bussinessNo", bsNo); |
|
978 |
jo.addProperty("sdepartNo", sdNo); |
|
979 |
JsonObject pfob = Wxhtmethod.postJsonStr(Contants.YKTdelYwd_url, jo.toString()); |
|
980 |
int code = JSONobj.getint(pfob, "code"); |
|
981 |
if (code != 0) { |
|
982 |
throw new Exception(JSONobj.getstring(pfob, "errmsg")); |
|
983 |
} |
|
984 |
|
|
985 |
} |
1c4e40
|
986 |
// 删除车辆分单的备注remark |
A |
987 |
fdVehicleRemarkMapper.deleteByBusinessNo(bsNo); |
58d006
|
988 |
or.setCode(0); |
A |
989 |
or.setItem(true); |
|
990 |
return or; |
|
991 |
} |
|
992 |
|
|
993 |
@Override |
|
994 |
public PageResult<WaitXSTDMX> getVehicleDetails(Login lg, String bsNo) { |
|
995 |
PageResult<WaitXSTDMX> pr = new PageResult<WaitXSTDMX>(); |
|
996 |
if (lg == null) { |
|
997 |
pr.setCode(1); |
|
998 |
pr.setErrmsg("请登录账号!"); |
|
999 |
return pr; |
|
1000 |
} |
|
1001 |
if (StringUtils.isBlank(bsNo)) { |
|
1002 |
pr.setCode(1); |
|
1003 |
pr.setErrmsg("查询参数不能为空!"); |
|
1004 |
return pr; |
|
1005 |
} |
|
1006 |
Fd_Bsheet fb = this.fdbsper.getbybsNo(bsNo);// fdbsper.getbyVehicleId(vehicleId,Serviceenum.在办); |
|
1007 |
if (fb == null) { |
|
1008 |
pr.setCode(1); |
|
1009 |
pr.setErrmsg("该车辆没有在办的业务单!"); |
|
1010 |
return pr; |
|
1011 |
} |
|
1012 |
if (fb.getStatus() != Serviceenum.在办) { |
|
1013 |
pr.setCode(1); |
|
1014 |
pr.setErrmsg("车辆业务单不是在办状态,不能打印!"); |
|
1015 |
return pr; |
|
1016 |
} |
|
1017 |
Fd_Company fdc = null; |
|
1018 |
List<WaitXSTDMX> mxl = new ArrayList<WaitXSTDMX>(); |
|
1019 |
if (!UserType.admin.toString().equals(lg.getWorkerno())) { |
|
1020 |
fdc = fdcper.getByCompanyNo(lg.getDepartno()); |
|
1021 |
if (fdc == null) { |
|
1022 |
pr.setCode(1); |
|
1023 |
pr.setErrmsg("物流公司不存在!"); |
|
1024 |
return pr; |
|
1025 |
} |
|
1026 |
// 直接根据业务单号 车牌号 分单标志查找 fd_xstdmx表 |
|
1027 |
mxl = this.tdmxper.getwaitMXbyBsNoandcmNo(fb.getBsNo(), lg.getDepartno()); |
|
1028 |
} else { |
|
1029 |
mxl = this.tdmxper.getwaitMXbyBsNo(fb.getBsNo()); |
|
1030 |
} |
|
1031 |
pr.setCode(0); |
|
1032 |
pr.setList(mxl); |
|
1033 |
return pr; |
|
1034 |
} |
|
1035 |
|
|
1036 |
@Override |
|
1037 |
@Transactional(rollbackFor = Exception.class) |
|
1038 |
public ObjectResult<Boolean> doBindByList(Login lg, String tdlist, String vehicleInfo) throws Exception { |
|
1039 |
ObjectResult<Boolean> orr = new ObjectResult<Boolean>(); |
|
1040 |
if (StringUtils.isBlank(tdlist)) { |
|
1041 |
orr.setCode(1); |
|
1042 |
orr.setErrmsg("提单编号参数为空!"); |
|
1043 |
return orr; |
|
1044 |
} |
|
1045 |
if (StringUtils.isBlank(vehicleInfo)) { |
|
1046 |
orr.setCode(1); |
|
1047 |
orr.setErrmsg("车辆信息参数为空!"); |
|
1048 |
return orr; |
|
1049 |
} |
|
1050 |
if (lg == null) { |
|
1051 |
orr.setCode(1); |
|
1052 |
orr.setErrmsg("账号未登录,请登录账号!"); |
|
1053 |
return orr; |
|
1054 |
} |
|
1055 |
if (UserType.admin.toString().equals(lg.getWorkerno())) { |
|
1056 |
orr.setCode(1); |
|
1057 |
orr.setErrmsg("管理员账号没有分单权限!"); |
|
1058 |
return orr; |
|
1059 |
} |
|
1060 |
Fd_Company fdc = null; |
|
1061 |
if (StringUtils.isNotBlank(lg.getDepartno())) { |
|
1062 |
fdc = fdcper.getByCompanyNo(lg.getDepartno()); |
|
1063 |
if (fdc == null) { |
|
1064 |
orr.setCode(1); |
|
1065 |
orr.setErrmsg("登录账号没有配置物流公司,请联系管理员配置!"); |
|
1066 |
return orr; |
|
1067 |
} |
|
1068 |
} |
|
1069 |
JsonParser jp = new JsonParser(); |
|
1070 |
Fd_Vehicle fdv1 = new Fd_Vehicle(); |
|
1071 |
// 检查车辆信息 |
|
1072 |
try { |
|
1073 |
JsonElement je = jp.parse(vehicleInfo); |
|
1074 |
JsonObject jo = je.getAsJsonObject(); |
|
1075 |
String vehicleId =JSONobj.getstring(jo, "vehicleId")==null?"": |
|
1076 |
JSONobj.getstring(jo, "vehicleId").trim().toUpperCase(); |
|
1077 |
String driver = JSONobj.getstring(jo, "driver"); |
|
1078 |
String phone = JSONobj.getstring(jo, "phone"); |
|
1079 |
double vehicleweight = JSONobj.getdouble(jo, "vehicleweight"); |
|
1080 |
double loadweight = JSONobj.getdouble(jo, "loadweight"); |
|
1081 |
String feature = JSONobj.getstring(jo, "feature"); |
|
1082 |
String note = JSONobj.getstring(jo, "note"); |
|
1083 |
String IDNum = JSONobj.getstring(jo, "IDNum"); |
|
1084 |
if (StringUtils.isBlank(vehicleId) || StringUtils.isBlank(driver) || StringUtils.isBlank(IDNum) |
|
1085 |
|| StringUtils.isBlank(phone)) { |
|
1086 |
orr.setCode(1); |
|
1087 |
orr.setErrmsg("车辆信息必填项:车牌号,司机姓名,身份证号,手机号不能为空!"); |
|
1088 |
return orr; |
|
1089 |
} |
|
1090 |
fdv1.setCompanyNo(lg.getDepartno()); |
|
1091 |
fdv1.setDriver(driver); |
|
1092 |
fdv1.setFeature(feature); |
|
1093 |
fdv1.setId(UUID.randomUUID() + ""); |
|
1094 |
fdv1.setIDNum(IDNum); |
|
1095 |
fdv1.setLoadweight(loadweight); |
|
1096 |
fdv1.setNote(note); |
|
1097 |
fdv1.setPhone(phone); |
|
1098 |
fdv1.setState(true); |
|
1099 |
fdv1.setStatus(VehicleStatus.未配车); |
|
1100 |
fdv1.setType(VehicleType.临时车); |
|
1101 |
fdv1.setVehicleId(vehicleId); |
|
1102 |
fdv1.setVehicleweight(vehicleweight); |
|
1103 |
} catch (Exception e) { |
|
1104 |
orr.setCode(1); |
|
1105 |
orr.setErrmsg("车辆信息解析出错,请重新操作!"); |
|
1106 |
return orr; |
|
1107 |
} |
|
1108 |
|
|
1109 |
String Rcompany = "";// 收货单位 |
|
1110 |
String bsDE = "";// 系统部门 |
|
1111 |
String ziti = "";// 是否自提 |
|
1112 |
List<Fd_XSTD> tdl = new ArrayList<Fd_XSTD>(); |
|
1113 |
|
|
1114 |
//校验提单信息数据是否合法:1.提单是否存在 2.当前账号是否可以操作该提单 |
|
1115 |
JsonArray tdja = jp.parse(tdlist).getAsJsonArray(); |
|
1116 |
for (JsonElement tdje : tdja) { |
|
1117 |
String tdNo = tdje.getAsString(); |
|
1118 |
if (StringUtils.isNotBlank(tdNo)) { |
|
1119 |
Fd_XSTD td = this.tdper.getbyTDBH(tdNo); |
5694bb
|
1120 |
if (td == null || td.getTd_wfdsl()<=0 ) { |
58d006
|
1121 |
continue; |
A |
1122 |
} |
|
1123 |
|
|
1124 |
// 这一块是判断用户有没有这个提单的操作权限 : |
|
1125 |
//1.在页面获取提单列表的时候已经加过校验,同一厂区的提单可以同时显示不同厂区的提单不能同时显示,用户只能同时操作同一厂区的提单 |
|
1126 |
//当前用户只能看到可以操作的提单 不可以操作的提单看不到 |
|
1127 |
//所有以下else操作去掉 |
|
1128 |
if (StringUtils.isBlank(bsDE)) { |
|
1129 |
bsDE = ConvertTool.ncCovertToYkt(td.getTd_cqNo()); |
|
1130 |
} |
|
1131 |
if (StringUtils.isBlank(ziti)) { |
|
1132 |
ziti = td.getTd_ztbz() == 2 ? "自提" : "非自提"; |
|
1133 |
} |
|
1134 |
if (StringUtils.isBlank(Rcompany)) { |
|
1135 |
Map<String, Object> mm = this.dqper.getKH(td.getTd_khbh()); |
|
1136 |
/* |
|
1137 |
* 1、外贸有发票编号,内贸没有发票编号 |
|
1138 |
* 2、内贸取实际公司名称,外贸取相应组织的公司简称+‘报关’ |
|
1139 |
* */ |
|
1140 |
if (StringUtils.isBlank(td.getTd_fpbh())) { |
|
1141 |
if (mm != null) { |
|
1142 |
Rcompany = mm.get("name") == null ? "" : mm.get("name").toString(); |
|
1143 |
} |
5694bb
|
1144 |
if(mm == null || mm.size() == 0) { // 客户必须存在,否则无法分单 |
A |
1145 |
orr.setCode(1); |
|
1146 |
orr.setErrmsg("该提单客户不存在,请检查数据!"); |
|
1147 |
return orr; |
|
1148 |
} |
58d006
|
1149 |
} else { |
A |
1150 |
Rcompany = ConvertTool.covertToCustoms(td.getTd_ywdybh()); |
|
1151 |
} |
|
1152 |
} |
|
1153 |
tdl.add(td); |
|
1154 |
} |
|
1155 |
} |
|
1156 |
|
|
1157 |
// 系统部门未找到 |
|
1158 |
if (StringUtils.isBlank(bsDE)) { |
|
1159 |
orr.setCode(1); |
|
1160 |
orr.setErrmsg("提单未找到系统部门字段,请重新操作!"); |
|
1161 |
return orr; |
|
1162 |
} |
|
1163 |
|
|
1164 |
|
|
1165 |
boolean saveBT = false;// 保存一卡通业务单表头信息 |
|
1166 |
String bsNo=""; |
|
1167 |
// 保存表相关信息 |
|
1168 |
try { |
|
1169 |
// 保存业务单 |
|
1170 |
Fd_Bsheet fb = this.fdbsper.getbyVehicleId(fdv1.getVehicleId(), Serviceenum.在办, bsDE); |
|
1171 |
if (fb == null) { |
|
1172 |
// // 获取业务单号 建议加上 记录一下开始时间和结束时间 判断地方的请求时间 |
|
1173 |
JsonObject pfob = Wxhtmethod.postJsonStr(Contants.YKTgetPrefix_url, PrefixEnum.productsale.toString()); |
|
1174 |
ObjectResult<String> pfor = new ObjectResult<String>(); |
|
1175 |
String bssNo = JSONobj.getstring(pfob, "item"); |
|
1176 |
int code = JSONobj.getint(pfob, "code"); |
|
1177 |
String errmsg = JSONobj.getstring(pfob, "errmsg"); |
|
1178 |
pfor.setCode(code); |
|
1179 |
pfor.setErrmsg(errmsg); |
|
1180 |
pfor.setItem(bssNo); |
|
1181 |
if (pfor == null || pfor.getCode() != 0) { |
|
1182 |
orr.setCode(1); |
|
1183 |
orr.setErrmsg(pfor.getErrmsg()); |
|
1184 |
return orr; |
|
1185 |
} |
|
1186 |
fb = new Fd_Bsheet(); |
|
1187 |
fb.setBsNo(pfor.getItem()); |
|
1188 |
fb.setCompanyName(lg.getDepartname()); |
|
1189 |
fb.setCompanyNo(lg.getDepartno()); |
|
1190 |
fb.setCreateid(lg.getUserid()); |
|
1191 |
fb.setCreateName(lg.getWorkername()); |
|
1192 |
fb.setCtime(new Date()); |
|
1193 |
fb.setDriver(fdv1.getDriver()); |
|
1194 |
fb.setFdsheetNo(pfor.getItem()); |
|
1195 |
fb.setId(UUID.randomUUID() + ""); |
|
1196 |
fb.setPhone(fdv1.getPhone()); |
|
1197 |
fb.setSendmsg(false); |
|
1198 |
fb.setStatus(Serviceenum.在办); |
|
1199 |
fb.setVehicleId(fdv1.getVehicleId()); |
|
1200 |
fb.setSdepartNo(bsDE); |
|
1201 |
fb.setShdw(StringUtils.isBlank(Rcompany) ? "未知发货单位" : Rcompany); |
|
1202 |
fb.setUpdateTime(new Date()); |
|
1203 |
this.fdbsper.insertAll(fb); |
|
1204 |
saveBT=true; |
|
1205 |
bsNo=bssNo; |
|
1206 |
} else { |
|
1207 |
fb.setDriver(fdv1.getDriver()); |
|
1208 |
fb.setPhone(fdv1.getPhone()); |
|
1209 |
fb.setUpdateTime(new Date()); |
|
1210 |
fdbsper.update(fb); |
|
1211 |
bsNo=fb.getBsNo(); |
|
1212 |
} |
|
1213 |
|
|
1214 |
// 保存车辆信息 |
|
1215 |
Fd_Vehicle fdv = this.vhper.getByVehicleId(fdv1.getVehicleId()); |
|
1216 |
if (fdv == null) { |
|
1217 |
vhper.insert(fdv1); |
|
1218 |
} else { |
|
1219 |
if (fdv.getType() == VehicleType.临时车) { |
|
1220 |
fdv.setDriver(fdv1.getDriver()); |
|
1221 |
fdv.setPhone(fdv1.getPhone()); |
|
1222 |
fdv.setIDNum(fdv1.getIDNum()); |
|
1223 |
vhper.update(fdv); |
|
1224 |
} |
|
1225 |
} |
|
1226 |
Fd_Company_Vehicle fdcv = fdvcper.getbyIDs(fdv1.getVehicleId(), lg.getDepartno(), bsDE); |
|
1227 |
if (fdcv == null) { |
|
1228 |
fdcv = new Fd_Company_Vehicle(); |
|
1229 |
fdcv.setCompanyNo(lg.getDepartno()); |
|
1230 |
fdcv.setVehicleId(fdv1.getVehicleId()); |
|
1231 |
fdcv.setSdepartNo(bsDE); |
|
1232 |
fdvcper.insertIDs(fdcv); |
|
1233 |
} |
|
1234 |
|
|
1235 |
// 保存分单表相关信息 |
|
1236 |
Map<String, List<Fd_XSTDMX>> mxMp = new HashMap<String, List<Fd_XSTDMX>>(); |
|
1237 |
if(tdl!=null&&!tdl.isEmpty()) { |
|
1238 |
for (Fd_XSTD td : tdl) { |
|
1239 |
int fdsl = 0; |
|
1240 |
double fdmz = 0; |
|
1241 |
List<Fd_XSTDMX> mxl = this.tdmxper.getNOZCandFD(td.getTd_tdls()); |
|
1242 |
if (mxl == null || mxl.isEmpty()) { |
|
1243 |
continue; |
|
1244 |
} |
|
1245 |
for (Fd_XSTDMX tdmx : mxl) { |
|
1246 |
fdsl++; |
|
1247 |
fdmz = BigDecimalfiter.addscal(fdmz, tdmx.getTdmx_mz(), Contants.scale); |
|
1248 |
tdmx.setTdmx_fdbz(1); |
|
1249 |
tdmx.setTdmx_fdcph(fdv1.getVehicleId()); |
|
1250 |
tdmx.setTdmx_fdywbh(bsNo); |
|
1251 |
tdmx.setTdmx_fdwlgsbh(lg.getDepartno()); |
|
1252 |
} |
|
1253 |
|
|
1254 |
Fd_XSTDMX tdmx=mxl.get(0); |
|
1255 |
tdmx.setTdmx_fdbz(1); |
|
1256 |
tdmx.setTdmx_fdcph(fdv1.getVehicleId()); |
|
1257 |
tdmx.setTdmx_fdywbh(bsNo); |
|
1258 |
tdmx.setTdmx_fdwlgsbh(lg.getDepartno()); |
|
1259 |
tdmx.setTdmx_tdls(td.getTd_tdls()); |
|
1260 |
this.tdmxper.updateFDBatch(tdmx); |
|
1261 |
|
|
1262 |
Vehicle_XSTD vhx=this.vhxper.getbyIDs(fdv1.getVehicleId(), td.getTd_tdbh(),lg.getDepartno()); |
|
1263 |
if(vhx==null){ |
|
1264 |
vhx=new Vehicle_XSTD(); |
|
1265 |
vhx.setBsNo(bsNo); |
|
1266 |
vhx.setCompanyNo(lg.getDepartno()); |
|
1267 |
vhx.setFd_num(fdsl); |
|
1268 |
vhx.setFd_weight(fdmz); |
|
1269 |
vhx.setVehicleId(fdv1.getVehicleId()); |
|
1270 |
vhx.setXstdNo(td.getTd_tdbh()); |
|
1271 |
this.vhxper.insert(vhx); |
|
1272 |
}else{ |
|
1273 |
vhx.setBsNo(bsNo); |
|
1274 |
vhx.setCompanyNo(lg.getDepartno()); |
|
1275 |
vhx.setFd_num(vhx.getFd_num()+fdsl); |
|
1276 |
vhx.setFd_weight(BigDecimalfiter.add(vhx.getFd_weight(),fdmz)); |
|
1277 |
vhx.setVehicleId(fdv1.getVehicleId()); |
|
1278 |
vhx.setXstdNo(td.getTd_tdbh()); |
|
1279 |
this.vhxper.updatewithIDs(vhx); |
|
1280 |
} |
|
1281 |
td.setTd_wfdsl(td.getTd_wfdsl() - fdsl); |
|
1282 |
td.setTd_wfdzl(BigDecimalfiter.subscal(td.getTd_wfdzl(), fdmz, Contants.scale)); |
|
1283 |
this.tdper.updateFD(td); |
|
1284 |
mxMp.put(td.getTd_tdbh(), mxl); |
|
1285 |
} |
|
1286 |
} |
|
1287 |
|
|
1288 |
if (saveBT) { |
|
1289 |
YktBsheet bs = new YktBsheet(); |
|
1290 |
bs.setSdepartNo(bsDE); |
|
1291 |
/*bs.setDcompany( |
|
1292 |
bsDE.equals(Contants.kjSdepartNo) ? "明泰科技" |
|
1293 |
:bsDE.equals(Contants.msSdepartNo) ? "河南明晟新材料" |
|
1294 |
: "郑州眀泰");*/ |
|
1295 |
bs.setDcompany(ConvertTool.covertToFactoryName(bsDE)); |
|
1296 |
bs.setDriver(fdv1.getDriver()); |
|
1297 |
|
|
1298 |
bs.setNumberplates(StringUtils.upperCase(fdv1.getVehicleId())); |
|
1299 |
bs.setPhone(fdv1.getPhone()); |
|
1300 |
bs.setRcompany(StringUtils.isBlank(Rcompany) ? "未知发货单位" : Rcompany); |
|
1301 |
bs.setBussinessNo(fb.getBsNo()); |
|
1302 |
bs.setNote(ziti + ";" + lg.getDepartname() + ":" + lg.getWorkername() + "; 分单系统自动生成"); |
|
1303 |
String bsStr = Jacksonmethod.tojson(bs, false); |
|
1304 |
JsonObject joADDYWD = Wxhtmethod.postJsonStr(Contants.YKTaddYwd_url, bsStr); |
|
1305 |
ObjectResult<String> ors = new ObjectResult<String>(); |
|
1306 |
ors = JSONobj.getobj(joADDYWD, ors); |
|
1307 |
if (ors.getCode() != 0) { |
|
1308 |
throw new Exception(ors.getErrmsg()); |
|
1309 |
} |
|
1310 |
}else { |
|
1311 |
List<WaitXSTD> l=this.fdbsper.getAllKH(bsNo, fb.getId()); |
|
1312 |
if(l!=null) { |
|
1313 |
boolean iscz=false;//收货单位在明细中是否存在 |
|
1314 |
WaitXSTD wt=null; |
|
1315 |
for (WaitXSTD waitXSTD : l) { |
|
1316 |
if(fb.getShdw().equals(waitXSTD.getTd_khmc())) { |
|
1317 |
iscz=true; |
|
1318 |
break; |
|
1319 |
}else { |
|
1320 |
if(wt==null&&StringUtils.isNotBlank(waitXSTD.getTd_khmc())) { |
|
1321 |
wt=waitXSTD; |
|
1322 |
} |
|
1323 |
} |
|
1324 |
} |
|
1325 |
if(!iscz&&wt!=null) { |
|
1326 |
fb.setShdw(wt.getTd_khmc()); |
|
1327 |
this.yktmper.updateshcompany(bsNo, wt.getTd_khmc(),wt.getTd_shdd()); |
|
1328 |
} |
|
1329 |
} |
|
1330 |
|
|
1331 |
} |
|
1332 |
|
|
1333 |
if (tdl != null && tdl.size() > 0 ) { |
|
1334 |
String fdhx = this.fdtonc.getNcdata(tdl, mxMp); |
|
1335 |
Fileoperation.AppendContentToFile(Fileoperation.gettestFileName(), "整单配车 请求参数 ::" + fdhx); |
|
1336 |
JsonObject joADDYWD = Wxhtmethod.postJsonStr(Contants.NCfdhx_url, fdhx); |
|
1337 |
Fileoperation.AppendContentToFile(Fileoperation.gettestFileName(), "整单配车 返回值 ::" + joADDYWD); |
|
1338 |
if (joADDYWD == null || JSONobj.getint(joADDYWD, "code") != 0) { |
|
1339 |
throw new Exception( |
|
1340 |
(joADDYWD.get("msg")==null||StringUtils.isBlank(joADDYWD.get("msg").getAsString())) ? "分单回写NC系统出错!" |
|
1341 |
: joADDYWD.get("msg").getAsString()); |
|
1342 |
} else { |
|
1343 |
String restult = joADDYWD.get("result").getAsString(); |
|
1344 |
JsonObject jr = jp.parse(restult).getAsJsonObject(); |
|
1345 |
if (jr == null || JSONobj.getint(jr, "respcode") != 111) { |
|
1346 |
throw new Exception(jr.get("respmsg").getAsString()); |
|
1347 |
} |
|
1348 |
} |
|
1349 |
} |
|
1350 |
} catch (Exception e) { |
|
1351 |
if (saveBT) { |
|
1352 |
JsonObject jo = new JsonObject(); |
|
1353 |
jo.addProperty("bussinessNo", bsNo); |
|
1354 |
jo.addProperty("sdepartNo", bsDE); |
|
1355 |
Wxhtmethod.postJsonStr(Contants.YKTdelYwd_url, jo.toString()); |
|
1356 |
} |
|
1357 |
e.printStackTrace(); |
|
1358 |
throw new Exception(e.getMessage()); |
|
1359 |
} |
|
1360 |
orr.setCode(0); |
|
1361 |
orr.setItem(true); |
|
1362 |
return orr; |
|
1363 |
} |
|
1364 |
|
|
1365 |
@Override |
|
1366 |
@Transactional(rollbackFor = Exception.class) |
|
1367 |
public ObjectResult<Boolean> dounBindByList(Login lg, String tdbhlist) throws Exception { |
|
1368 |
ObjectResult<Boolean> orr = new ObjectResult<Boolean>(); |
|
1369 |
if (lg == null) { |
|
1370 |
orr.setCode(1); |
|
1371 |
orr.setErrmsg("请登录账号!"); |
|
1372 |
return orr; |
|
1373 |
} |
|
1374 |
if (StringUtils.isBlank(tdbhlist)) { |
|
1375 |
orr.setCode(1); |
|
1376 |
orr.setErrmsg("业务参数为空,请选择提单!"); |
|
1377 |
return orr; |
|
1378 |
} |
|
1379 |
if (UserType.admin.toString().equals(lg.getWorkerno())) { |
|
1380 |
orr.setCode(1); |
|
1381 |
orr.setErrmsg("管理员不能操作分单!"); |
|
1382 |
return orr; |
|
1383 |
} |
|
1384 |
Fd_Company fdc = null; |
|
1385 |
if (StringUtils.isNotBlank(lg.getDepartno())) { |
|
1386 |
fdc = fdcper.getByCompanyNo(lg.getDepartno()); |
|
1387 |
if (fdc == null) { |
|
1388 |
orr.setCode(1); |
|
1389 |
orr.setErrmsg("账号没有配置物流公司,请联系管理员进行配置!"); |
|
1390 |
return orr; |
|
1391 |
} |
|
1392 |
} |
|
1393 |
|
|
1394 |
// for循环 tdbhlist |
|
1395 |
// 查找td_xstd 对象 筛选是否有操作权限 |
|
1396 |
// 修改 td_xstdmx 表 修改 td_xstd 表 修改 vehicle_xstd表 |
|
1397 |
JsonParser jp = new JsonParser(); |
|
1398 |
JsonArray tdja = jp.parse(tdbhlist).getAsJsonArray(); |
|
1399 |
List<Fd_XSTD> tdl = new ArrayList<Fd_XSTD>(); |
|
1400 |
Map<String, List<Fd_XSTDMX>> mxMp = new HashMap<String, List<Fd_XSTDMX>>(); |
|
1401 |
for (JsonElement tdje : tdja) { |
|
1402 |
String tdNo = tdje.getAsString(); |
|
1403 |
Fd_XSTD td = this.tdper.getbyTDBH(tdNo); |
|
1404 |
if (td == null) { |
|
1405 |
continue; |
|
1406 |
} |
|
1407 |
// 这一块是判断用户有没有这个提单的操作权限 : |
|
1408 |
//页面获取提单里诶包信息的时候已经加过校验 当前用户只能看到可以操作的提单 不可以操作的提单看不到 |
|
1409 |
// 这一块可以省略 |
|
1410 |
// 自提 |
|
1411 |
// if (td.getTd_ztbz() == 2) { |
|
1412 |
// if (fdc != null) { |
|
1413 |
// if (!fdc.isHasSPR()) { |
|
1414 |
// continue; |
|
1415 |
// } |
|
1416 |
// } |
|
1417 |
// } else { |
|
1418 |
// Fd_wlgs_fhdq dq = this.dqper.getbyNos(lg.getDepartno(), td.getTd_shddbh(), |
|
1419 |
// td.getTd_ywdybh().equals(Contants.zzywdyNo) ? Contants.zzywdyNo : "103"); |
|
1420 |
// if (dq == null) { |
|
1421 |
// continue; |
|
1422 |
// } |
|
1423 |
// } |
|
1424 |
|
|
1425 |
|
|
1426 |
// 如果该业务单已经装车 过滤掉不处理 |
|
1427 |
//这一块应该在页面中提示出来:提示:销售提单:XXXX 部分明细已经装车,请进入提单明细取消配车! |
|
1428 |
List<Vehicle_XSTD> vxl = this.vhxper.getbyxstdNoandcmNo(tdNo, lg.getDepartno()); |
|
1429 |
if (vxl != null) { |
|
1430 |
boolean sffd=false; |
|
1431 |
for (Vehicle_XSTD vx : vxl) { |
|
1432 |
int zcsl = this.tdmxper.getbyBsNowithZC(vx.getBsNo(),td.getTd_tdls(),vx.getVehicleId()); |
|
1433 |
if (zcsl > 0) { |
|
1434 |
sffd=true; |
|
1435 |
break; |
|
1436 |
} |
|
1437 |
Fd_Bsheet fb=this.fdbsper.getbyVehicleId(vx.getVehicleId(), Serviceenum.在办, lg.getSdepartNo()); |
|
1438 |
if(fb !=null) { |
|
1439 |
fb.setUpdateTime(new Date()); |
|
1440 |
this.fdbsper.update(fb); |
|
1441 |
} |
|
1442 |
} |
|
1443 |
if(sffd) { |
|
1444 |
continue; |
|
1445 |
} |
|
1446 |
} else { |
|
1447 |
continue; |
|
1448 |
} |
|
1449 |
|
|
1450 |
|
|
1451 |
List<Fd_XSTDMX> mxl = this.tdmxper.getbytdlsandcmNo(td.getTd_tdls(), lg.getDepartno()); |
|
1452 |
List<Fd_XSTDMX> rels = new ArrayList<Fd_XSTDMX>(); |
|
1453 |
if (mxl != null) { |
|
1454 |
int wfdsl = 0; |
|
1455 |
double wfdzl = 0; |
|
1456 |
for (Fd_XSTDMX mx : mxl) { |
|
1457 |
// 提单明细未关闭的做处理 |
|
1458 |
wfdsl++; |
|
1459 |
wfdzl = BigDecimalfiter.addscal(wfdzl, mx.getTdmx_mz(), Contants.scale); |
|
1460 |
mx.setTdmx_fdbz(0); |
|
1461 |
mx.setTdmx_fdcph(null); |
|
1462 |
mx.setTdmx_fdwlgsbh(null); |
|
1463 |
mx.setTdmx_fdywbh(null); |
|
1464 |
rels.add(mx); |
|
1465 |
} |
|
1466 |
|
|
1467 |
this.tdmxper.updatebytdlsandcmNo(td.getTd_tdls(), lg.getDepartno()); |
|
1468 |
|
|
1469 |
this.vhxper.delbyIDandcomNo(td.getTd_tdbh(),lg.getDepartno()); |
|
1470 |
|
|
1471 |
td.setTd_wfdsl(td.getTd_wfdsl() + wfdsl); |
|
1472 |
td.setTd_wfdzl(BigDecimalfiter.addscal(td.getTd_wfdzl(), wfdzl, Contants.scale)); |
|
1473 |
this.tdper.updateFD(td); |
|
1474 |
if (wfdsl > 0) { |
|
1475 |
tdl.add(td); |
|
1476 |
mxMp.put(tdNo, rels); |
|
1477 |
} |
|
1478 |
} |
|
1479 |
} |
|
1480 |
|
|
1481 |
|
|
1482 |
// 发送NC系统 |
|
1483 |
if (tdl != null && tdl.size() > 0) { |
|
1484 |
String fdhx = this.fdtonc.getNcdata(tdl, mxMp); |
|
1485 |
Fileoperation.AppendContentToFile(Fileoperation.gettestFileName(), "整单取消配车 请求参数 ::" + fdhx); |
|
1486 |
JsonObject joADDYWD = Wxhtmethod.postJsonStr(Contants.NCfdhx_url, fdhx); |
|
1487 |
Fileoperation.AppendContentToFile(Fileoperation.gettestFileName(), "整单取消配车 返回值 ::" + joADDYWD); |
|
1488 |
if (joADDYWD == null || JSONobj.getint(joADDYWD, "code") != 0) { |
|
1489 |
throw new Exception( |
|
1490 |
(joADDYWD.get("msg")==null||StringUtils.isBlank(joADDYWD.get("msg").getAsString())) ? "分单回写NC系统出错!" |
|
1491 |
: joADDYWD.get("msg").getAsString()); |
|
1492 |
} else { |
|
1493 |
String restult = joADDYWD.get("result").getAsString(); |
|
1494 |
JsonObject jr = jp.parse(restult).getAsJsonObject(); |
|
1495 |
if (jr == null || JSONobj.getint(jr, "respcode") != 111) { |
|
1496 |
throw new Exception(jr.get("respmsg").getAsString()); |
|
1497 |
} |
|
1498 |
} |
|
1499 |
} |
|
1500 |
orr.setCode(0); |
|
1501 |
return orr; |
|
1502 |
} |
|
1503 |
|
|
1504 |
@Override |
|
1505 |
@Transactional(rollbackFor = Exception.class) |
|
1506 |
public ObjectResult<Boolean> sxccCheck(String bsNo, String vehicleId, String ZZ) throws Exception { |
|
1507 |
ObjectResult<Boolean> orr = new ObjectResult<Boolean>(); |
|
1508 |
Fileoperation.AppendContentToFile(Fileoperation.gettestFileName(),"出门检查 业务参数:::: ::ZZ::" + ZZ + "::bsNo::" + bsNo + "::vehicleId::" + vehicleId); |
|
1509 |
if (StringUtils.isBlank(vehicleId)) { |
|
1510 |
orr.setCode(1); |
|
1511 |
orr.setErrmsg("车牌号为空!"); |
|
1512 |
return orr; |
|
1513 |
} |
|
1514 |
if (StringUtils.isBlank(bsNo)) { |
|
1515 |
orr.setCode(1); |
|
1516 |
orr.setErrmsg("一卡通业务单号为空!"); |
|
1517 |
return orr; |
|
1518 |
} |
|
1519 |
//先删除错误信息 |
|
1520 |
errPer.delBybsNo(bsNo); |
|
1521 |
try { |
|
1522 |
Fd_Bsheet fdb = fdbsper.getbybsNo(bsNo); |
|
1523 |
if (fdb != null) { |
|
1524 |
fdb.setStatus(Serviceenum.结束); |
|
1525 |
fdbsper.update(fdb); |
|
1526 |
} |
|
1527 |
Fd_Vehicle fdv = vhper.getByVehicleId(vehicleId); |
|
1528 |
if (fdv != null) { |
|
1529 |
if (fdv.getType() == VehicleType.临时车) { |
|
1530 |
Fd_Bsheet fdbb=this.fdbsper.getbyVehicleWithNoSdepartNo(vehicleId,fdb.getSdepartNo()); |
|
1531 |
if(fdbb==null) { |
|
1532 |
vhper.delByVehicleId(vehicleId); |
|
1533 |
} |
|
1534 |
this.fdvcper.delbyID(vehicleId, fdb.getSdepartNo()); |
|
1535 |
} else { |
|
1536 |
fdv.setStatus(VehicleStatus.未配车); |
|
1537 |
vhper.update(fdv); |
|
1538 |
this.fdvcper.delIDandNoC(vehicleId, fdv.getCompanyNo(), fdb.getSdepartNo()); |
|
1539 |
} |
|
1540 |
} |
|
1541 |
// 查找fd_vehicle 判断车辆信息是否正确 修改 fd_vehicle 修改fd_vehicle_company |
|
1542 |
// 查找fd_bsheet 判断业务状态 修改 fd_bsheet |
|
1543 |
// 查找fd_xstdmx 表 按照业务单号,车牌号,查找已分单未装车的 |
|
1544 |
// 修改 fd_xstdmx fd_xstd fd_vehicle_xstd |
|
1545 |
|
|
1546 |
List<Fd_XSTDMX> mxl = this.tdmxper.getbybsNoandNOZCandFD(fdb == null ? "" : fdb.getBsNo()); |
|
1547 |
List<Fd_XSTD> tdl = new ArrayList<Fd_XSTD>(); |
|
1548 |
Map<String, Fd_XSTD> tdM = new HashMap<String, Fd_XSTD>(); |
|
1549 |
Map<String, List<Fd_XSTDMX>> mxMp = new HashMap<String, List<Fd_XSTDMX>>(); |
|
1550 |
|
|
1551 |
// Map<String, Fd_XSTD> rmtd = new HashMap<String, Fd_XSTD>(); |
|
1552 |
if (mxl != null) { |
|
1553 |
for (Fd_XSTDMX mx : mxl) { |
|
1554 |
// 已经关闭的明细不做处理 |
|
1555 |
if (mx.getTdmx_gbbz() != 0) { |
|
1556 |
continue; |
|
1557 |
} |
|
1558 |
// Fd_XSTD td = this.tdper.get(mx.getTdmx_tdls()); |
|
1559 |
// if (td != null) { |
|
1560 |
// td.setTd_wfdsl(td.getTd_wfdsl() + 1); |
|
1561 |
// td.setTd_wfdzl(BigDecimalfiter.addscal(td.getTd_wfdzl(), mx.getTdmx_mz(), Contants.scale)); |
|
1562 |
// tdper.updateFD(td); |
|
1563 |
// tdM.put(td.getTd_tdbh(), td); |
|
1564 |
// } |
|
1565 |
Fd_XSTD tdtt=tdM.get(mx.getTdmx_tdls()); |
|
1566 |
if(tdtt==null) { |
|
1567 |
tdtt = this.tdper.get(mx.getTdmx_tdls()); |
|
1568 |
if(tdtt==null) { |
|
1569 |
continue; |
|
1570 |
} |
|
1571 |
} |
|
1572 |
tdtt.setTd_wfdsl(tdtt.getTd_wfdsl()+1); |
|
1573 |
tdtt.setTd_wfdzl(BigDecimalfiter.addscal(tdtt.getTd_wfdzl(), mx.getTdmx_mz(), Contants.scale)); |
|
1574 |
tdM.put(mx.getTdmx_tdls(), tdtt); |
|
1575 |
|
|
1576 |
mx.setTdmx_fdbz(0); |
|
1577 |
mx.setTdmx_fdcph(null); |
|
1578 |
mx.setTdmx_fdwlgsbh(null); |
|
1579 |
mx.setTdmx_fdywbh(null); |
|
1580 |
// this.tdmxper.updateFD(mx); |
|
1581 |
if (mxMp.get(tdtt.getTd_tdbh()) != null) { |
|
1582 |
List<Fd_XSTDMX> lr = mxMp.get(tdtt.getTd_tdbh()); |
|
1583 |
lr.add(mx); |
|
1584 |
mxMp.put(tdtt.getTd_tdbh(), lr); |
|
1585 |
} else { |
|
1586 |
List<Fd_XSTDMX> lr = new ArrayList<Fd_XSTDMX>(); |
|
1587 |
lr.add(mx); |
|
1588 |
mxMp.put(tdtt.getTd_tdbh(), lr); |
|
1589 |
} |
|
1590 |
} |
|
1591 |
this.tdmxper.updatebybsNoandNOZCandFD(fdb.getBsNo()); |
|
1592 |
|
|
1593 |
this.vhxper.delbyVehicleId(vehicleId,fdb.getBsNo() ); |
|
1594 |
|
|
1595 |
if (tdM != null && tdM.size() > 0) { |
|
1596 |
for (Entry<String, Fd_XSTD> ff : tdM.entrySet()) { |
|
1597 |
tdl.add(ff.getValue()); |
|
1598 |
this.tdper.updateFD(ff.getValue()); |
|
1599 |
} |
|
1600 |
} |
|
1601 |
} |
|
1602 |
|
|
1603 |
|
|
1604 |
// List<Vehicle_XSTD> vxls = this.vhxper.getlistbyVehicleId(vehicleId); |
|
1605 |
// if (vxls != null) { |
|
1606 |
// for (Vehicle_XSTD vxx : vxls) { |
|
1607 |
// this.vhxper.delbyIDs(vehicleId, vxx.getXstdNo()); |
|
1608 |
// } |
|
1609 |
// } |
|
1610 |
// 发送NC系统 |
|
1611 |
if (tdl != null && tdl.size() > 0) { |
|
1612 |
String fdhx = this.fdtonc.getNcdata(tdl, mxMp); |
|
1613 |
Fileoperation.AppendContentToFile(Fileoperation.gettestFileName(), "出门检查 请求参数 ::" + fdhx); |
|
1614 |
JsonObject joADDYWD = Wxhtmethod.postJsonStr(Contants.NCfdhx_url, fdhx); |
|
1615 |
Fileoperation.AppendContentToFile(Fileoperation.gettestFileName(), "出门检查 返回值 ::" + joADDYWD); |
|
1616 |
if (joADDYWD == null || JSONobj.getint(joADDYWD, "code") != 0) { |
|
1617 |
throw new Exception( |
|
1618 |
(joADDYWD.get("msg")==null||StringUtils.isBlank(joADDYWD.get("msg").getAsString())) ? "分单回写NC系统出错!" |
|
1619 |
: joADDYWD.get("msg").getAsString()); |
|
1620 |
} else { |
|
1621 |
String restult = joADDYWD.get("result").getAsString(); |
|
1622 |
JsonParser jp = new JsonParser(); |
|
1623 |
JsonObject jr = jp.parse(restult).getAsJsonObject(); |
|
1624 |
if (jr == null || JSONobj.getint(jr, "respcode") != 111) { |
|
1625 |
throw new Exception(jr.get("respmsg").getAsString()); |
|
1626 |
} |
|
1627 |
} |
|
1628 |
} |
|
1629 |
} catch (Exception e) { |
867641
|
1630 |
log.error("销售业务车辆出厂程序" + e.getMessage(),e); |
58d006
|
1631 |
throw new Exception(StringUtils.isEmpty(e.getMessage()) ? "销售业务车辆出厂程序出错!" : e.getMessage()); |
A |
1632 |
} |
|
1633 |
orr.setCode(0); |
|
1634 |
return orr; |
|
1635 |
} |
|
1636 |
|
|
1637 |
@Override |
|
1638 |
@Transactional(rollbackFor = Exception.class) |
|
1639 |
public ObjectResult<Boolean> doUnbind(Login lg, String mlist, String tdNo) throws Exception { |
|
1640 |
ObjectResult<Boolean> orr = new ObjectResult<Boolean>(); |
|
1641 |
if (lg == null) { |
|
1642 |
orr.setCode(1); |
|
1643 |
orr.setErrmsg("请登录账号!"); |
|
1644 |
return orr; |
|
1645 |
} |
|
1646 |
if (StringUtils.isEmpty(mlist)) { |
|
1647 |
orr.setCode(1); |
|
1648 |
orr.setErrmsg("业务参数为空!"); |
|
1649 |
return orr; |
|
1650 |
} |
|
1651 |
if (StringUtils.isEmpty(tdNo)) { |
|
1652 |
orr.setCode(1); |
|
1653 |
orr.setErrmsg("提单编号为空!"); |
|
1654 |
return orr; |
|
1655 |
} |
|
1656 |
if (UserType.admin.toString().equals(lg.getWorkerno())) { |
|
1657 |
orr.setCode(1); |
|
1658 |
orr.setErrmsg("管理员没有分单权限!"); |
|
1659 |
return orr; |
|
1660 |
} |
|
1661 |
Fd_Company fdc = fdcper.getByCompanyNo(lg.getDepartno()); |
|
1662 |
if (fdc == null) { |
|
1663 |
orr.setCode(1); |
|
1664 |
orr.setErrmsg("该账号没有配置物流公司!"); |
|
1665 |
return orr; |
|
1666 |
} |
|
1667 |
|
|
1668 |
// 查找fd_xstd表 判断物流公司是否有操作权限 如果有装车明细不让删除完 |
|
1669 |
// for循环mlist 判断 fd_xstdmx是否符合条件 |
|
1670 |
// 修改fd_xstdmx 表 修改 vehicle_xstd表 修改fd_company_xstd表:只在取消分单和出门的时候删除 |
|
1671 |
// 修改 fd_xstd 表 |
|
1672 |
|
|
1673 |
Fd_XSTD td = this.tdper.getbyTDBH(tdNo); |
|
1674 |
if (td == null) { |
|
1675 |
orr.setCode(1); |
|
1676 |
orr.setErrmsg("提单未找到!"); |
|
1677 |
return orr; |
|
1678 |
} |
|
1679 |
if (td.isTd_zcwcbz()) { |
|
1680 |
orr.setCode(1); |
|
1681 |
orr.setErrmsg("该提单已经完成装车,不能分单!"); |
|
1682 |
return orr; |
|
1683 |
} |
|
1684 |
// 自提 |
|
1685 |
if (td.getTd_ztbz() == 2) { |
|
1686 |
if (fdc != null) { |
|
1687 |
if (!fdc.isHasSPR()) { |
|
1688 |
orr.setCode(1); |
|
1689 |
orr.setErrmsg("该账号没有自提权限!"); |
|
1690 |
return orr; |
|
1691 |
} |
|
1692 |
} |
|
1693 |
} else { |
|
1694 |
Fd_wlgs_fhdq wldq = this.dqper.getbyNos(lg.getDepartno(), td.getTd_shddbh(), |
|
1695 |
/*td.getTd_ywdybh().equals(Contants.nc_ywdy_ZZ) ? Contants.nc_ywdy_ZZ |
|
1696 |
:td.getTd_ywdybh().equals(Contants.nc_ywdy_MS) ? Contants.nc_ywdy_MS |
|
1697 |
: Contants.nc_ywdy_KJ*/ |
|
1698 |
ConvertTool.ncGetDefault(td.getTd_ywdybh()) |
|
1699 |
); |
|
1700 |
|
|
1701 |
int total = fdMxWlgsMapper.selectCountByTdTdls(td.getTd_tdls()); |
|
1702 |
if (wldq == null && total == 0) { |
|
1703 |
orr.setCode(1); |
|
1704 |
orr.setErrmsg("当前账号所属物流公司没有配置该地区的分单权限!"); |
|
1705 |
return orr; |
|
1706 |
} |
|
1707 |
} |
|
1708 |
JsonParser jp = new JsonParser(); |
|
1709 |
JsonArray mArr = jp.parse(mlist).getAsJsonArray(); |
|
1710 |
// 分单数量和毛重 |
|
1711 |
int fdsl = 0; |
|
1712 |
double fdmz = 0; |
|
1713 |
List<Fd_XSTD> tdl = new ArrayList<Fd_XSTD>(); |
|
1714 |
Map<String, List<Fd_XSTDMX>> mxMp = new HashMap<String, List<Fd_XSTDMX>>(); |
|
1715 |
List<Fd_XSTDMX> tdmxl = new ArrayList<Fd_XSTDMX>(); |
|
1716 |
Map<String, Fd_XSTD> rm=new HashMap<String, Fd_XSTD>(); |
|
1717 |
for (JsonElement mJe : mArr) { |
|
1718 |
JsonObject jo = mJe.getAsJsonObject(); |
|
1719 |
// 提单分录号 |
|
1720 |
String tdfl = JSONobj.getstring(jo, "tdfl"); |
|
1721 |
String vehicleId = JSONobj.getstring(jo, "vehicleId"); |
|
1722 |
Fd_XSTDMX mx = this.tdmxper.get(tdfl); |
|
1723 |
if (mx != null) { |
|
1724 |
// 没有分单的跳过 |
|
1725 |
if (mx.getTdmx_fdbz() == 0) { |
|
1726 |
continue; |
|
1727 |
} |
|
1728 |
// 已经装车的报错 |
|
1729 |
if (mx.getTdmx_zcbz() != 0) { |
|
1730 |
continue; |
|
1731 |
} |
|
1732 |
// 没有关闭明细做处理 |
|
1733 |
if (mx.getTdmx_gbbz() == 0) { |
|
1734 |
fdsl++; |
|
1735 |
fdmz = BigDecimalfiter.addscal(fdmz, mx.getTdmx_mz(), Contants.scale); |
|
1736 |
|
|
1737 |
Fd_XSTD ttr=rm.get(vehicleId+"_"+mx.getTdmx_fdwlgsbh()); |
|
1738 |
if(ttr!=null) { |
|
1739 |
ttr.setTd_wfdsl(ttr.getTd_wfdsl()+1); |
|
1740 |
ttr.setTd_wfdzl(BigDecimalfiter.addscal(ttr.getTd_wfdzl(), mx.getTdmx_mz(), Contants.scale)); |
|
1741 |
rm.put(vehicleId+"_"+mx.getTdmx_fdwlgsbh(), ttr); |
|
1742 |
}else { |
|
1743 |
ttr=new Fd_XSTD(); |
|
1744 |
ttr.setTd_wfdsl(1); |
|
1745 |
ttr.setTd_wfdzl(BigDecimalfiter.addscal(0, mx.getTdmx_mz(), Contants.scale)); |
|
1746 |
rm.put(vehicleId+"_"+mx.getTdmx_fdwlgsbh(), ttr); |
|
1747 |
} |
|
1748 |
} |
|
1749 |
|
|
1750 |
mx.setTdmx_fdbz(0); |
|
1751 |
mx.setTdmx_fdcph(null); |
|
1752 |
mx.setTdmx_fdwlgsbh(null); |
|
1753 |
mx.setTdmx_fdywbh(null); |
|
1754 |
this.tdmxper.updateFD(mx); |
|
1755 |
tdmxl.add(mx); |
|
1756 |
|
|
1757 |
} |
|
1758 |
} |
|
1759 |
Iterator<Entry<String, Fd_XSTD>> entries = rm.entrySet().iterator(); |
|
1760 |
while (entries.hasNext()) { |
|
1761 |
Entry<String, Fd_XSTD> entry = entries.next(); |
|
1762 |
Vehicle_XSTD vxs = this.vhxper.getbyIDs(entry.getKey().split("_")[0], td.getTd_tdbh(),entry.getKey().split("_")[1]); |
|
1763 |
if (vxs != null) { |
|
1764 |
if (vxs.getFd_num() == 1) { |
|
1765 |
this.vhxper.delbyIDs(entry.getKey().split("_")[0], td.getTd_tdbh(),entry.getKey().split("_")[1]); |
|
1766 |
} else { |
|
1767 |
vxs.setFd_num(vxs.getFd_num() - entry.getValue().getTd_wfdsl()); |
|
1768 |
vxs.setFd_weight(BigDecimalfiter.subscal(vxs.getFd_weight(), entry.getValue().getTd_wfdzl(), Contants.scale)); |
|
1769 |
this.vhxper.updatewithIDs(vxs); |
|
1770 |
} |
|
1771 |
Fd_Bsheet fb=this.fdbsper.getbyVehicleId(vxs.getVehicleId(), Serviceenum.在办, lg.getSdepartNo()); |
|
1772 |
if(fb !=null) { |
|
1773 |
fb.setUpdateTime(new Date()); |
|
1774 |
this.fdbsper.update(fb); |
|
1775 |
} |
|
1776 |
} |
|
1777 |
} |
|
1778 |
td.setTd_wfdsl(td.getTd_wfdsl() + fdsl); |
|
1779 |
td.setTd_wfdzl(BigDecimalfiter.addscal(td.getTd_wfdzl(), fdmz, Contants.scale)); |
|
1780 |
this.tdper.updateFD(td); |
|
1781 |
if (fdsl > 0) { |
|
1782 |
tdl.add(td); |
|
1783 |
mxMp.put(td.getTd_tdbh(), tdmxl); |
|
1784 |
} |
|
1785 |
|
|
1786 |
// 发送NC |
|
1787 |
if (tdl != null && tdl.size() > 0) { |
|
1788 |
String fdhx = this.fdtonc.getNcdata(tdl, mxMp); |
|
1789 |
Fileoperation.AppendContentToFile(Fileoperation.gettestFileName(), "明细取消配车 请求参数 ::" + fdhx); |
|
1790 |
JsonObject joADDYWD = Wxhtmethod.postJsonStr(Contants.NCfdhx_url, fdhx); |
|
1791 |
Fileoperation.AppendContentToFile(Fileoperation.gettestFileName(), "明细取消配车 返回值 ::" + joADDYWD); |
|
1792 |
if (joADDYWD == null || JSONobj.getint(joADDYWD, "code") != 0) { |
|
1793 |
throw new Exception( |
|
1794 |
(joADDYWD.get("msg")==null||StringUtils.isBlank(joADDYWD.get("msg").getAsString())) ? "分单回写NC系统出错!" |
|
1795 |
: joADDYWD.get("msg").getAsString()); |
|
1796 |
} else { |
|
1797 |
String restult = joADDYWD.get("result").getAsString(); |
|
1798 |
JsonObject jr = jp.parse(restult).getAsJsonObject(); |
|
1799 |
if (jr == null || JSONobj.getint(jr, "respcode") != 111) { |
|
1800 |
throw new Exception(jr.get("respmsg").getAsString()); |
|
1801 |
} |
|
1802 |
} |
|
1803 |
} |
|
1804 |
|
|
1805 |
orr.setCode(0); |
|
1806 |
orr.setItem(true); |
|
1807 |
return orr; |
|
1808 |
} |
|
1809 |
|
|
1810 |
@Override |
|
1811 |
public ObjectResult<String> tzPrint(String cardno, String ipadda,String cqNo) { |
|
1812 |
ObjectResult<String> orr = new ObjectResult<String>(); |
|
1813 |
if (StringUtils.isBlank(cardno)) { |
|
1814 |
orr.setCode(1); |
|
1815 |
orr.setErrmsg("提单编号为空!"); |
|
1816 |
return orr; |
|
1817 |
} |
|
1818 |
if (StringUtils.isBlank(ipadda)) { |
|
1819 |
orr.setCode(1); |
|
1820 |
orr.setErrmsg("批次号为空!"); |
|
1821 |
return orr; |
|
1822 |
} |
|
1823 |
Map<String, Object> cardinuse = this.yktmper.getcardinuse(cardno); |
|
1824 |
if (cardinuse == null) { |
|
1825 |
orr.setCode(1); |
|
1826 |
orr.setErrmsg("在用卡未找到!"); |
|
1827 |
return orr; |
|
1828 |
} |
|
1829 |
Fd_Vehicle fd_v = this.vhper.getByVehicleId(cardinuse.get("numberplates") + ""); |
|
1830 |
if (fd_v == null) { |
|
1831 |
orr.setCode(1); |
|
1832 |
orr.setErrmsg("车辆" + cardinuse.get("numberplates").toString() + "分单系统未找到!"); |
|
1833 |
return orr; |
|
1834 |
} |
|
1835 |
Fd_Bsheet fd_b = this.fdbsper.getbyVehicleId(fd_v.getVehicleId(), Serviceenum.在办, cqNo); |
|
1836 |
if (fd_b == null) { |
|
1837 |
orr.setCode(1); |
|
1838 |
orr.setErrmsg("车辆未找到在办分单!"); |
|
1839 |
return orr; |
|
1840 |
} |
|
1841 |
String dyAdd = this.bsper.getUsedbyAdd(); |
|
1842 |
if (StringUtils.isBlank(dyAdd)) { |
|
1843 |
orr.setCode(1); |
|
1844 |
orr.setErrmsg("系统未设置打印地址!"); |
|
1845 |
return orr; |
|
1846 |
} |
|
1847 |
try { |
|
1848 |
orr.setItem("http://" + dyAdd + Contants.GYPrintAdd + "&vehicleId=" |
|
1849 |
+ URLEncoder.encode(fd_v.getVehicleId(), "utf-8") + "&bsNo=" + fd_b.getBsNo() + "&phone=" |
|
1850 |
+ fd_b.getPhone() + "&comNo="); |
|
1851 |
// log.info("::::::::::;"+orr.getItem()); |
|
1852 |
} catch (UnsupportedEncodingException e) { |
|
1853 |
e.printStackTrace(); |
|
1854 |
} |
|
1855 |
// 存打印日志:方便以后查找 |
|
1856 |
|
|
1857 |
orr.setCode(0); |
|
1858 |
return orr; |
|
1859 |
|
|
1860 |
} |
|
1861 |
|
|
1862 |
@Override |
|
1863 |
@Transactional(rollbackFor = Exception.class) |
|
1864 |
public ObjectResult<Boolean> delbyPCH(Login lg, String tdNo, String pch, String cph,String bsNo) throws Exception { |
|
1865 |
ObjectResult<Boolean> orr = new ObjectResult<Boolean>(); |
|
1866 |
if (lg == null) { |
|
1867 |
orr.setCode(1); |
|
1868 |
orr.setErrmsg("请登录账号!"); |
|
1869 |
return orr; |
|
1870 |
} |
|
1871 |
if (StringUtils.isEmpty(tdNo)) { |
|
1872 |
orr.setCode(1); |
|
1873 |
orr.setErrmsg("提单编号为空!"); |
|
1874 |
return orr; |
|
1875 |
} |
|
1876 |
if (StringUtils.isEmpty(pch)) { |
|
1877 |
orr.setCode(1); |
|
1878 |
orr.setErrmsg("批次号为空!"); |
|
1879 |
return orr; |
|
1880 |
} |
|
1881 |
Fd_Bsheet fdb = this.fdbsper.getbybsNo(bsNo);//getbyVehicleId(cph, Serviceenum.在办); |
|
1882 |
if (fdb == null) { |
|
1883 |
orr.setCode(1); |
|
1884 |
orr.setErrmsg("车牌号:" + cph + " 业务单未找到!"); |
|
1885 |
return orr; |
|
1886 |
} |
|
1887 |
if (fdb.getStatus()!=Serviceenum.在办) { |
|
1888 |
orr.setCode(1); |
|
1889 |
orr.setErrmsg("车牌号:" + cph + " 业务单不是在办状态!"); |
|
1890 |
return orr; |
|
1891 |
} |
|
1892 |
Fd_Company fdc = fdcper.getByCompanyNo(lg.getDepartno()); |
|
1893 |
if (fdc == null) { |
|
1894 |
orr.setCode(1); |
|
1895 |
orr.setErrmsg("账号没有配置物流公司!"); |
|
1896 |
return orr; |
|
1897 |
} |
|
1898 |
// 根据提单号找到 fd_xstd 判断xstd数据 |
|
1899 |
// 根据批次号和提单流水号找到 fd_xstdmx 判断xstdmx数据 |
|
1900 |
// 如果是已经装车了 至少保留一件 |
|
1901 |
// 修改fd_xstdmx vehicle_xstd表 |
|
1902 |
Fd_XSTD td = this.tdper.getbyTDBH(tdNo); |
|
1903 |
if (td == null) { |
|
1904 |
orr.setCode(1); |
|
1905 |
orr.setErrmsg("提单号:" + tdNo + " 未找到!"); |
|
1906 |
return orr; |
|
1907 |
} |
|
1908 |
// Fd_XSTDMX mx=this.tdmxper.getbyPCH(pch); |
|
1909 |
Fd_XSTDMX mx = this.tdmxper.getbyPCHandTDNOONE(pch, td.getTd_tdbh()); |
|
1910 |
if (mx == null) { |
|
1911 |
orr.setCode(1); |
|
1912 |
orr.setErrmsg("提单明细未找到!"); |
|
1913 |
return orr; |
|
1914 |
} |
|
1915 |
if (mx.getTdmx_zcbz() != 0) { |
|
1916 |
orr.setCode(1); |
|
1917 |
orr.setErrmsg("明细已经装车不能删除!"); |
|
1918 |
return orr; |
|
1919 |
} |
|
1920 |
if (!mx.getTdmx_tdls().equals(td.getTd_tdls())) { |
|
1921 |
orr.setCode(1); |
|
1922 |
orr.setErrmsg("参数错误,明细不属于该提单!"); |
|
1923 |
return orr; |
|
1924 |
} |
|
1925 |
// 已经分单了未关闭 |
|
1926 |
if (mx.getTdmx_fdbz() != 0 && mx.getTdmx_gbbz() == 0) { |
|
1927 |
fdb.setUpdateTime(new Date()); |
|
1928 |
this.fdbsper.update(fdb); |
|
1929 |
List<Fd_XSTD> tdl = new ArrayList<Fd_XSTD>(); |
|
1930 |
Map<String, List<Fd_XSTDMX>> mxMp = new HashMap<String, List<Fd_XSTDMX>>(); |
|
1931 |
List<Fd_XSTDMX> mxl = new ArrayList<Fd_XSTDMX>(); |
|
1932 |
|
|
1933 |
mx.setTdmx_fdbz(0); |
|
1934 |
mx.setTdmx_fdcph(null); |
|
1935 |
mx.setTdmx_fdwlgsbh(null); |
|
1936 |
mx.setTdmx_fdywbh(null); |
|
1937 |
this.tdmxper.updateFD(mx); |
|
1938 |
Vehicle_XSTD vx = this.vhxper.getbyIDs(cph, tdNo,lg.getDepartno()); |
|
1939 |
if (vx != null) { |
|
1940 |
if (vx.getFd_num() > 1) { |
|
1941 |
vx.setFd_num(vx.getFd_num() - 1); |
|
1942 |
vx.setFd_weight(BigDecimalfiter.subscal(vx.getFd_weight(), mx.getTdmx_mz(), Contants.scale)); |
|
1943 |
this.vhxper.updatewithIDs(vx); |
|
1944 |
} else { |
|
1945 |
this.vhxper.delbyIDs(cph, tdNo,lg.getDepartno()); |
|
1946 |
} |
|
1947 |
} |
|
1948 |
td.setTd_wfdsl(td.getTd_wfdsl() + 1); |
|
1949 |
td.setTd_wfdzl(BigDecimalfiter.addscal(td.getTd_wfdzl(), mx.getTdmx_mz(), Contants.scale)); |
|
1950 |
this.tdper.updateFD(td); |
|
1951 |
tdl.add(td); |
|
1952 |
mxl.add(mx); |
|
1953 |
mxMp.put(tdNo, mxl); |
|
1954 |
// 发送NC |
|
1955 |
if (tdl != null && tdl.size() > 0) { |
|
1956 |
String fdhx = this.fdtonc.getNcdata(tdl, mxMp); |
|
1957 |
Fileoperation.AppendContentToFile(Fileoperation.gettestFileName(), "批次号取消配车 请求参数 ::" + fdhx); |
|
1958 |
JsonObject joADDYWD = Wxhtmethod.postJsonStr(Contants.NCfdhx_url, fdhx); |
|
1959 |
Fileoperation.AppendContentToFile(Fileoperation.gettestFileName(), "批次号取消配车 返回值 ::" + joADDYWD); |
|
1960 |
if (joADDYWD == null || JSONobj.getint(joADDYWD, "code") != 0) { |
|
1961 |
throw new Exception( |
|
1962 |
(joADDYWD.get("msg")==null||StringUtils.isBlank(joADDYWD.get("msg").getAsString())) ? "分单回写NC系统出错!" |
|
1963 |
: joADDYWD.get("msg").getAsString()); |
|
1964 |
} else { |
|
1965 |
String restult = joADDYWD.get("result").getAsString(); |
|
1966 |
JsonParser jp = new JsonParser(); |
|
1967 |
JsonObject jr = jp.parse(restult).getAsJsonObject(); |
|
1968 |
if (jr == null || JSONobj.getint(jr, "respcode") != 111) { |
|
1969 |
throw new Exception(jr.get("respmsg").getAsString()); |
|
1970 |
} |
|
1971 |
} |
|
1972 |
} |
|
1973 |
|
|
1974 |
} |
|
1975 |
|
|
1976 |
orr.setCode(0); |
|
1977 |
orr.setItem(true); |
|
1978 |
return orr; |
|
1979 |
} |
|
1980 |
|
|
1981 |
@Override |
|
1982 |
@Transactional(rollbackFor = Exception.class) |
|
1983 |
public ObjectResult<Boolean> closeXstd(String vehicleId, String driver, String phone, String xstdNo, Login lg) |
|
1984 |
throws Exception { |
|
1985 |
ObjectResult<Boolean> or = new ObjectResult<Boolean>(); |
|
1986 |
if (lg == null) { |
|
1987 |
or.setCode(1); |
|
1988 |
or.setErrmsg("请重新登录账号!"); |
|
1989 |
return or; |
|
1990 |
} |
|
1991 |
// 根据xstdNo查找fd_xstd信息 vehicle_xstd |
|
1992 |
// 判断vehicle_xstd的销售提单的状态 |
|
1993 |
// 查找fd_xstdmx |
|
1994 |
// for循环 list<fd_xstdmx> 获取未分单未装车 |
|
1995 |
// 修改fd_xstdmx 修改Fd_Gbxstd, Fd_Gbxstdmx,修改fd_xstd |
|
1996 |
if (StringUtils.isEmpty(xstdNo)) { |
|
1997 |
or.setCode(1); |
|
1998 |
or.setErrmsg("销售提单号为空,不能执行该操作!"); |
|
1999 |
return or; |
|
2000 |
} |
|
2001 |
if (!StringUtils.isEmpty(vehicleId)) { |
|
2002 |
if (!RegexCheck.isVehicleID(vehicleId)) { |
|
2003 |
or.setCode(1); |
|
2004 |
or.setErrmsg("请输入正确的车牌号!"); |
|
2005 |
return or; |
|
2006 |
} |
|
2007 |
} |
|
2008 |
if (!StringUtils.isEmpty(phone)) { |
|
2009 |
if (!RegexCheck.checkphone(phone)) { |
|
2010 |
or.setCode(1); |
|
2011 |
or.setErrmsg("请输入正确的手机号!"); |
|
2012 |
return or; |
|
2013 |
} |
|
2014 |
} |
|
2015 |
|
|
2016 |
Fd_Gbxstd gbtd = gbtdper.get(xstdNo); |
|
2017 |
if (gbtd != null) { |
|
2018 |
or.setCode(1); |
|
2019 |
or.setErrmsg("销售提单:" + xstdNo + " 已经有关闭记录,不能保存重复的关闭记录!"); |
|
2020 |
return or; |
|
2021 |
} |
|
2022 |
List<Vehicle_XSTD> vxl = vhxper.getlistbytdNo(xstdNo); |
|
2023 |
if (vxl != null && vxl.size() > 0) { |
|
2024 |
or.setCode(1); |
|
2025 |
or.setErrmsg("销售提单:" + xstdNo + " 已经分单给:" + vxl.get(0).getVehicleId() + ",不能执行该操作!"); |
|
2026 |
return or; |
|
2027 |
} |
|
2028 |
Fd_XSTD tdx = this.tdper.getbyttdbh(xstdNo); |
|
2029 |
if (tdx == null) { |
|
2030 |
or.setCode(1); |
|
2031 |
or.setErrmsg("销售提单:" + xstdNo + "未找到,不能执行该操作!"); |
|
2032 |
return or; |
|
2033 |
} |
|
2034 |
Fd_Company fdc = new Fd_Company(); |
|
2035 |
if (!UserType.admin.toString().equals(lg.getWorkerno())) { |
|
2036 |
fdc = fdcper.getByCompanyNo(lg.getDepartno()); |
|
2037 |
if (fdc == null) { |
|
2038 |
or.setCode(1); |
|
2039 |
or.setErrmsg("登录账号未指定物流公司!"); |
|
2040 |
return or; |
|
2041 |
} |
|
2042 |
// 自提 |
|
2043 |
if (tdx.getTd_ztbz() == 2) { |
|
2044 |
if (!fdc.isHasSPR()) { |
|
2045 |
or.setCode(1); |
|
2046 |
or.setErrmsg("该账号没有操作该提单的权限!"); |
|
2047 |
return or; |
|
2048 |
} |
|
2049 |
} else { |
|
2050 |
String shdqbh = tdx.getTd_shddbh(); |
|
2051 |
Fd_wlgs_fhdq acb = this.dqper.getbyNos(lg.getDepartno(), shdqbh, |
|
2052 |
/*tdx.getTd_ywdybh().equals(Contants.nc_ywdy_ZZ) ? Contants.nc_ywdy_ZZ |
|
2053 |
:tdx.getTd_ywdybh().equals(Contants.nc_ywdy_MS) ? Contants.nc_ywdy_MS |
|
2054 |
: Contants.nc_ywdy_KJ*/ |
|
2055 |
ConvertTool.ncGetDefault(tdx.getTd_ywdybh()) |
|
2056 |
); |
|
2057 |
|
|
2058 |
int total = fdMxWlgsMapper.selectCountByTdTdls(tdx.getTd_tdls()); |
|
2059 |
if (acb == null && total == 0) { |
|
2060 |
or.setCode(1); |
|
2061 |
or.setErrmsg("账号没有操作该提单的权限!"); |
|
2062 |
return or; |
|
2063 |
} |
|
2064 |
} |
|
2065 |
} |
|
2066 |
|
|
2067 |
List<Fd_XSTDMX> mxL = this.tdmxper.getforClose(tdx.getTd_tdls()); |
|
2068 |
int dd = 0; |
|
2069 |
double cc = 0; |
|
2070 |
if (mxL != null) { |
|
2071 |
for (Fd_XSTDMX mx : mxL) { |
|
2072 |
dd++; |
|
2073 |
cc = BigDecimalfiter.addscal(cc, mx.getTdmx_mz(), Contants.scale); |
|
2074 |
mx.setTdmx_zcbz(1); |
|
2075 |
mx.setTdmx_zccph(vehicleId); |
|
2076 |
mx.setTdmx_zcdriver(driver); |
|
2077 |
mx.setTdmx_zcphone(phone); |
|
2078 |
mx.setTdmx_zcwlgsName(lg.getDepartname()); |
|
2079 |
this.tdmxper.updateZCANDFD(mx); |
|
2080 |
Fd_Gbxstdmx gb = this.gbtdmxper.get(mx.getTdmx_tdfl()); |
|
2081 |
if (gb == null) { |
|
2082 |
gb = new Fd_Gbxstdmx(); |
|
2083 |
gb.setId(mx.getTdmx_tdfl()); |
|
2084 |
gb.setTdfl(mx.getTdmx_tdfl()); |
|
2085 |
gb.setPch(mx.getTdmx_pch()); |
|
2086 |
gb.setTdNo(tdx.getTd_tdbh()); |
|
2087 |
this.gbtdmxper.insert(gb); |
|
2088 |
} |
|
2089 |
} |
|
2090 |
} |
|
2091 |
tdx.setTd_wfdsl(0); |
|
2092 |
tdx.setTd_wfdzl(0); |
|
2093 |
this.tdper.updateFD(tdx); |
|
2094 |
if (dd > 0) { |
|
2095 |
gbtd = new Fd_Gbxstd(); |
|
2096 |
gbtd.setCompanyNo(lg.getDepartname() == null ? "管理员关闭" : lg.getDepartname()); |
|
2097 |
gbtd.setHSR(tdx.getTd_ztbz() == 2); |
|
2098 |
gbtd.setTd_gbr(lg.getWorkername()); |
|
2099 |
gbtd.setTd_gbsj(new Date()); |
|
2100 |
gbtd.setTd_gbsl(dd); |
|
2101 |
gbtd.setTd_gbzl(cc); |
|
2102 |
gbtd.setVehicleId(vehicleId); |
|
2103 |
gbtd.setXstdNo(xstdNo); |
|
2104 |
this.gbtdper.insert(gbtd); |
|
2105 |
} |
|
2106 |
|
|
2107 |
or.setCode(0); |
|
2108 |
return or; |
|
2109 |
} |
|
2110 |
|
|
2111 |
@Override |
|
2112 |
@Transactional(rollbackFor = Exception.class) |
|
2113 |
public ObjectResult<Boolean> openXstd(String xstdNo, Login lg) throws Exception { |
|
2114 |
|
|
2115 |
ObjectResult<Boolean> or = new ObjectResult<Boolean>(); |
|
2116 |
if (lg == null) { |
|
2117 |
or.setCode(1); |
|
2118 |
or.setErrmsg("请重新登录账号!"); |
|
2119 |
return or; |
|
2120 |
} |
|
2121 |
if (StringUtils.isEmpty(xstdNo)) { |
|
2122 |
or.setCode(1); |
|
2123 |
or.setErrmsg("销售提单号为空,不能执行该操作!"); |
|
2124 |
return or; |
|
2125 |
} |
|
2126 |
// 关闭之后不让打开了 |
|
2127 |
|
|
2128 |
// 根据xstdNo查找fd_xstd信息 vehicle_xstd |
|
2129 |
// 判断vehicle_xstd的销售提单的状态 |
|
2130 |
// 查找fd_xstdmx |
|
2131 |
// for循环 list<fd_xstdmx> 获取未分单未装车 |
|
2132 |
// 修改fd_xstdmx 修改Fd_Gbxstd, Fd_Gbxstdmx,修改fd_xstd |
|
2133 |
|
|
2134 |
Fd_Gbxstd gbtd = gbtdper.get(xstdNo); |
|
2135 |
if (gbtd == null) { |
|
2136 |
or.setCode(1); |
|
2137 |
or.setErrmsg("销售提单:" + xstdNo + " 未找到关闭记录,不能恢复销售提单!"); |
|
2138 |
return or; |
|
2139 |
} |
|
2140 |
if (BasicMethod.after(gbtd.getTd_gbsj(), 7)) { |
|
2141 |
or.setCode(1); |
|
2142 |
or.setErrmsg("已关闭超过7天,不能恢复提单!"); |
|
2143 |
return or; |
|
2144 |
} |
|
2145 |
List<Vehicle_XSTD> vxl = vhxper.getlistbytdNo(xstdNo); |
|
2146 |
if (vxl != null && vxl.size() > 0) { |
|
2147 |
or.setCode(1); |
|
2148 |
or.setErrmsg("销售提单:" + xstdNo + " 有在办的分车单,不能执行该操作!"); |
|
2149 |
return or; |
|
2150 |
} |
|
2151 |
Fd_XSTD tdx = this.tdper.getbyttdbh(xstdNo); |
|
2152 |
if (tdx == null) { |
|
2153 |
or.setCode(1); |
|
2154 |
or.setErrmsg("销售提单:" + xstdNo + "未找到,不能执行该操作!"); |
|
2155 |
return or; |
|
2156 |
} |
|
2157 |
Fd_Company fdc = new Fd_Company(); |
|
2158 |
if (!UserType.admin.toString().equals(lg.getWorkerno())) { |
|
2159 |
fdc = fdcper.getByCompanyNo(lg.getDepartno()); |
|
2160 |
if (fdc == null) { |
|
2161 |
or.setCode(1); |
|
2162 |
or.setErrmsg("登录账号未指定物流公司!"); |
|
2163 |
return or; |
|
2164 |
} |
|
2165 |
// 自提 |
|
2166 |
if (tdx.getTd_ztbz() == 2) { |
|
2167 |
if (!fdc.isHasSPR()) { |
|
2168 |
or.setCode(1); |
|
2169 |
or.setErrmsg("该账号没有操作该提单的权限!"); |
|
2170 |
return or; |
|
2171 |
} |
|
2172 |
} else { |
|
2173 |
String shdqbh = tdx.getTd_shddbh(); |
|
2174 |
Fd_wlgs_fhdq acb = this.dqper.getbyNos(lg.getDepartno(), shdqbh, |
|
2175 |
/*tdx.getTd_ywdybh().equals(Contants.nc_ywdy_ZZ) ? Contants.nc_ywdy_ZZ |
|
2176 |
:tdx.getTd_ywdybh().equals(Contants.nc_ywdy_MS) ? Contants.nc_ywdy_MS |
|
2177 |
: Contants.nc_ywdy_KJ*/ |
|
2178 |
ConvertTool.ncGetDefault(tdx.getTd_ywdybh()) |
|
2179 |
); |
|
2180 |
int total = fdMxWlgsMapper.selectCountByTdTdls(tdx.getTd_tdls()); |
|
2181 |
if (acb == null && total == 0) { |
|
2182 |
or.setCode(1); |
|
2183 |
or.setErrmsg("该账号没有操作该提单的权限!"); |
|
2184 |
return or; |
|
2185 |
} |
|
2186 |
} |
|
2187 |
} |
|
2188 |
|
|
2189 |
List<Fd_Gbxstdmx> mxL = this.gbtdmxper.getList(xstdNo); |
|
2190 |
int dd = 0; |
|
2191 |
if (mxL != null) { |
|
2192 |
for (Fd_Gbxstdmx mx : mxL) { |
|
2193 |
Fd_XSTDMX tdmx = this.tdmxper.getbytdflAndtdls(mx.getId(), tdx.getTd_tdls()); |
|
2194 |
tdmx.setTdmx_zcbz(0); |
|
2195 |
tdmx.setTdmx_zccph(null); |
|
2196 |
tdmx.setTdmx_zcdriver(null); |
|
2197 |
tdmx.setTdmx_zcphone(null); |
|
2198 |
tdmx.setTdmx_zcwlgsName(null); |
|
2199 |
dd++; |
|
2200 |
this.tdmxper.updateZCANDFD(tdmx); |
|
2201 |
this.gbtdmxper.delbyId(mx.getId()); |
|
2202 |
} |
|
2203 |
} |
|
2204 |
if (dd > 0) { |
|
2205 |
tdx.setTd_wfdsl(gbtd.getTd_gbsl()); |
|
2206 |
tdx.setTd_wfdzl(gbtd.getTd_gbzl()); |
|
2207 |
this.tdper.updateFD(tdx); |
|
2208 |
this.gbtdper.del(xstdNo); |
|
2209 |
} |
|
2210 |
|
|
2211 |
or.setCode(0); |
|
2212 |
return or; |
|
2213 |
} |
|
2214 |
|
|
2215 |
@Override |
|
2216 |
@Transactional(rollbackFor = Exception.class) |
|
2217 |
@Deprecated |
|
2218 |
public ObjectResult<Boolean> changeVehicle(Login lg, String bsNo, String vehicleInfo) throws Exception { |
|
2219 |
ObjectResult<Boolean> orr = new ObjectResult<Boolean>(); |
|
2220 |
if (lg == null) { |
|
2221 |
orr.setCode(1); |
|
2222 |
orr.setErrmsg("请登录账号!"); |
|
2223 |
return orr; |
|
2224 |
} |
|
2225 |
if (true) { |
|
2226 |
orr.setCode(1); |
|
2227 |
orr.setErrmsg("该方法不可用!"); |
|
2228 |
return orr; |
|
2229 |
} |
|
2230 |
if (UserType.admin.toString().equals(lg.getWorkerno())) { |
|
2231 |
orr.setCode(1); |
|
2232 |
orr.setErrmsg("管理员不能执行该操作!"); |
|
2233 |
return orr; |
|
2234 |
} |
|
2235 |
if (StringUtils.isEmpty(bsNo) || StringUtils.isEmpty(vehicleInfo)) { |
|
2236 |
orr.setCode(1); |
|
2237 |
orr.setErrmsg("业务参数为空!"); |
|
2238 |
return orr; |
|
2239 |
} |
|
2240 |
Fd_Bsheet fdb = fdbsper.getbybsNo(bsNo); |
|
2241 |
if (fdb == null) { |
|
2242 |
orr.setCode(1); |
|
2243 |
orr.setErrmsg("业务单未找到!"); |
|
2244 |
return orr; |
|
2245 |
} |
|
2246 |
String vehicleId = fdb.getVehicleId(); |
|
2247 |
Fd_Vehicle fdv = vhper.getByVehicleId(vehicleId); |
|
2248 |
if (fdv == null) { |
|
2249 |
orr.setCode(1); |
|
2250 |
orr.setErrmsg("原来的车牌未找到!"); |
|
2251 |
return orr; |
|
2252 |
} |
|
2253 |
JsonParser jp = new JsonParser(); |
|
2254 |
JsonElement je = jp.parse(vehicleInfo); |
|
2255 |
JsonObject jo = je.getAsJsonObject(); |
|
2256 |
String nvehicleId = JSONobj.getstring(jo, "vehicleId"); |
|
2257 |
String driver = JSONobj.getstring(jo, "driver"); |
|
2258 |
String phone = JSONobj.getstring(jo, "phone"); |
|
2259 |
double vehicleweight = JSONobj.getdouble(jo, "vehicleweight"); |
|
2260 |
double loadweight = JSONobj.getdouble(jo, "loadweight"); |
|
2261 |
String feature = JSONobj.getstring(jo, "feature"); |
|
2262 |
String note = JSONobj.getstring(jo, "note"); |
|
2263 |
String IDNum = JSONobj.getstring(jo, "IDNum"); |
|
2264 |
if (StringUtils.isEmpty(vehicleId) || StringUtils.isEmpty(driver) || StringUtils.isEmpty(IDNum) |
|
2265 |
|| StringUtils.isEmpty(phone)) { |
|
2266 |
orr.setCode(1); |
|
2267 |
orr.setErrmsg("车辆必填信息不能为空!"); |
|
2268 |
return orr; |
|
2269 |
} |
|
2270 |
Fd_Vehicle nfdv = vhper.getByVehicleId(nvehicleId); |
|
2271 |
if (nfdv != null && nfdv.getStatus() != VehicleStatus.未配车) { |
|
2272 |
orr.setCode(1); |
|
2273 |
orr.setErrmsg("车辆:" + nvehicleId + "状态不是未配车状态,不能使用!"); |
|
2274 |
return orr; |
|
2275 |
} |
|
2276 |
|
|
2277 |
// 临时车直接删除 |
|
2278 |
if (fdv.getType() == VehicleType.临时车) { |
|
2279 |
vhper.delByVehicleId(fdv.getVehicleId()); |
|
2280 |
} else { |
|
2281 |
fdv.setStatus(VehicleStatus.未配车); |
|
2282 |
vhper.update(fdv); |
|
2283 |
} |
|
2284 |
|
|
2285 |
// 修改vehicle_xstd表 |
|
2286 |
List<Vehicle_XSTD> lc = vhxper.getlistbycomNo(lg.getDepartno()); |
|
2287 |
// List<Vehicle_XSTD> lc=vhxper.getlistbyVehicleId(fdv.getVehicleId()); |
|
2288 |
if (lc != null) { |
|
2289 |
for (Vehicle_XSTD vx : lc) { |
|
2290 |
if (vx.getVehicleId().equals(fdv.getVehicleId())) { |
|
2291 |
vx.setVehicleId(nvehicleId); |
|
2292 |
vhxper.updatewithIDs(vx); |
|
2293 |
} |
|
2294 |
} |
|
2295 |
} |
|
2296 |
if (nfdv == null) { |
|
2297 |
nfdv = new Fd_Vehicle(); |
|
2298 |
nfdv.setCompanyNo(lg.getDepartno()); |
|
2299 |
nfdv.setDriver(driver); |
|
2300 |
nfdv.setId(UUID.randomUUID() + ""); |
|
2301 |
nfdv.setLoadweight(loadweight); |
|
2302 |
nfdv.setNote(note); |
|
2303 |
nfdv.setPhone(phone); |
|
2304 |
nfdv.setState(true); |
|
2305 |
nfdv.setFeature(feature); |
|
2306 |
nfdv.setStatus(VehicleStatus.已配车); |
|
2307 |
nfdv.setType(VehicleType.临时车); |
|
2308 |
nfdv.setVehicleId(nvehicleId); |
|
2309 |
nfdv.setVehicleweight(vehicleweight); |
|
2310 |
nfdv.setIDNum(IDNum); |
|
2311 |
vhper.insert(nfdv); |
|
2312 |
} |
|
2313 |
|
|
2314 |
// 换车用不用发送短信 |
|
2315 |
|
|
2316 |
orr.setCode(0); |
|
2317 |
orr.setItem(true); |
|
2318 |
return orr; |
|
2319 |
} |
|
2320 |
|
|
2321 |
@Override |
|
2322 |
@Transactional(rollbackFor = Exception.class) |
|
2323 |
@Deprecated |
|
2324 |
public ObjectResult<Boolean> saveZcInfo(Scxt_zcInfo zc) throws Exception { |
|
2325 |
ObjectResult<Boolean> orr = new ObjectResult<Boolean>(); |
|
2326 |
if (zc == null) { |
|
2327 |
orr.setCode(1); |
|
2328 |
orr.setErrmsg("参数为空不能保存!"); |
|
2329 |
return orr; |
|
2330 |
} |
|
2331 |
if (true) { |
|
2332 |
orr.setCode(1); |
|
2333 |
orr.setErrmsg("该方法已作废!"); |
|
2334 |
return orr; |
|
2335 |
} |
|
2336 |
String zcvehicleID = zc.getCph();// 车牌号 |
|
2337 |
String pch = zc.getPch();// 批次号 |
|
2338 |
String tdbh = zc.getTdbh();// 提单编号 |
|
2339 |
Fd_Vehicle fdv = vhper.getByVehicleId(zcvehicleID); |
|
2340 |
if (fdv == null) { |
|
2341 |
orr.setCode(1); |
|
2342 |
orr.setErrmsg("分单系统未找到该车牌号!"); |
|
2343 |
return orr; |
|
2344 |
} |
|
2345 |
Map<String, Object> bsmp =null;// bsper.getbsbyBt(zcvehicleID, Contants.cpxsBtNo, Serviceenum.在办,Contants.kjSdepartNo); |
|
2346 |
if (bsmp == null) { |
|
2347 |
orr.setCode(1); |
|
2348 |
orr.setErrmsg("该车辆没有找到一卡通业务单!"); |
|
2349 |
return orr; |
|
2350 |
} |
|
2351 |
String dbsign = tdbh.split("-")[0]; |
|
2352 |
// Fd_Erpconfig erpdb=erpper.getbySign(dbsign); |
|
2353 |
// if(erpdb==null){ |
|
2354 |
// orr.setCode(1); |
|
2355 |
// orr.setErrmsg("根据提单编号未找到配置的数据库数据源!"); |
|
2356 |
// return orr; |
|
2357 |
// } |
|
2358 |
// Map<String, Object> bsim=bsper.getbsi(pch, bsmp.get("bussinessNo")+"" ); |
|
2359 |
// if(bsim!=null){ |
|
2360 |
// orr.setCode(1); |
|
2361 |
// orr.setErrmsg("该成品已经装车!"); |
|
2362 |
// return orr; |
|
2363 |
// } |
|
2364 |
// try { |
|
2365 |
// String |
|
2366 |
// url="jdbc:jtds:sqlserver://"+erpdb.getUri()+":"+erpdb.getPost()+";databaseName="+erpdb.getDb(); |
|
2367 |
// Connection con=ddbdao.open(url, erpdb.getUsername(), |
|
2368 |
// erpdb.getPwd(),erpdb.getDbsign()); |
|
2369 |
// if(con==null){ |
|
2370 |
// ddbdao.close(); |
|
2371 |
// orr.setCode(1); |
|
2372 |
// orr.setErrmsg("erp数据库链接失败,请查询erp配置是否正确!"); |
|
2373 |
// return orr; |
|
2374 |
// } |
|
2375 |
// String sql=SqlTxt.GYErpXSTDsql+" where EXISTS (SELECT 1 FROM XSTDMX WHERE |
|
2376 |
// XSTDMX_TDLS=XSTD_TDLS AND XSTDMX_CKBZ='0') and a.XSTD_TDBH='"+tdbh+"' and |
|
2377 |
// a.XSTD_SHBZ=1 and a.XSTD_TDBZ='LD' "; |
|
2378 |
// Map<String, Object> tdmp=ddbdao.getmapnoclose(sql,erpdb.getDbsign()); |
|
2379 |
// if(tdmp==null){ |
|
2380 |
// orr.setCode(1); |
|
2381 |
// orr.setErrmsg("销售提单未找到!"); |
|
2382 |
// ddbdao.close(); |
|
2383 |
// return orr; |
|
2384 |
// } |
|
2385 |
// WaitXSTD wt=new WaitXSTD(); |
|
2386 |
// BeanUtils.populate(wt, tdmp); |
|
2387 |
// |
|
2388 |
// //判断该车辆有没有操作该提单的权限 |
|
2389 |
// if(true){ |
|
2390 |
// |
|
2391 |
// } |
|
2392 |
// sql=SqlTxt.GYErpXSTDMXsql+" where b.XSTDMX_CKBZ='0' and |
|
2393 |
// a.XSTD_TDBH='"+tdbh+"' and b.XSTDMX_PCH='"+pch+"' ";//销售提单明细 |
|
2394 |
// Map<String, Object> mxmp=ddbdao.getmapnoclose(sql,erpdb.getDbsign()); |
|
2395 |
// if(mxmp==null){ |
|
2396 |
// orr.setCode(1); |
|
2397 |
// orr.setErrmsg("根据提单号和批次号Erp未找到销售提单明细!"); |
|
2398 |
// ddbdao.close(); |
|
2399 |
// return orr; |
|
2400 |
// } |
|
2401 |
// WaitXSTDMX wtdmx=new WaitXSTDMX(); |
|
2402 |
// BeanUtils.populate(wtdmx, mxmp); |
|
2403 |
// String hj=mxmp.get("hj")==null?"":mxmp.get("hj")+""; |
|
2404 |
// String zt=mxmp.get("zt")==null?"":mxmp.get("zt")+""; |
|
2405 |
// wtdmx.setTdmx_hjzt(hj+"/"+zt); |
|
2406 |
// //如果扫的是没有分单的 |
|
2407 |
// if(wtdmx.getTdmx_fdbz()==0){ |
|
2408 |
// sql=SqlTxt.XGGYErpXSTDMXsql+" where a.XSTDMX_CKBZ='0' and |
|
2409 |
// b.XSTD_TDBH='"+tdbh+"' and a.XSTDMX_PCH='"+pch+"' ";//修改销售提单明细 |
|
2410 |
// List<Object> ll=new ArrayList<Object>(); |
|
2411 |
// ll.add(zcvehicleID);//车牌号 |
|
2412 |
// ll.add(2);//分单标志 |
|
2413 |
// ll.add(bsmp.get("bussinessNo")+"");//分单单据编号 |
|
2414 |
// ddbdao.modifySql(sql, ll,erpdb.getDbsign()); |
|
2415 |
// |
|
2416 |
// sql=SqlTxt.XGGYErpXSTDsql;//修改销售提单 |
|
2417 |
// ll.clear(); |
|
2418 |
// ll.add(wt.getTd_wfdsl()-1);//未分单数量 |
|
2419 |
// ll.add(BigDecimalfiter.subscal(wt.getTd_wfdzl(), wtdmx.getTdmx_mz(), |
|
2420 |
// Contants.scale));//未分单毛重 |
|
2421 |
// ll.add(tdbh); |
|
2422 |
// ddbdao.modifySql(sql, ll,erpdb.getDbsign()); |
|
2423 |
// } |
|
2424 |
// |
|
2425 |
// if(fdv.getStatus()!=VehicleStatus.已装车){ |
|
2426 |
// fdv.setStatus(VehicleStatus.已装车); |
|
2427 |
// vhper.update(fdv); |
|
2428 |
// } |
|
2429 |
// Fd_Bsheetitem fbi=bsiper.getbyLsandFl(wtdmx.getTdmx_tdls(), |
|
2430 |
// wtdmx.getTdmx_tdfl(),tdbh); |
|
2431 |
// //该车辆有没有添加 |
|
2432 |
// Vehicle_XSTD vhx=vhxper.getbyIDs(zcvehicleID, tdbh); |
|
2433 |
// //已经分单 |
|
2434 |
// if(fbi!=null){ |
|
2435 |
// //未分到当前车辆 |
|
2436 |
// if(!fbi.getTdmx_cph().equals(zcvehicleID)){ |
|
2437 |
// Vehicle_XSTD vhx1=vhxper.getbyIDs(zcvehicleID, tdbh); |
|
2438 |
// //该车辆已添加销售提单 |
|
2439 |
// if(vhx!=null){ |
|
2440 |
// vhx.setFd_num(vhx.getFd_num()+1); |
|
2441 |
// vhx.setFd_weight(BigDecimalfiter.addscal(vhx.getFd_weight(),wtdmx.getTdmx_mz() |
|
2442 |
// ,Contants.scale )); |
|
2443 |
// vhxper.update(vhx); |
|
2444 |
// }else{ |
|
2445 |
// vhx=new Vehicle_XSTD(); |
|
2446 |
// vhx.setFd_num(1); |
|
2447 |
// vhx.setFd_weight(BigDecimalfiter.addscal(wtdmx.getTdmx_mz(), 0, |
|
2448 |
// Contants.scale)); |
|
2449 |
// vhx.setVehicleId(zcvehicleID); |
|
2450 |
// vhx.setXstdNo(tdbh); |
|
2451 |
// vhx.setBsNo( bsmp.get("bussinessNo")+""); |
|
2452 |
// vhxper.insert(vhx); |
|
2453 |
// } |
|
2454 |
// if(vhx1.getFd_num()==1){ |
|
2455 |
// vhxper.delbyIDs(vhx1.getVehicleId(), vhx1.getXstdNo()); |
|
2456 |
// }else{ |
|
2457 |
// vhx1.setFd_num(vhx1.getFd_num()-1); |
|
2458 |
// vhx1.setFd_weight(BigDecimalfiter.subscal(vhx1.getFd_weight(), |
|
2459 |
// wtdmx.getTdmx_mz(), Contants.scale)); |
|
2460 |
// vhxper.update(vhx1); |
|
2461 |
// } |
|
2462 |
// fbi.setTdmx_cph(zcvehicleID); |
|
2463 |
// } |
|
2464 |
//// fbi.setTdmx_cph(zcvehicleID); |
|
2465 |
// fbi.setTdmx_tdbh(tdbh); |
|
2466 |
// fbi.setTdmx_fdbz(2); |
|
2467 |
// fbi.setTdmx_fdywbh(bsmp.get("bussinessNo")+"" ); |
|
2468 |
// fbi.setTdmx_zccph(zcvehicleID); |
|
2469 |
// fbi.setTdmx_sfzc(1); |
|
2470 |
// fbi.setBarcode(zc.getTmh()); |
|
2471 |
// bsiper.update(fbi); |
|
2472 |
// }else{ |
|
2473 |
// fbi=new Fd_Bsheetitem(); |
|
2474 |
// fbi.setId(UUID.randomUUID()+""); |
|
2475 |
// fbi.setCompanyName(""); |
|
2476 |
// fbi.setCompanyNo(""); |
|
2477 |
// fbi.setCreateid(""); |
|
2478 |
// fbi.setBarcode(zc.getTmh()); |
|
2479 |
// fbi.setCtime(new Date()); |
|
2480 |
// fbi.setTdmx_cph(zcvehicleID); |
|
2481 |
// fbi.setTdmx_tdbh(tdbh); |
|
2482 |
// fbi.setTdmx_fdbz(2); |
|
2483 |
// fbi.setTdmx_fdywbh(bsmp.get("bussinessNo")+"" ); |
|
2484 |
// fbi.setTdmx_zccph(zcvehicleID); |
|
2485 |
// fbi.setTdmx_sfzc(1); |
|
2486 |
// bsiper.insert(fbi); |
|
2487 |
// //该装车车辆添加了这个提单的分单 |
|
2488 |
// if(vhx!=null){ |
|
2489 |
// vhx.setFd_num(vhx.getFd_num()+1); |
|
2490 |
// vhx.setFd_weight(BigDecimalfiter.addscal(vhx.getFd_weight(),wtdmx.getTdmx_mz() |
|
2491 |
// ,Contants.scale )); |
|
2492 |
// vhxper.update(vhx); |
|
2493 |
// }else{ |
|
2494 |
// vhx=new Vehicle_XSTD(); |
|
2495 |
// vhx.setFd_num(1); |
|
2496 |
// vhx.setFd_weight(BigDecimalfiter.addscal(wtdmx.getTdmx_mz(), 0, |
|
2497 |
// Contants.scale)); |
|
2498 |
// vhx.setVehicleId(zcvehicleID); |
|
2499 |
// vhx.setXstdNo(tdbh); |
|
2500 |
// vhxper.insert(vhx); |
|
2501 |
// } |
|
2502 |
// } |
|
2503 |
// |
|
2504 |
// |
|
2505 |
// |
|
2506 |
// //添加一卡通明细; |
|
2507 |
// Map<String, Object> mm=new HashMap<String, Object>(); |
|
2508 |
// mm.put("id", UUID.randomUUID()+""); |
|
2509 |
// mm.put("bussinessNo",bsmp.get("bussinessNo")+"" ); |
|
2510 |
// mm.put("name", wtdmx.getTdmx_wlmc()); |
|
2511 |
// mm.put("materielNo",wtdmx.getTdmx_wlbh() ); |
|
2512 |
// mm.put("norms",wtdmx.getTdmx_ggxh() ); |
|
2513 |
// mm.put("unitname", "Kg"); |
|
2514 |
// mm.put("num", 1); |
|
2515 |
// mm.put("note", null); |
|
2516 |
// mm.put("weight", BigDecimalfiter.mulcon(wtdmx.getTdmx_jz(), 1000, |
|
2517 |
// Contants.scale)); |
|
2518 |
// mm.put("price", 0); |
|
2519 |
// mm.put("preweight",BigDecimalfiter.mulcon(wtdmx.getTdmx_jz(), 1000, |
|
2520 |
// Contants.scale)); |
|
2521 |
// mm.put("pici", pch); |
|
2522 |
// mm.put("hejin", wtdmx.getTdmx_hjzt()); |
|
2523 |
// mm.put("gross",BigDecimalfiter.mulcon(wtdmx.getTdmx_mz(), 1000, |
|
2524 |
// Contants.scale) ); |
|
2525 |
// mm.put("taotong","" ); |
|
2526 |
// mm.put("taotongWeight", BigDecimalfiter.subscal(wtdmx.getTdmx_mz()*1000, |
|
2527 |
// wtdmx.getTdmx_jz()*1000, Contants.scale)); |
|
2528 |
// mm.put("money", 0); |
|
2529 |
// |
|
2530 |
//// mm.put("createid", ); |
|
2531 |
//// mm.put("cname", ); |
|
2532 |
//// mm.put("createid", 0); |
|
2533 |
// mm.put("cdepartid", 0); |
|
2534 |
//// mm.put("cdepart", ); |
|
2535 |
// mm.put("ctime", new Date()); |
|
2536 |
// |
|
2537 |
// mm.put("loadbuild", false); |
|
2538 |
// mm.put("factory", false); |
|
2539 |
// mm.put("fachang", true); |
|
2540 |
// mm.put("fcnum", 0); |
|
2541 |
// mm.put("product_billNo", tdbh); |
|
2542 |
// mm.put("product_serialNo",wtdmx.getTdmx_tdls()); |
|
2543 |
// mm.put("product_otherNo", null); |
|
2544 |
//// mm.put("product_ywrq",wtdmx.gettdmx_ ); |
|
2545 |
// mm.put("product_flh", wtdmx.getTdmx_tdfl()); |
|
2546 |
// mm.put("recompany",wtdmx.getTdmx_shdw() ); |
|
2547 |
//// mm.put("reID", ""); |
|
2548 |
// mm.put("decompany", wtdmx.getTdmx_fhdw()==null?"明泰科技":wtdmx.getTdmx_fhdw()); |
|
2549 |
//// mm.put("deID", ""); |
|
2550 |
// mm.put("rcompany",wtdmx.getTdmx_shdw() ); |
|
2551 |
//// mm.put("rID", ); |
|
2552 |
// mm.put("frombatch", "ERP系统"); |
|
2553 |
// mm.put("forshowindx",1 ); |
|
2554 |
// mm.put("barcode",zc.getTmh()); |
|
2555 |
// mm.put("reserved11",0 ); |
|
2556 |
// mm.put("reserved12",0 ); |
|
2557 |
// mm.put("reserved13",0 ); |
|
2558 |
// mm.put("jsnum",0 ); |
|
2559 |
// |
|
2560 |
// bsper.insertBsi(mm); |
|
2561 |
// } catch (Exception e) { |
|
2562 |
// ddbdao.robackclose(); |
|
2563 |
// throw new |
|
2564 |
// Exception(StringUtils.isEmpty(e.getMessage())?"添加装车信息出错!":e.getMessage()); |
|
2565 |
// }finally{ |
|
2566 |
// ddbdao.close(); |
|
2567 |
// } |
|
2568 |
|
|
2569 |
orr.setCode(0); |
|
2570 |
orr.setItem(true); |
|
2571 |
return orr; |
|
2572 |
} |
|
2573 |
|
|
2574 |
@Override |
|
2575 |
@Transactional(rollbackFor = Exception.class) |
|
2576 |
@Deprecated |
|
2577 |
public ObjectResult<Boolean> sxinCheck(String bsNo, String vehicleId) throws Exception { |
|
2578 |
ObjectResult<Boolean> orr = new ObjectResult<Boolean>(); |
|
2579 |
if (StringUtils.isEmpty(vehicleId)) { |
|
2580 |
orr.setCode(1); |
|
2581 |
orr.setErrmsg("车牌号为空!"); |
|
2582 |
return orr; |
|
2583 |
} |
|
2584 |
if (StringUtils.isEmpty(bsNo)) { |
|
2585 |
orr.setCode(1); |
|
2586 |
orr.setErrmsg("一卡通业务单号为空!"); |
|
2587 |
return orr; |
|
2588 |
} |
|
2589 |
if (true) { |
|
2590 |
orr.setCode(1); |
|
2591 |
orr.setErrmsg("该方法已经弃用!"); |
|
2592 |
return orr; |
|
2593 |
} |
|
2594 |
Fd_Bsheet fdb = fdbsper.getbybsNo(bsNo); |
|
2595 |
if (fdb == null) { |
|
2596 |
orr.setCode(1); |
|
2597 |
orr.setErrmsg("业务单未找到!"); |
|
2598 |
return orr; |
|
2599 |
} |
|
2600 |
Fd_Vehicle fdv = vhper.getByVehicleId(vehicleId); |
|
2601 |
if (fdv == null) { |
|
2602 |
orr.setCode(1); |
|
2603 |
orr.setErrmsg("业务车辆未找到!"); |
|
2604 |
return orr; |
|
2605 |
} |
|
2606 |
try { |
|
2607 |
} catch (Exception e) { |
|
2608 |
throw new Exception(StringUtils.isEmpty(e.getMessage()) ? "销售业务车辆进厂程序出错!" : e.getMessage()); |
|
2609 |
} |
|
2610 |
orr.setCode(0); |
|
2611 |
orr.setItem(true); |
|
2612 |
return orr; |
|
2613 |
} |
|
2614 |
|
|
2615 |
@Override |
|
2616 |
@Deprecated |
|
2617 |
public ObjectResult<Boolean> delZcInfo(Scxt_zcInfo zc) throws Exception { |
|
2618 |
ObjectResult<Boolean> orr = new ObjectResult<Boolean>(); |
|
2619 |
if (zc == null) { |
|
2620 |
orr.setCode(1); |
|
2621 |
orr.setErrmsg("业务参数为空!"); |
|
2622 |
return orr; |
|
2623 |
} |
|
2624 |
if (true) { |
|
2625 |
orr.setCode(1); |
|
2626 |
orr.setErrmsg("该方法已经弃用!"); |
|
2627 |
return orr; |
|
2628 |
} |
|
2629 |
String tmh = zc.getTmh();// 条码号 |
|
2630 |
String cph = zc.getCph();// 车牌号 |
|
2631 |
String cardno = zc.getYktkh();// 一卡通卡号 |
|
2632 |
Map<String, Object> cdi = yktmper.getcardinuse(cardno); |
|
2633 |
if (cdi == null) { |
|
2634 |
orr.setCode(1); |
|
2635 |
orr.setErrmsg("该卡一卡通未找到,请确认该卡是否正确!"); |
|
2636 |
return orr; |
|
2637 |
} |
|
2638 |
if (cdi.get("numberplates") == null) { |
|
2639 |
orr.setCode(1); |
|
2640 |
orr.setErrmsg("该卡没有配置车牌号,请确认该卡是否可用!"); |
|
2641 |
return orr; |
|
2642 |
} |
|
2643 |
Fd_Vehicle fdv = vhper.getByVehicleId(cph); |
|
2644 |
if (fdv == null) { |
|
2645 |
orr.setCode(1); |
|
2646 |
orr.setErrmsg("未找到该分单车牌号!"); |
|
2647 |
return orr; |
|
2648 |
} |
|
2649 |
Map<String, Object> bsmp = null;//bsper.getbsbyBt(cph, Contants.cpxsBtNo, Serviceenum.在办, Contants.kjSdepartNo); |
|
2650 |
if (bsmp == null) { |
|
2651 |
orr.setCode(1); |
|
2652 |
orr.setErrmsg("该车辆没有找到在办的一卡通业务单!"); |
|
2653 |
return orr; |
|
2654 |
} |
|
2655 |
if (StringUtils.isEmpty(bsmp.get("bussinessNo") + "")) { |
|
2656 |
orr.setCode(1); |
|
2657 |
orr.setErrmsg("一卡通业务单未找到!"); |
|
2658 |
return orr; |
|
2659 |
} |
|
2660 |
int wdi = yktmper.getweight_doc(bsmp.get("bussinessNo") + ""); |
|
2661 |
if (wdi <= 0) { |
|
2662 |
orr.setCode(1); |
|
2663 |
orr.setErrmsg("该车辆还未称重,请先去磅房称重!"); |
|
2664 |
return orr; |
|
2665 |
} |
|
2666 |
// Fd_Bsheetitem fd_b=bsiper.getbyNoandCode(tmh, bsmp.get("bussinessNo")+"" ); |
|
2667 |
// if(fd_b!=null){ |
|
2668 |
// String tdNo=fd_b.getTdmx_tdbh();//提单编号 |
|
2669 |
// bsper.delbysibyBarcode(tmh, bsmp.get("bussinessNo")+"" ); |
|
2670 |
// Vehicle_XSTD v_x=vhxper.getbyIDs(cph, tdNo); |
|
2671 |
// if(v_x!=null){ |
|
2672 |
// if(v_x.getFd_num()>1){ |
|
2673 |
// v_x.setFd_num(v_x.getFd_num()-1); |
|
2674 |
// v_x.setFd_weight(BigDecimalfiter.subscal(v_x.getFd_weight(), |
|
2675 |
// fd_b.getTdmx_mz(), Contants.scale)); |
|
2676 |
// vhxper.update(v_x); |
|
2677 |
// fdv.setStatus(VehicleStatus.已装车); |
|
2678 |
// vhper.update(fdv); |
|
2679 |
// }else{ |
|
2680 |
// Map<String, Object> cc=vhxper.getbyVehcleId(cph, v_x.getBsNo()); |
|
2681 |
// if(cc!=null){ |
|
2682 |
// if(cc.get("fd_nums")!=null){ |
|
2683 |
// int fd_nums=Integer.parseInt(cc.get("fd_nums")+""); |
|
2684 |
// if(fd_nums>1){ |
|
2685 |
// fdv.setStatus(VehicleStatus.已装车); |
|
2686 |
// vhper.update(fdv); |
|
2687 |
// }else{ |
|
2688 |
// vhxper.delbyIDs(cph, tdNo); |
|
2689 |
// fdv.setStatus(VehicleStatus.已进厂); |
|
2690 |
// vhper.update(fdv); |
|
2691 |
// } |
|
2692 |
// }else{ |
|
2693 |
// vhxper.delbyIDs(cph, tdNo); |
|
2694 |
// fdv.setStatus(VehicleStatus.已进厂); |
|
2695 |
// vhper.update(fdv); |
|
2696 |
// } |
|
2697 |
// }else{ |
|
2698 |
// vhxper.delbyIDs(cph, tdNo); |
|
2699 |
// fdv.setStatus(VehicleStatus.已进厂); |
|
2700 |
// vhper.update(fdv); |
|
2701 |
// } |
|
2702 |
// } |
|
2703 |
// }else{ |
|
2704 |
// fdv.setStatus(VehicleStatus.已进厂); |
|
2705 |
// vhper.update(fdv); |
|
2706 |
// } |
|
2707 |
// } |
|
2708 |
|
|
2709 |
orr.setCode(0); |
|
2710 |
orr.setItem(true); |
|
2711 |
return orr; |
|
2712 |
} |
|
2713 |
|
|
2714 |
@Override |
|
2715 |
@Deprecated |
|
2716 |
public Map<String, Object> getClInfo(String cardno) { |
|
2717 |
Map<String, Object> mp = new HashMap<String, Object>(); |
|
2718 |
Map<String, Object> cdi = yktmper.getcardinuse(cardno); |
|
2719 |
if (cdi == null) { |
|
2720 |
mp.put("code", 1); |
|
2721 |
mp.put("errmsg", "该卡一卡通未找到,请确认该卡是否发放!"); |
|
2722 |
return mp; |
|
2723 |
} |
|
2724 |
if (cdi.get("numberplates") == null) { |
|
2725 |
mp.put("code", 1); |
|
2726 |
mp.put("errmsg", "该卡没有配置车牌号,请确认该卡是否可用!"); |
|
2727 |
return mp; |
|
2728 |
} |
|
2729 |
String vehicleId = cdi.get("numberplates") + ""; |
|
2730 |
Map<String, Object> bsmap = yktmper.getBsheet(vehicleId, Contants.cpxsBtNo, Serviceenum.在办, "04"); |
|
2731 |
if (bsmap == null) { |
|
2732 |
mp.put("code", 1); |
|
2733 |
mp.put("errmsg", "该卡没有在办的一卡通销售业务单!"); |
|
2734 |
return mp; |
|
2735 |
} |
|
2736 |
Fd_Bsheet fb =null ;//fdbsper.getbyVehicleId(vehicleId, Serviceenum.在办); |
|
2737 |
if (fb == null) { |
|
2738 |
mp.put("code", 1); |
|
2739 |
mp.put("errmsg", "在办分车业务单未找到!"); |
|
2740 |
return mp; |
|
2741 |
} |
|
2742 |
int c = this.yktmper.getweight_doc(fb.getBsNo()); |
|
2743 |
if (c <= 0) { |
|
2744 |
mp.put("code", 1); |
|
2745 |
mp.put("errmsg", "业务单未找到磅单,请先去过磅!"); |
|
2746 |
return mp; |
|
2747 |
} |
|
2748 |
List<Vehicle_XSTD> vxl = new ArrayList<Vehicle_XSTD>(); |
|
2749 |
// List<Vehicle_XSTD> vxl=this.vhxper.getlistbyVehicleId(vehicleId); |
|
2750 |
mp.put("tdbhs", null); |
|
2751 |
if (vxl == null || vxl.size() <= 0) { |
|
2752 |
mp.put("code", 1); |
|
2753 |
mp.put("errmsg", "未找到销售提单!"); |
|
2754 |
return mp; |
|
2755 |
} else { |
|
2756 |
String cc = ""; |
|
2757 |
for (Vehicle_XSTD vx : vxl) { |
|
2758 |
if (StringUtils.isEmpty(cc)) { |
|
2759 |
cc += vx.getXstdNo(); |
|
2760 |
} else { |
|
2761 |
cc += "," + vx.getXstdNo(); |
|
2762 |
} |
|
2763 |
} |
|
2764 |
mp.put("tdbhs", cc); |
|
2765 |
} |
|
2766 |
|
|
2767 |
mp.put("code", 0); |
|
2768 |
mp.put("cph", fb.getVehicleId()); |
|
2769 |
mp.put("sjmc", fb.getDriver()); |
|
2770 |
mp.put("dh", fb.getPhone()); |
|
2771 |
mp.put("ywdh", fb.getBsNo()); |
|
2772 |
return mp; |
|
2773 |
} |
|
2774 |
|
|
2775 |
@Override |
|
2776 |
@Transactional(rollbackFor = Exception.class) |
|
2777 |
@Deprecated |
|
2778 |
public ObjectResult<Boolean> batchSaveZcInfo(String zclist) throws Exception { |
|
2779 |
|
|
2780 |
ObjectResult<Boolean> orr = new ObjectResult<Boolean>(); |
|
2781 |
if (StringUtils.isEmpty(zclist)) { |
|
2782 |
orr.setCode(1); |
|
2783 |
orr.setErrmsg("参数为空不能保存!"); |
|
2784 |
return orr; |
|
2785 |
} |
|
2786 |
if (true) { |
|
2787 |
orr.setCode(1); |
|
2788 |
orr.setErrmsg("方法已经弃用!"); |
|
2789 |
return orr; |
|
2790 |
} |
|
2791 |
// String Lcuuid=UUID.randomUUID()+""; |
|
2792 |
// try { |
|
2793 |
// JsonParser jp=new JsonParser(); |
|
2794 |
// JsonArray ja=jp.parse(zclist).getAsJsonArray(); |
|
2795 |
// int eachline=0; |
|
2796 |
// //是否检查车辆 |
|
2797 |
// boolean checkVehicle=true; |
|
2798 |
// String bussinessNo=""; |
|
2799 |
// Fd_Vehicle fdv=null; |
|
2800 |
// Fd_Bsheet fdb=null; |
|
2801 |
// Map<String, Fd_Erpconfig> dberpmp=new HashMap<String, Fd_Erpconfig>(); |
|
2802 |
// double mzweight=0; |
|
2803 |
// String instanceID=""; |
|
2804 |
// Map<String, Object> lm=new HashMap<String, Object>(); |
|
2805 |
// for (JsonElement tdje : ja) { |
|
2806 |
// if(lm.size()>1){ |
|
2807 |
// break; |
|
2808 |
// } |
|
2809 |
// JsonObject jo=tdje.getAsJsonObject(); |
|
2810 |
// Scxt_zcInfo zc=new Scxt_zcInfo(); |
|
2811 |
// eachline++; |
|
2812 |
// zc=JSONobj.getobj(jo, zc); |
|
2813 |
// if(zc==null){ |
|
2814 |
// continue; |
|
2815 |
// } |
|
2816 |
// String tdNo=zc.getTdbh(); |
|
2817 |
// if(!StringUtils.isEmpty(tdNo)){ |
|
2818 |
// String tdsign=tdNo.split("-")[0]; |
|
2819 |
// if(lm.get(tdsign)==null){ |
|
2820 |
// lm.put(tdsign, "abc"); |
|
2821 |
// } |
|
2822 |
// } |
|
2823 |
// } |
|
2824 |
// if(lm.size()>1){ |
|
2825 |
//// boolean lcboo=ddbdao.getLcmps(Lcuuid); |
|
2826 |
// String dbcheck=DBchecksingleton.setDbc(Lcuuid,false); |
|
2827 |
// if(!Lcuuid.equals(dbcheck)){ |
|
2828 |
// throw new Exception("ERP数据库正在被占用,请重新操作!"); |
|
2829 |
// } |
|
2830 |
// } |
|
2831 |
// List<Fd_Company> fdcl=this.fdcper.getall(); |
|
2832 |
// Map<String, String> fdcm=new HashMap<String, String>(); |
|
2833 |
// if(fdcl!=null){ |
|
2834 |
// for (Fd_Company fdc : fdcl) { |
|
2835 |
// if(!fdc.isHasSPR()){ |
|
2836 |
// fdcm.put(fdc.getCompanyNo(), fdc.getName()); |
|
2837 |
// } |
|
2838 |
// } |
|
2839 |
// } |
|
2840 |
// for (JsonElement je : ja) { |
|
2841 |
// JsonObject jo=je.getAsJsonObject(); |
|
2842 |
// Scxt_zcInfo zc=new Scxt_zcInfo(); |
|
2843 |
// eachline++; |
|
2844 |
// zc=JSONobj.getobj(jo, zc); |
|
2845 |
// if(zc==null){ |
|
2846 |
// continue; |
|
2847 |
// } |
|
2848 |
// |
|
2849 |
// |
|
2850 |
// if(StringUtils.isEmpty(zc.getCph())||StringUtils.isEmpty(zc.getTdbh())||StringUtils.isEmpty(zc.getPch())){ |
|
2851 |
// continue; |
|
2852 |
// } |
|
2853 |
// String dbsign=zc.getTdbh().split("-")[0]; |
|
2854 |
// Fd_Erpconfig erpdb=null; |
|
2855 |
// if(dberpmp.get(dbsign)==null){ |
|
2856 |
// erpdb=erpper.getbySign(dbsign); |
|
2857 |
// if(erpdb==null){ |
|
2858 |
// throw new Exception("提单编号是"+dbsign+"-******* 类型的未配置ERP数据库!"); |
|
2859 |
// } |
|
2860 |
// dberpmp.put(dbsign, erpdb); |
|
2861 |
// }else{ |
|
2862 |
// erpdb=dberpmp.get(dbsign); |
|
2863 |
// } |
|
2864 |
// if(checkVehicle){ |
|
2865 |
// fdv=vhper.getByVehicleId(zc.getCph()); |
|
2866 |
// if(fdv==null){ |
|
2867 |
// throw new Exception("分单系统车牌号:"+zc.getCph()+" 未找到,请确认车辆信息是否正确!"); |
|
2868 |
// } |
|
2869 |
// Map<String, Object> bsmp=bsper.getbsbyBt(zc.getCph(), Contants.cpxsBtNo, |
|
2870 |
// Serviceenum.在办, Contants.ssdepartNo); |
|
2871 |
// if(bsmp==null){ |
|
2872 |
// throw new Exception("车牌号:"+zc.getCph()+" 未找到一卡通业务单!"); |
|
2873 |
// } |
|
2874 |
// bussinessNo=bsmp.get("bussinessNo")+""; |
|
2875 |
// instanceID=bsmp.get("instanceID")==null?"":bsmp.get("instanceID")+""; |
|
2876 |
// fdb=fdbsper.getbybsNo(bussinessNo); |
|
2877 |
// if(fdb==null){ |
|
2878 |
// throw new Exception("车牌号:"+zc.getCph()+" 未找到分单业务单!"); |
|
2879 |
// }else{ |
|
2880 |
// if(!fdb.getVehicleId().equals(zc.getCph())){ |
|
2881 |
// throw new Exception("车牌号:"+zc.getCph()+"与 分单车牌号不一致!"); |
|
2882 |
// } |
|
2883 |
// } |
|
2884 |
// checkVehicle=false; |
|
2885 |
// } |
|
2886 |
// |
|
2887 |
// Vehicle_XSTD vhx=vhxper.getbyIDs(zc.getCph(), zc.getTdbh()); |
|
2888 |
// if(vhx==null){ |
|
2889 |
// throw new Exception("提单编号:"+zc.getTdbh()+"没有分单给车牌号:"+zc.getCph()+" !"); |
|
2890 |
// } |
|
2891 |
// String |
|
2892 |
// url="jdbc:jtds:sqlserver://"+erpdb.getUri()+":"+erpdb.getPost()+";databaseName="+erpdb.getDb(); |
|
2893 |
// Connection con=ddbdao.open(url, erpdb.getUsername(), |
|
2894 |
// erpdb.getPwd(),erpdb.getDbsign()); |
|
2895 |
// if(con==null){ |
|
2896 |
// throw new Exception("ERP数据库链接失败,请检查分单系统ERP配置是否正确!"); |
|
2897 |
// } |
|
2898 |
// String sql=SqlTxt.GYErpXSTDsql+" where EXISTS (SELECT 1 FROM XSTDMX WHERE |
|
2899 |
// XSTDMX_TDLS=XSTD_TDLS AND XSTDMX_CKBZ='0') and a.XSTD_TDBH='"+zc.getTdbh()+"' |
|
2900 |
// and a.XSTD_SHBZ=1 and a.XSTD_TDBZ='LD' "; |
|
2901 |
// Map<String, Object> tdmp=ddbdao.getmapnoclose(sql,erpdb.getDbsign()); |
|
2902 |
// if(tdmp==null){ |
|
2903 |
// throw new Exception("第"+eachline+"行 ,销售提单未找到!"); |
|
2904 |
// } |
|
2905 |
// WaitXSTD wt=new WaitXSTD(); |
|
2906 |
// BeanUtils.populate(wt, tdmp); |
|
2907 |
// |
|
2908 |
// sql=SqlTxt.GYErpXSTDMXsql+" where b.XSTDMX_CKBZ='0' and |
|
2909 |
// a.XSTD_TDBH='"+zc.getTdbh()+"' and b.XSTDMX_PCH='"+zc.getPch()+"' ";//销售提单明细 |
|
2910 |
// Map<String, Object> mxmp=ddbdao.getmapnoclose(sql,erpdb.getDbsign()); |
|
2911 |
// if(mxmp==null){ |
|
2912 |
// throw new Exception("第"+eachline+"行 根据提单号和批次号Erp未找到销售提单明细!"); |
|
2913 |
// } |
|
2914 |
// WaitXSTDMX wtdmx=new WaitXSTDMX(); |
|
2915 |
// BeanUtils.populate(wtdmx, mxmp); |
|
2916 |
// String hj=mxmp.get("hj")==null?"":mxmp.get("hj")+""; |
|
2917 |
// String zt=mxmp.get("zt")==null?"":mxmp.get("zt")+""; |
|
2918 |
// wtdmx.setTdmx_hjzt(hj+"/"+zt); |
|
2919 |
// //如果扫的是没有分单的 |
|
2920 |
// if(wtdmx.getTdmx_fdbz()==0){ |
|
2921 |
// sql=SqlTxt.XGGYErpXSTDMXsql1+" where a.XSTDMX_CKBZ='0' and |
|
2922 |
// b.XSTD_TDBH='"+zc.getTdbh()+"' and a.XSTDMX_PCH='"+zc.getPch()+"' |
|
2923 |
// ";//修改销售提单明细 |
|
2924 |
// List<Object> ll=new ArrayList<Object>(); |
|
2925 |
// ll.add(zc.getCph());//车牌号 |
|
2926 |
// ll.add(2);//分单标志 |
|
2927 |
// ll.add(bussinessNo);//分单单据编号 |
|
2928 |
// ll.add(fdv.getDriver());//司机姓名 |
|
2929 |
// ll.add(fdv.getPhone());//司机联系方式 |
|
2930 |
// ll.add(fdcm.get(vhx.getCompanyNo())==null?"":fdcm.get(vhx.getCompanyNo()));//物流公司名称 |
|
2931 |
//// ll.add(fdcm.get(fdv.getCompanyNo())==null?"":fdcm.get(fdv.getCompanyNo()));//物流公司名称 |
|
2932 |
// ddbdao.modifySql(sql, ll,erpdb.getDbsign()); |
|
2933 |
// |
|
2934 |
// sql=SqlTxt.XGGYErpXSTDsql;//修改销售提单 |
|
2935 |
// ll.clear(); |
|
2936 |
// ll.add(wt.getTd_wfdsl()-1);//未分单数量 |
|
2937 |
// ll.add(BigDecimalfiter.subscal(wt.getTd_wfdzl(), wtdmx.getTdmx_mz(), |
|
2938 |
// Contants.scale));//未分单毛重 |
|
2939 |
// ll.add(zc.getTdbh()); |
|
2940 |
// ddbdao.modifySql(sql, ll,erpdb.getDbsign()); |
|
2941 |
// |
|
2942 |
// //修改vhx |
|
2943 |
// vhx.setFd_num(vhx.getFd_num()+1); |
|
2944 |
// vhx.setFd_weight(BigDecimalfiter.addscal(vhx.getFd_weight(), |
|
2945 |
// wtdmx.getTdmx_mz(), Contants.scale)); |
|
2946 |
// vhxper.update(vhx); |
|
2947 |
// }else{ |
|
2948 |
// sql=SqlTxt.XGGYErpXSTDMXsql2+" where a.XSTDMX_CKBZ='0' and |
|
2949 |
// b.XSTD_TDBH='"+zc.getTdbh()+"' and a.XSTDMX_PCH='"+zc.getPch()+"' |
|
2950 |
// ";//修改销售提单明细 |
|
2951 |
// List<Object> ll=new ArrayList<Object>(); |
|
2952 |
// ll.add(fdv.getDriver());//司机姓名 |
|
2953 |
// ll.add(fdv.getPhone());//司机联系方式 |
|
2954 |
// ll.add(fdcm.get(vhx.getCompanyNo())==null?"":fdcm.get(vhx.getCompanyNo()));//物流公司名称 |
|
2955 |
//// ll.add(fdcm.get(fdv.getCompanyNo())==null?"":fdcm.get(fdv.getCompanyNo()));//物流公司名称 |
|
2956 |
// ddbdao.modifySql(sql, ll,erpdb.getDbsign()); |
|
2957 |
// |
|
2958 |
// if(!zc.getCph().equals(wtdmx.getTdmx_cph())){ |
|
2959 |
// Vehicle_XSTD vhx1=this.vhxper.getbyIDs(wtdmx.getTdmx_cph(), zc.getTdbh()); |
|
2960 |
// if(vhx1!=null){ |
|
2961 |
// vhx1.setFd_num(vhx1.getFd_num()-1); |
|
2962 |
// vhx1.setFd_weight(BigDecimalfiter.subscal(vhx1.getFd_weight(), |
|
2963 |
// wtdmx.getTdmx_mz(), Contants.scale)); |
|
2964 |
// vhxper.update(vhx1); |
|
2965 |
// } |
|
2966 |
// //修改vhx |
|
2967 |
// vhx.setFd_num(vhx.getFd_num()+1); |
|
2968 |
// vhx.setFd_weight(BigDecimalfiter.addscal(vhx.getFd_weight(), |
|
2969 |
// wtdmx.getTdmx_mz(), Contants.scale)); |
|
2970 |
// vhxper.update(vhx); |
|
2971 |
// } |
|
2972 |
// } |
|
2973 |
// //修改fbi |
|
2974 |
// Fd_Bsheetitem fbi=bsiper.getbyLsandFl(wtdmx.getTdmx_tdls(), |
|
2975 |
// wtdmx.getTdmx_tdfl(),zc.getTdbh()); |
|
2976 |
// if(fbi!=null){ |
|
2977 |
// fbi.setTdmx_cph(zc.getCph()); |
|
2978 |
// fbi.setTdmx_tdbh(zc.getTdbh()); |
|
2979 |
// fbi.setTdmx_fdbz(2); |
|
2980 |
// fbi.setTdmx_fdywbh(fdb.getFdsheetNo()); |
|
2981 |
// fbi.setTdmx_zccph(zc.getCph()); |
|
2982 |
// fbi.setTdmx_sfzc(1); |
|
2983 |
// fbi.setBarcode(zc.getTmh()); |
|
2984 |
// bsiper.update(fbi); |
|
2985 |
// }else{ |
|
2986 |
// fbi=new Fd_Bsheetitem(); |
|
2987 |
// fbi.setId(UUID.randomUUID()+""); |
|
2988 |
// fbi.setCompanyName(fdb.getCompanyName()); |
|
2989 |
// fbi.setCompanyNo(fdb.getCompanyNo()); |
|
2990 |
// fbi.setCreateid(fdb.getCreateid()); |
|
2991 |
// fbi.setBarcode(zc.getTmh()); |
|
2992 |
// fbi.setCtime(new Date()); |
|
2993 |
// fbi.setTdmx_cph(zc.getCph()); |
|
2994 |
// fbi.setTdmx_tdbh(zc.getTdbh()); |
|
2995 |
// fbi.setTdmx_fdbz(2); |
|
2996 |
// fbi.setTdmx_fdywbh(fdb.getFdsheetNo()); |
|
2997 |
// fbi.setTdmx_zccph(zc.getCph()); |
|
2998 |
// fbi.setTdmx_sfzc(1); |
|
2999 |
// bsiper.insert(fbi); |
|
3000 |
// } |
|
3001 |
// if(fdv.getStatus()!=VehicleStatus.已进厂){ |
|
3002 |
// fdv.setStatus(VehicleStatus.已进厂); |
|
3003 |
// vhper.update(fdv); |
|
3004 |
// } |
|
3005 |
// |
|
3006 |
// //添加一卡通明细; |
|
3007 |
// Map<String, Object> mm=new HashMap<String, Object>(); |
|
3008 |
// mm.put("id", UUID.randomUUID()+""); |
|
3009 |
// mm.put("bussinessNo",bussinessNo); |
|
3010 |
// mm.put("name", wtdmx.getTdmx_wlmc()); |
|
3011 |
// mm.put("materielNo",wtdmx.getTdmx_wlbh() ); |
|
3012 |
// mm.put("norms",wtdmx.getTdmx_ggxh() ); |
|
3013 |
// mm.put("unitname", "Kg"); |
|
3014 |
// mm.put("num", 1); |
|
3015 |
// mm.put("note", null); |
|
3016 |
// mm.put("weight", BigDecimalfiter.mulcon(wtdmx.getTdmx_jz(), 1000, |
|
3017 |
// Contants.scale)); |
|
3018 |
// mm.put("price", 0); |
|
3019 |
// mm.put("preweight",BigDecimalfiter.mulcon(wtdmx.getTdmx_jz(), 1000, |
|
3020 |
// Contants.scale)); |
|
3021 |
// mm.put("pici", zc.getPch()); |
|
3022 |
// mm.put("hejin", wtdmx.getTdmx_hjzt()); |
|
3023 |
// mm.put("gross",BigDecimalfiter.mulcon(wtdmx.getTdmx_mz(), 1000, |
|
3024 |
// Contants.scale) ); |
|
3025 |
// mm.put("taotong","" ); |
|
3026 |
// mm.put("taotongWeight", BigDecimalfiter.subscal(wtdmx.getTdmx_mz()*1000, |
|
3027 |
// wtdmx.getTdmx_jz()*1000, Contants.scale)); |
|
3028 |
// mm.put("money", 0); |
|
3029 |
//// mm.put("createid", ); |
|
3030 |
//// mm.put("cname", ); |
|
3031 |
//// mm.put("createid", 0); |
|
3032 |
// mm.put("cdepartid", 0); |
|
3033 |
//// mm.put("cdepart", ); |
|
3034 |
// mm.put("ctime", new Date()); |
|
3035 |
// mm.put("loadbuild", false); |
|
3036 |
// mm.put("factory", false); |
|
3037 |
// mm.put("fachang", true); |
|
3038 |
// mm.put("fcnum", 0); |
|
3039 |
// mm.put("product_billNo", zc.getTdbh()); |
|
3040 |
// mm.put("product_serialNo",wtdmx.getTdmx_tdls()); |
|
3041 |
// mm.put("product_otherNo", null); |
|
3042 |
//// mm.put("product_ywrq",wtdmx.gettdmx_ ); |
|
3043 |
// mm.put("product_flh", wtdmx.getTdmx_tdfl()); |
|
3044 |
// mm.put("recompany",wtdmx.getTdmx_shdw() ); |
|
3045 |
//// mm.put("reID", ""); |
|
3046 |
// mm.put("decompany", wtdmx.getTdmx_fhdw()==null?"明泰科技":wtdmx.getTdmx_fhdw()); |
|
3047 |
//// mm.put("deID", ""); |
|
3048 |
// mm.put("rcompany",wtdmx.getTdmx_shdw() ); |
|
3049 |
//// mm.put("rID", ); |
|
3050 |
// mm.put("frombatch", "ERP系统"); |
|
3051 |
// mm.put("forshowindx",1 ); |
|
3052 |
// mm.put("barcode",zc.getTmh()); |
|
3053 |
// mm.put("reserved11",0 ); |
|
3054 |
// mm.put("reserved12",0 ); |
|
3055 |
// mm.put("reserved13",0 ); |
|
3056 |
// mm.put("jsnum",0 ); |
|
3057 |
// Map<String, Object> mrc=this.bsper.getbsi(zc.getPch(), bussinessNo); |
|
3058 |
// if(mrc==null){ |
|
3059 |
// bsper.insertBsi(mm); |
|
3060 |
// }else{ |
|
3061 |
// mm.put("id", mrc.get("id")+""); |
|
3062 |
// bsper.updateBsi(mm); |
|
3063 |
// } |
|
3064 |
// mzweight=BigDecimalfiter.addscal(mzweight, |
|
3065 |
// BigDecimalfiter.mulcon(wtdmx.getTdmx_mz(), 1000, Contants.scale), |
|
3066 |
// Contants.scale); |
|
3067 |
// } |
|
3068 |
// |
|
3069 |
// if(mzweight>0&&!StringUtils.isEmpty(instanceID)){ |
|
3070 |
// Map<String, Object> mm=this.yktmper.getweight_docgt(bussinessNo); |
|
3071 |
// if(mm!=null){ |
|
3072 |
// double gross=Double.parseDouble(mm.get("gross")+""); |
|
3073 |
// double tare=Double.parseDouble(mm.get("tare")+""); |
|
3074 |
// if(gross>0&& tare>0){ |
|
3075 |
// Task tk=this.acpser.findTaskByInstanceID(instanceID, |
|
3076 |
// Contants.weightTaskName); |
|
3077 |
// Map<String, Object> mcm=new HashMap<String,Object>(); |
|
3078 |
// if(tk!=null){ |
|
3079 |
// if(((gross-tare)-mzweight>Contants.upweight)||(mzweight-(gross-tare))<Contants.loawweight){ |
|
3080 |
// mcm.put("ckbc",1); |
|
3081 |
// }else{ |
|
3082 |
// mcm.put("ckbc",0); |
|
3083 |
// } |
|
3084 |
// this.acpser.completeTask(tk.getId(), "admin", mcm); |
|
3085 |
// } |
|
3086 |
// } |
|
3087 |
// } |
|
3088 |
// |
|
3089 |
// } |
|
3090 |
// |
|
3091 |
// |
|
3092 |
// } catch (Exception e) { |
|
3093 |
// ddbdao.robackclose(); |
|
3094 |
// throw new |
|
3095 |
// Exception(StringUtils.isEmpty(e.getMessage())?"装车批量保存出错!":e.getMessage()); |
|
3096 |
// }finally{ |
|
3097 |
// ddbdao.close(); |
|
3098 |
//// ddbdao.removeLc(Lcuuid); |
|
3099 |
// DBchecksingleton.setDbc(Lcuuid,true); |
|
3100 |
// } |
|
3101 |
|
|
3102 |
orr.setCode(0); |
|
3103 |
orr.setItem(true); |
|
3104 |
return orr; |
|
3105 |
} |
|
3106 |
|
|
3107 |
@Override |
|
3108 |
@Transactional(rollbackFor = Exception.class) |
|
3109 |
@Deprecated |
|
3110 |
public ObjectResult<Boolean> batchdelZcInfo(String zcist) throws Exception { |
|
3111 |
ObjectResult<Boolean> orr = new ObjectResult<Boolean>(); |
|
3112 |
if (zcist == null) { |
|
3113 |
orr.setCode(1); |
|
3114 |
orr.setErrmsg("业务参数为空!"); |
|
3115 |
return orr; |
|
3116 |
} |
|
3117 |
if (true) { |
|
3118 |
orr.setCode(1); |
|
3119 |
orr.setErrmsg("该方法已经弃用!"); |
|
3120 |
return orr; |
|
3121 |
} |
|
3122 |
|
|
3123 |
// try { |
|
3124 |
// JsonParser jp=new JsonParser(); |
|
3125 |
// JsonArray ja=jp.parse(zcist).getAsJsonArray(); |
|
3126 |
// boolean checkvehicle=true; |
|
3127 |
// Fd_Vehicle fdv=null; |
|
3128 |
// String bussinessNo=""; |
|
3129 |
// Fd_Bsheet fdb=null; |
|
3130 |
// for (JsonElement je : ja) { |
|
3131 |
// JsonObject jo=je.getAsJsonObject(); |
|
3132 |
// Scxt_zcInfo zc=new Scxt_zcInfo(); |
|
3133 |
// zc=JSONobj.getobj(jo, zc); |
|
3134 |
// if(zc==null){ |
|
3135 |
// continue; |
|
3136 |
// } |
|
3137 |
// if(StringUtils.isEmpty(zc.getCph())||StringUtils.isEmpty(zc.getYktkh())||StringUtils.isEmpty(zc.getPch())){ |
|
3138 |
// continue; |
|
3139 |
// } |
|
3140 |
// String vehicleId=zc.getCph();//车牌号 |
|
3141 |
// String cardno=zc.getYktkh();//卡号 |
|
3142 |
// String pch=zc.getPch();//批次号 |
|
3143 |
// if(checkvehicle){ |
|
3144 |
// Map<String, Object> cdi=yktmper.getcardinuse(cardno); |
|
3145 |
// if(cdi==null){ |
|
3146 |
// throw new Exception("卡号一卡通未找到,请确认该卡是否正确!"); |
|
3147 |
// }else if(!vehicleId.equals(cdi.get("numberplates"+""))){ |
|
3148 |
// throw new Exception("卡号与车牌号不对应,请确认卡号或者车牌号是否正确!"); |
|
3149 |
// } |
|
3150 |
// fdv=vhper.getByVehicleId(zc.getCph()); |
|
3151 |
// if(fdv==null){ |
|
3152 |
// throw new Exception("分单系统车牌号:"+zc.getCph()+" 未找到,请确认车辆信息是否正确!"); |
|
3153 |
// } |
|
3154 |
// Map<String, Object> bsmp=bsper.getbsbyBt(zc.getCph(), Contants.cpxsBtNo, |
|
3155 |
// Serviceenum.在办, Contants.ssdepartNo); |
|
3156 |
// if(bsmp==null){ |
|
3157 |
// throw new Exception("车牌号:"+zc.getCph()+" 未找到一卡通业务单!"); |
|
3158 |
// } |
|
3159 |
// bussinessNo=bsmp.get("bussinessNo")+""; |
|
3160 |
// fdb=fdbsper.getbybsNo(bussinessNo); |
|
3161 |
// if(fdb==null){ |
|
3162 |
// throw new Exception("车牌号:"+zc.getCph()+" 未找到分单业务单!"); |
|
3163 |
// }else{ |
|
3164 |
// if(!fdb.getVehicleId().equals(zc.getCph())){ |
|
3165 |
// throw new Exception("车牌号:"+zc.getCph()+"与 分单车牌号不一致!"); |
|
3166 |
// } |
|
3167 |
// } |
|
3168 |
// checkvehicle=false; |
|
3169 |
// } |
|
3170 |
// bsper.delbypchandNo(pch, bussinessNo); |
|
3171 |
// Fd_Bsheetitem fdbi=bsiper.getbypchandNo(bussinessNo, pch); |
|
3172 |
// if(fdbi!=null){ |
|
3173 |
// fdbi.setTdmx_sfzc(0); |
|
3174 |
// fdbi.setTdmx_zccph(""); |
|
3175 |
// bsiper.update(fdbi); |
|
3176 |
// } |
|
3177 |
// } |
|
3178 |
// |
|
3179 |
// //修改车辆信息 |
|
3180 |
// List<Map<String, Object>> bsill=bsper.getbsibyNo(bussinessNo); |
|
3181 |
// if(bsill==null||bsill.size()<=0){ |
|
3182 |
// fdv.setStatus(VehicleStatus.已进厂); |
|
3183 |
// vhper.update(fdv); |
|
3184 |
// } |
|
3185 |
// } catch (Exception e) { |
|
3186 |
// throw new |
|
3187 |
// Exception(StringUtils.isEmpty(e.getMessage())?"分单系统批量删除装车出错!":e.getMessage()); |
|
3188 |
// } |
|
3189 |
orr.setCode(0); |
|
3190 |
orr.setItem(true); |
|
3191 |
return orr; |
|
3192 |
} |
|
3193 |
|
|
3194 |
@Override |
|
3195 |
public void changeMxWlgs(List<FdMxWlgs> fdMxWlgsList) throws Exception { |
|
3196 |
// if(1==1) throw new Exception("就是一个提示!---"); |
|
3197 |
if(fdMxWlgsList!=null) { |
|
3198 |
List<Fd_XSTDMX> updateFd_XSTDMX = new ArrayList<>(); |
|
3199 |
String tdmx_tdfls = fdMxWlgsList.stream().map(FdMxWlgs::getTdmxTdfl).collect(Collectors.joining("','")); |
|
3200 |
List<Fd_XSTDMX> fd_xstdmxes = null; |
|
3201 |
// 提单流水为主键的Map,存放去掉的数量和重量,需要还回去 |
|
3202 |
Map<String,Map<String,Object>> tdlsMap = new HashedMap(); |
|
3203 |
if(StringUtils.isNotBlank(tdmx_tdfls)) { |
|
3204 |
// 根据单号查找已派车的业务单,判断业务单是否发卡,已发卡不能修改,返回错误;前端应该也做限制 |
|
3205 |
tdmx_tdfls = "'" + tdmx_tdfls + "'"; |
|
3206 |
fd_xstdmxes = fd_xstdmxMapper.gets(tdmx_tdfls); |
|
3207 |
String fdywbhs = fd_xstdmxes.stream().map(Fd_XSTDMX::getTdmx_fdywbh).collect(Collectors.joining("','")); |
|
3208 |
if(StringUtils.isNotBlank(fdywbhs) && !"'null'".equals(fdywbhs)) { |
|
3209 |
fdywbhs = "'" + fdywbhs + "'"; |
|
3210 |
// 如果已经发卡,请联系一卡通 |
|
3211 |
Map<String, Object> map = businessMapper.existsIssueCardByNos(fdywbhs); |
|
3212 |
if (map != null) { |
|
3213 |
throw new Exception("存在已发卡单,请刷新页面后重试!"); |
|
3214 |
} |
|
3215 |
} |
|
3216 |
// 删了单,要把重量和数量还回去;在此遍历一下,下面在session中统一更新 |
|
3217 |
fd_xstdmxes.forEach(fd_xstdmx -> { |
|
3218 |
// 装车标志都是 0 |
|
3219 |
// if(fd_xstdmx.getTdmx_zcbz() == 0) return; |
|
3220 |
// 不存在业务号,则任务没有分单;采用装车标志有问题,不采用。 |
|
3221 |
if(StringUtils.isBlank(fd_xstdmx.getTdmx_fdywbh())) return; |
|
3222 |
if(tdlsMap.get(fd_xstdmx.getTdmx_tdls()) == null ) { |
|
3223 |
tdlsMap.put(fd_xstdmx.getTdmx_tdls(), new HashedMap()); |
|
3224 |
tdlsMap.get(fd_xstdmx.getTdmx_tdls()).put("addFdsl",0); |
|
3225 |
tdlsMap.get(fd_xstdmx.getTdmx_tdls()).put("addFdmz",0d); |
|
3226 |
} |
|
3227 |
Map map = tdlsMap.get(fd_xstdmx.getTdmx_tdls()); |
|
3228 |
int addFdsl = (Integer) map.get("addFdsl"); |
|
3229 |
double addFdmz = (Double) map.get("addFdmz"); |
|
3230 |
|
|
3231 |
addFdsl ++; |
|
3232 |
addFdmz = BigDecimalfiter.addscal(addFdmz, fd_xstdmx.getTdmx_mz(), Contants.scale); |
|
3233 |
map.put("addFdsl",addFdsl); |
|
3234 |
map.put("addFdmz",addFdmz); |
|
3235 |
}); |
|
3236 |
} |
|
3237 |
fdMxWlgsList.forEach(fdMxWlgs -> { |
|
3238 |
Fd_XSTDMX fd_xstdmx = new Fd_XSTDMX(); |
|
3239 |
fd_xstdmx.setTdmx_fdcph(null); |
|
3240 |
fd_xstdmx.setTdmx_zcwlgsName(null); |
|
3241 |
fd_xstdmx.setTdmx_zcphone(null); |
|
3242 |
fd_xstdmx.setTdmx_zcdriver(null); |
|
3243 |
fd_xstdmx.setTdmx_fdwlgsbh(null); |
|
3244 |
fd_xstdmx.setTdmx_fdywbh(null); |
|
3245 |
fd_xstdmx.setTdmx_fdbz(0); |
|
3246 |
fd_xstdmx.setTdmx_zcbz(0); |
|
3247 |
fd_xstdmx.setTdmx_tdfl(fdMxWlgs.getTdmxTdfl()); |
|
3248 |
fd_xstdmx.setTdmx_fdwlgsbh(fdMxWlgs.getWlgsNo()); |
|
3249 |
updateFd_XSTDMX.add(fd_xstdmx); |
|
3250 |
}); |
|
3251 |
try(SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH,false)){ |
|
3252 |
// 删除明细和物流公司关系,并新增 |
|
3253 |
FdMxWlgsMapper mapper = sqlSession.getMapper(FdMxWlgsMapper.class); |
|
3254 |
fdMxWlgsList.forEach(fdMxWlgs -> { // 需要删除相关信息(删除该业务单、删除车辆提单) |
|
3255 |
mapper.delete(fdMxWlgs.getTdmxTdfl()); |
|
3256 |
mapper.insert(fdMxWlgs); |
|
3257 |
}); |
|
3258 |
if(updateFd_XSTDMX != null) { |
|
3259 |
// 更新分单明细项为未分单 |
|
3260 |
Fd_XSTDMXMapper fd_xstdmxMapper = sqlSession.getMapper(Fd_XSTDMXMapper.class); |
|
3261 |
updateFd_XSTDMX.forEach(fd_xstdmx -> fd_xstdmxMapper.updateZCnoFD(fd_xstdmx)); |
|
3262 |
} |
|
3263 |
if(fd_xstdmxes!=null && fd_xstdmxes.size() > 0 ) { |
|
3264 |
Fd_BsheetMapper fd_bsheetMapper = sqlSession.getMapper(Fd_BsheetMapper.class); |
|
3265 |
VehicleXSTDMapper vehicleXSTDMapper = sqlSession.getMapper(VehicleXSTDMapper.class); |
|
3266 |
for (Fd_XSTDMX fd_xstdmx : fd_xstdmxes) { |
|
3267 |
// 根据车牌号和业务号删除分单车辆,如果是拼单的情况;是否是拼单,取消这个就行,其他不管。 |
|
3268 |
// 如果配车数量为0可以删除,其他情况,可以-1,把重量也减掉 |
|
3269 |
if(StringUtils.isNotBlank(fd_xstdmx.getTdmx_fdcph()) && StringUtils.isNotBlank(fd_xstdmx.getTdmx_fdywbh())) { |
|
3270 |
List<Vehicle_XSTD> vehicleXSTDs = vehicleXSTDMapper.getlistbyVehicleIdandbsNoGp(fd_xstdmx.getTdmx_fdcph(), fd_xstdmx.getTdmx_fdywbh()); |
|
3271 |
if (vehicleXSTDs != null && vehicleXSTDs.size() == 1) { |
|
3272 |
Vehicle_XSTD vehicleXSTD = vehicleXSTDs.get(0); |
|
3273 |
int num = vehicleXSTD.getFd_num(); |
|
3274 |
if (num <= 1) { |
|
3275 |
vehicleXSTDMapper.delbyVehicleId(fd_xstdmx.getTdmx_fdcph(), fd_xstdmx.getTdmx_fdywbh()); |
|
3276 |
} else { |
|
3277 |
vehicleXSTD.setFd_num(vehicleXSTD.getFd_num() - 1); |
|
3278 |
vehicleXSTD.setFd_weight(BigDecimalfiter.subscal(vehicleXSTD.getFd_weight(), fd_xstdmx.getTdmx_mz(), Contants.scale)); |
|
3279 |
vehicleXSTDMapper.updatewithIDs(vehicleXSTD); |
|
3280 |
} |
|
3281 |
} else { |
|
3282 |
throw new Exception("出现同一辆车的同一业务单出现多个,请检查数据"); |
|
3283 |
} |
|
3284 |
} |
|
3285 |
// vehicleXSTDMapper.delbyVehicleId(fd_xstdmx.getTdmx_fdcph(), fd_xstdmx.getTdmx_fdywbh()); |
|
3286 |
Fd_Bsheet fd_bsheet = fd_bsheetMapper.getbybsNo(fd_xstdmx.getTdmx_fdywbh()); |
|
3287 |
// 删除分单业务 |
|
3288 |
fd_bsheetMapper.delbybsNo(fd_xstdmx.getTdmx_fdywbh()); |
|
3289 |
// 远程删除数量 |
|
3290 |
if(fd_bsheet!=null) { |
|
3291 |
JsonObject jo = new JsonObject(); |
|
3292 |
jo.addProperty("bussinessNo", fd_xstdmx.getTdmx_fdywbh()); |
|
3293 |
jo.addProperty("sdepartNo", fd_bsheet.getSdepartNo()); |
|
3294 |
// 通过接口删除业务单 |
|
3295 |
JsonObject pfob = Wxhtmethod.postJsonStr(Contants.YKTdelYwd_url, jo.toString()); |
|
3296 |
int code = JSONobj.getint(pfob, "code"); |
|
3297 |
if (code != 0) { |
|
3298 |
throw new Exception(JSONobj.getstring(pfob, "errmsg")); |
|
3299 |
} |
|
3300 |
} |
|
3301 |
} |
|
3302 |
// 需要更新提单的重量和数量 |
|
3303 |
Fd_XSTDMapper fdXstdMapper = sqlSession.getMapper(Fd_XSTDMapper.class); |
|
3304 |
tdlsMap.forEach((k, v) -> { |
|
3305 |
Fd_XSTD xstd = fdXstdMapper.get(k); |
|
3306 |
int addFdsl_1 = (Integer) v.get("addFdsl"); |
|
3307 |
double addFdmz_1 = (Double) v.get("addFdmz"); |
|
3308 |
xstd.setTd_tdls(k); |
|
3309 |
xstd.setTd_wfdsl(xstd.getTd_wfdsl() + addFdsl_1); |
|
3310 |
xstd.setTd_wfdzl(BigDecimalfiter.addscal(xstd.getTd_wfdzl(), addFdmz_1, Contants.scale)); |
|
3311 |
fdXstdMapper.updateFD(xstd); |
|
3312 |
}); |
|
3313 |
} |
|
3314 |
sqlSession.commit(); |
|
3315 |
} |
|
3316 |
} |
|
3317 |
} |
|
3318 |
|
|
3319 |
|
|
3320 |
@Resource |
|
3321 |
Fd_XSTDMXMapper fd_xstdmxMapper; |
|
3322 |
@Resource |
|
3323 |
BusinessMapper businessMapper; |
|
3324 |
|
|
3325 |
|
|
3326 |
} |