master
erzhongxmu@hotmail.com 2018-10-31 16:19:30 +08:00
parent c72348da62
commit 3fe711274a
3 changed files with 166 additions and 163 deletions

View File

@ -642,72 +642,81 @@ public class WmOmNoticeHController extends BaseController {
String message = null;
AjaxJson j = new AjaxJson();
message = "读取成功";
String masterbill[] = {"XKN_TEST","XKN_TEST"};
for(int m =0;m<masterbill.length;m++) {
if ("U8".equals(ResourceUtil.getConfigByName("interfacetype"))){
if(StringUtil.isEmpty(formDate)){
formDate = "2011-01-01";
}
yyUtil.getSdvl(formDate);
try {
if (StringUtil.isEmpty(formDate)) {
formDate = "2011-01-01";
}
String master = masterbill[m];
String billclass[] = {"出货单", "采购退货单", "拨出单", "其它出库单", "其它采购出库单"};
for (int i = 0; i < billclass.length; i++) {
Map<String, Object> paramMap = new HashMap<String, Object>();
paramMap.put("lastUpdateTime", formDate);
paramMap.put("pi_class", billclass[i]);
paramMap.put("master", master);
}
if ("UAS".equals(ResourceUtil.getConfigByName("interfacetype"))) {
String masterbill[] = {"XKN_TEST", "XKN_TEST"};
for (int m = 0; m < masterbill.length; m++) {
sdresult billResult = wmIntUtil.getsdBillin(paramMap);
for (int s = 0; s < billResult.getData().size(); s++) {
String imcuscode = billResult.getData().get(s).getPiInoutno();
if (StringUtil.isNotEmpty(imcuscode)) {
WmOmNoticeHEntity wmimh = systemService.findUniqueByProperty(WmOmNoticeHEntity.class, "imCusCode", imcuscode);
if (wmimh == null) {
WmOmNoticeHEntity wmOmNoticeH = new WmOmNoticeHEntity();
List<WmOmNoticeIEntity> wmomNoticeIListnew = new ArrayList<WmOmNoticeIEntity>();
try {
if (StringUtil.isEmpty(formDate)) {
formDate = "2011-01-01";
}
String master = masterbill[m];
String billclass[] = {"出货单", "采购退货单", "拨出单", "其它出库单", "其它采购出库单"};
for (int i = 0; i < billclass.length; i++) {
Map<String, Object> paramMap = new HashMap<String, Object>();
paramMap.put("lastUpdateTime", formDate);
paramMap.put("pi_class", billclass[i]);
paramMap.put("master", master);
wmOmNoticeH.setOmPlatNo(Integer.toString(billResult.getData().get(s).getPiId()));
wmOmNoticeH.setOrderTypeCode("11");
wmOmNoticeH.setCusCode(ResourceUtil.getConfigByName("uas.cuscode"));
String noticeid = getNextNoticeId(wmOmNoticeH.getOrderTypeCode());
wmOmNoticeH.setOmNoticeId(noticeid);
wmOmNoticeH.setPiClass(billResult.getData().get(s).getPiClass());
wmOmNoticeH.setPiMaster(master);
wmOmNoticeH.setOcusCode(billResult.getData().get(s).getPiCardcode());
MdCusOtherEntity mdcusother = systemService.findUniqueByProperty(MdCusOtherEntity.class, "keHuBianMa", wmOmNoticeH.getOcusCode());
if (mdcusother != null) {
wmOmNoticeH.setOcusName(mdcusother.getZhongWenQch());
}
wmOmNoticeH.setImCusCode(imcuscode);
for (int k = 0; k < billResult.getData().get(s).getDetail().size(); k++) {
WmOmNoticeIEntity wmi = new WmOmNoticeIEntity();
wmi.setGoodsId(billResult.getData().get(s).getDetail().get(k).getPdProdcode());
MvGoodsEntity mvgoods = systemService.findUniqueByProperty(
MvGoodsEntity.class, "goodsCode", wmi.getGoodsId());
if (mvgoods != null) {
wmi.setGoodsName(mvgoods.getGoodsName());
wmi.setGoodsUnit(mvgoods.getShlDanWei());
sdresult billResult = wmIntUtil.getsdBillin(paramMap);
for (int s = 0; s < billResult.getData().size(); s++) {
String imcuscode = billResult.getData().get(s).getPiInoutno();
if (StringUtil.isNotEmpty(imcuscode)) {
WmOmNoticeHEntity wmimh = systemService.findUniqueByProperty(WmOmNoticeHEntity.class, "imCusCode", imcuscode);
if (wmimh == null) {
WmOmNoticeHEntity wmOmNoticeH = new WmOmNoticeHEntity();
List<WmOmNoticeIEntity> wmomNoticeIListnew = new ArrayList<WmOmNoticeIEntity>();
wmOmNoticeH.setOmPlatNo(Integer.toString(billResult.getData().get(s).getPiId()));
wmOmNoticeH.setOrderTypeCode("11");
wmOmNoticeH.setCusCode(ResourceUtil.getConfigByName("uas.cuscode"));
String noticeid = getNextNoticeId(wmOmNoticeH.getOrderTypeCode());
wmOmNoticeH.setOmNoticeId(noticeid);
wmOmNoticeH.setPiClass(billResult.getData().get(s).getPiClass());
wmOmNoticeH.setPiMaster(master);
wmOmNoticeH.setOcusCode(billResult.getData().get(s).getPiCardcode());
MdCusOtherEntity mdcusother = systemService.findUniqueByProperty(MdCusOtherEntity.class, "keHuBianMa", wmOmNoticeH.getOcusCode());
if (mdcusother != null) {
wmOmNoticeH.setOcusName(mdcusother.getZhongWenQch());
}
wmi.setGoodsProData( DateUtils.str2Date(billResult.getData().get(s).getDetail().get(k).getPdProdmadedate(),DateUtils.date_sdf));
wmi.setGoodsQua(Integer.toString(billResult.getData().get(s).getDetail().get(k).getPdPurcoutqty()));
wmOmNoticeH.setImCusCode(imcuscode);
for (int k = 0; k < billResult.getData().get(s).getDetail().size(); k++) {
WmOmNoticeIEntity wmi = new WmOmNoticeIEntity();
wmi.setGoodsId(billResult.getData().get(s).getDetail().get(k).getPdProdcode());
MvGoodsEntity mvgoods = systemService.findUniqueByProperty(
MvGoodsEntity.class, "goodsCode", wmi.getGoodsId());
if (mvgoods != null) {
wmi.setGoodsName(mvgoods.getGoodsName());
wmi.setGoodsUnit(mvgoods.getShlDanWei());
}
wmi.setGoodsProData(DateUtils.str2Date(billResult.getData().get(s).getDetail().get(k).getPdProdmadedate(), DateUtils.date_sdf));
wmi.setGoodsQua(Integer.toString(billResult.getData().get(s).getDetail().get(k).getPdPurcoutqty()));
// wmi.setGoodsPrdData(billResult.getData().get(s).getDetail().get(k).getPdProdmadedate2User());
wmi.setOtherId(Integer.toString(billResult.getData().get(s).getDetail().get(k).getPdPdno()));
wmi.setOtherId(Integer.toString(billResult.getData().get(s).getDetail().get(k).getPdPdno()));
wmomNoticeIListnew.add(wmi);
wmomNoticeIListnew.add(wmi);
}
wmOmNoticeHService.addMain(wmOmNoticeH, wmomNoticeIListnew);
}
wmOmNoticeHService.addMain(wmOmNoticeH, wmomNoticeIListnew);
} else {
continue;
}
} else {
continue;
}
}
systemService.addLog(message, Globals.Log_Type_UPDATE,
Globals.Log_Leavel_INFO);
} catch (Exception e) {
e.printStackTrace();
message = "读取失败";
throw new BusinessException(e.getMessage());
}
systemService.addLog(message, Globals.Log_Type_UPDATE,
Globals.Log_Leavel_INFO);
} catch (Exception e) {
e.printStackTrace();
message = "读取失败";
throw new BusinessException(e.getMessage());
}
}
j.setMsg(message);

View File

@ -19,10 +19,7 @@ import javax.imageio.stream.FileImageOutputStream;
import javax.servlet.http.HttpServletRequest;
import java.io.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.*;
/**
* User: caoez
@ -43,7 +40,76 @@ public class wmUtil {
}
return list;
}
public static String getNextNoticeid(String orderType){
String noticeid=null;
SystemService systemService =ApplicationContextUtil.getContext().getBean(SystemService.class);
Map<String, Object> countMap = systemService
.findOneForJdbc("SELECT count(*)+1 as count FROM wm_im_notice_h t where TO_DAYS(t.create_date) = TO_DAYS(NOW());");
if (StringUtil.isEmpty(orderType)){
orderType = "01";
}
if (countMap != null) {
if(orderType.equals("03")){
noticeid = "TH"
+ DateUtils.date2Str(new Date(), DateUtils.yyyyMMdd)
+ "-"
+ StringUtil.leftPad(
((Long) countMap.get("count")).intValue(), 4,
'0');
}else if(orderType.equals("01")){
noticeid = "RK"
+ DateUtils.date2Str(new Date(), DateUtils.yyyyMMdd)
+ "-"
+ StringUtil.leftPad(
((Long) countMap.get("count")).intValue(), 4,
'0');
}else if(orderType.equals("04")){
noticeid = "YK"
+ DateUtils.date2Str(new Date(), DateUtils.yyyyMMdd)
+ "-"
+ StringUtil.leftPad(
((Long) countMap.get("count")).intValue(), 4,
'0');
}else if(orderType.equals("09")){
noticeid = "QT"
+ DateUtils.date2Str(new Date(), DateUtils.yyyyMMdd)
+ "-"
+ StringUtil.leftPad(
((Long) countMap.get("count")).intValue(), 4,
'0');
}
}
return noticeid;
}
public static String getNextomNoticeId(String orderType){
SystemService systemService =ApplicationContextUtil.getContext().getBean(SystemService.class);
Map<String, Object> countMap = systemService
.findOneForJdbc("SELECT count(*)+1 as count FROM wm_om_notice_h t where TO_DAYS(t.create_date) = TO_DAYS(NOW());");
String noticeid = null;
if (StringUtil.isEmpty(orderType)){
orderType = "11";
}
if(orderType.equals("19")){
noticeid = "QT"
+ DateUtils.date2Str(new Date(), DateUtils.yyyyMMdd)
+ "-"
+ StringUtil.leftPad(
((Long) countMap.get("count")).intValue(), 4,
'0');
}else {
noticeid = "CK"
+ DateUtils.date2Str(new Date(), DateUtils.yyyyMMdd)
+ "-"
+ StringUtil.leftPad(
((Long) countMap.get("count")).intValue(), 4,
'0');
}
return noticeid;
}
public static String getSysPar(String parType,String username){
String parvalue = null;
try{

View File

@ -4,12 +4,16 @@ import com.alibaba.fastjson.JSONObject;
import com.xiaoleilu.hutool.http.HttpUtil;
import com.zzjee.ba.entity.BaGoodsTypeEntity;
import com.zzjee.ba.entity.BaUnitEntity;
import com.zzjee.md.entity.MdCusOtherEntity;
import com.zzjee.md.entity.MdGoodsEntity;
import com.zzjee.md.entity.MdSupEntity;
import com.zzjee.md.entity.MvGoodsEntity;
import com.zzjee.wm.entity.WmImNoticeHEntity;
import com.zzjee.wm.entity.WmImNoticeIEntity;
import com.zzjee.wm.entity.WmOmNoticeHEntity;
import com.zzjee.wm.entity.WmOmNoticeIEntity;
import com.zzjee.wm.service.WmImNoticeHServiceI;
import com.zzjee.wm.service.WmOmNoticeHServiceI;
import com.zzjee.yongyoubase.openapi4j.exception.OpenAPIException;
import com.zzjee.yongyoubase.openapi4j.service.*;
import com.alibaba.fastjson.JSONArray;
@ -177,7 +181,7 @@ public class yyUtil {
List<WmImNoticeIEntity> wmImNoticeIListnew = new ArrayList<WmImNoticeIEntity>();
wmImNoticeH.setOrderTypeCode("01");
String noticeid = yyUtil.getNextNoticeid(wmImNoticeH.getOrderTypeCode());
String noticeid = wmUtil.getNextNoticeid(wmImNoticeH.getOrderTypeCode());
wmImNoticeH.setCusCode(ResourceUtil.getConfigByName("yy.cuscode"));
wmImNoticeH.setNoticeId(noticeid);
@ -226,135 +230,59 @@ public class yyUtil {
}
private static String getNextNoticeid(String orderType){
String noticeid=null;
SystemService systemService =ApplicationContextUtil.getContext().getBean(SystemService.class);
Map<String, Object> countMap = systemService
.findOneForJdbc("SELECT count(*)+1 as count FROM wm_im_notice_h t where TO_DAYS(t.create_date) = TO_DAYS(NOW());");
if (StringUtil.isEmpty(orderType)){
orderType = "01";
}
if (countMap != null) {
if(orderType.equals("03")){
noticeid = "TH"
+ DateUtils.date2Str(new Date(), DateUtils.yyyyMMdd)
+ "-"
+ StringUtil.leftPad(
((Long) countMap.get("count")).intValue(), 4,
'0');
}else if(orderType.equals("01")){
noticeid = "RK"
+ DateUtils.date2Str(new Date(), DateUtils.yyyyMMdd)
+ "-"
+ StringUtil.leftPad(
((Long) countMap.get("count")).intValue(), 4,
'0');
}else if(orderType.equals("04")){
noticeid = "YK"
+ DateUtils.date2Str(new Date(), DateUtils.yyyyMMdd)
+ "-"
+ StringUtil.leftPad(
((Long) countMap.get("count")).intValue(), 4,
'0');
}else if(orderType.equals("09")){
noticeid = "QT"
+ DateUtils.date2Str(new Date(), DateUtils.yyyyMMdd)
+ "-"
+ StringUtil.leftPad(
((Long) countMap.get("count")).intValue(), 4,
'0');
}
}
return noticeid;
}
private static String getNextomNoticeId(String orderType){
SystemService systemService =ApplicationContextUtil.getContext().getBean(SystemService.class);
Map<String, Object> countMap = systemService
.findOneForJdbc("SELECT count(*)+1 as count FROM wm_om_notice_h t where TO_DAYS(t.create_date) = TO_DAYS(NOW());");
String noticeid = null;
if (StringUtil.isEmpty(orderType)){
orderType = "11";
}
if(orderType.equals("19")){
noticeid = "QT"
+ DateUtils.date2Str(new Date(), DateUtils.yyyyMMdd)
+ "-"
+ StringUtil.leftPad(
((Long) countMap.get("count")).intValue(), 4,
'0');
}else {
noticeid = "CK"
+ DateUtils.date2Str(new Date(), DateUtils.yyyyMMdd)
+ "-"
+ StringUtil.leftPad(
((Long) countMap.get("count")).intValue(), 4,
'0');
}
return noticeid;
}
public static void getSdvl(String indate) {
// / PO_Pomain 采购订单主表
// PO_Podetails 采购订单子表
String dbKey= ResourceUtil.getConfigByName("yydbkey");
List<Map<String, Object>> result=null;
List<Map<String, Object>> resultdetail=null;
String querySql = "select * from PO_Pomain where dpodate = '"+indate+"'";
String querySql = "select * from DispatchList where cvouchtype = '05' and ddate = '"+indate+"'";
Map queryparams = new LinkedHashMap<String,Object>();
SystemService systemService =ApplicationContextUtil.getContext().getBean(SystemService.class);
WmImNoticeHServiceI wmImNoticeHService =ApplicationContextUtil.getContext().getBean(WmImNoticeHServiceI.class);
WmOmNoticeHServiceI wmOmNoticeHService =ApplicationContextUtil.getContext().getBean(WmOmNoticeHServiceI.class);
if(StringUtils.isNotBlank(dbKey)) {
result = DynamicDBUtil.findList(dbKey, SqlUtil.jeecgCreatePageSql(dbKey, querySql, queryparams, 1, 1000000));
}
if (result!=null&&result.size()>0) {
for (int i = 0; i < result.size(); i++) {
Map<String, Object> prodbo = result.get(i);
String poid = prodbo.get("poid").toString();
if (StringUtil.isNotEmpty(poid)) {
WmImNoticeHEntity wmimh = systemService.findUniqueByProperty(WmImNoticeHEntity.class, "imCusCode", poid);
String imcuscode = prodbo.get("DLID").toString();
if (StringUtil.isNotEmpty(imcuscode)) {
WmOmNoticeHEntity wmimh = systemService.findUniqueByProperty(WmOmNoticeHEntity.class, "imCusCode", imcuscode);
if (wmimh == null) {
WmImNoticeHEntity wmImNoticeH = new WmImNoticeHEntity();
List<WmImNoticeIEntity> wmImNoticeIListnew = new ArrayList<WmImNoticeIEntity>();
WmOmNoticeHEntity wmOmNoticeH = new WmOmNoticeHEntity();
List<WmOmNoticeIEntity> wmomNoticeIListnew = new ArrayList<WmOmNoticeIEntity>();
wmOmNoticeH.setOrderTypeCode("11");
wmOmNoticeH.setCusCode(ResourceUtil.getConfigByName("yy.cuscode"));
String noticeid = wmUtil.getNextomNoticeId(wmOmNoticeH.getOrderTypeCode());
wmOmNoticeH.setOmNoticeId(noticeid);
wmOmNoticeH.setImCusCode(imcuscode);
try{
wmOmNoticeH.setOmBeizhu(prodbo.get("cMemo").toString());
wmImNoticeH.setOrderTypeCode("01");
String noticeid = yyUtil.getNextNoticeid(wmImNoticeH.getOrderTypeCode());
}catch (Exception e){
wmImNoticeH.setCusCode(ResourceUtil.getConfigByName("yy.cuscode"));
wmImNoticeH.setNoticeId(noticeid);
// wmImNoticeH.setPlatformCode(Integer.toString(billResult.getData().get(s).getPiId()));
// wmImNoticeH.setPiClass(billResult.getData().get(s).getPiClass());
// wmImNoticeH.setPiMaster(master);
// wmImNoticeH.setSupCode(billResult.getData().get(s).getPiCardcode());
// MdSupEntity mdsup = systemService.findUniqueByProperty(MdSupEntity.class, "gysBianMa", wmImNoticeH.getSupCode());
// if (mdsup != null) {
// wmImNoticeH.setSupName(mdsup.getZhongWenQch());
// }
wmImNoticeH.setImCusCode(poid);
String querySqldetail = "select * from PO_Podetails where poid = '"+poid+"'";
}
String querySqldetail = "select * from DispatchLists where DLID = '"+imcuscode+"'";
if (resultdetail!=null){
resultdetail.clear();
}
resultdetail = DynamicDBUtil.findList(dbKey, SqlUtil.jeecgCreatePageSql(dbKey, querySqldetail, queryparams, 1, 1000000));
for (int k = 0; k < resultdetail.size(); k++) {
WmImNoticeIEntity wmi = new WmImNoticeIEntity();
Map<String, Object> proddet = result.get(i);
wmi.setGoodsCode(proddet.get("cInvCode").toString());
WmOmNoticeIEntity wmi = new WmOmNoticeIEntity();
Map<String, Object> proddet = resultdetail.get(k);
wmi.setGoodsId(proddet.get("cInvCode").toString());
MvGoodsEntity mvgoods = systemService.findUniqueByProperty(
MvGoodsEntity.class, "goodsCode", wmi.getGoodsCode());
MvGoodsEntity.class, "goodsCode", wmi.getGoodsId());
if (mvgoods != null) {
wmi.setGoodsName(mvgoods.getGoodsName());
wmi.setGoodsUnit(mvgoods.getShlDanWei());
}
wmi.setGoodsCount(proddet.get("iQuantity").toString());
// wmi.setGoodsPrdData(billResult.getData().get(s).getDetail().get(k).getPdProdmadedate2User());
// wmi.setOtherId();
wmImNoticeIListnew.add(wmi);
wmi.setGoodsQua(Double.toString(new BigDecimal(proddet.get("iQuantity").toString()).setScale(0, RoundingMode.UP).doubleValue()));
wmomNoticeIListnew.add(wmi);
}
wmImNoticeHService.addMain(wmImNoticeH, wmImNoticeIListnew);
wmOmNoticeHService.addMain(wmOmNoticeH, wmomNoticeIListnew);
}
} else {
continue;