删除接口-进货-出货

master
erzhongxmu 2023-05-04 15:31:26 +08:00
parent 1751c6d2a5
commit cfdb53898d
5 changed files with 1 additions and 428 deletions

View File

@ -3,12 +3,9 @@ import com.zzjee.md.entity.MdCusOtherEntity;
import com.zzjee.md.service.MdCusOtherServiceI;
import java.util.ArrayList;
import java.util.List;
import java.text.SimpleDateFormat;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.zzjee.wmutil.dsc.dscUtil;
import com.zzjee.wmutil.wmIntUtil;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
@ -20,42 +17,30 @@ import org.springframework.web.servlet.ModelAndView;
import org.jeecgframework.core.common.controller.BaseController;
import org.jeecgframework.core.common.exception.BusinessException;
import org.jeecgframework.core.common.hibernate.qbc.CriteriaQuery;
import org.jeecgframework.core.common.model.common.TreeChildCount;
import org.jeecgframework.core.common.model.json.AjaxJson;
import org.jeecgframework.core.common.model.json.DataGrid;
import org.jeecgframework.core.constant.Globals;
import org.jeecgframework.core.util.StringUtil;
import org.jeecgframework.tag.core.easyui.TagUtil;
import org.jeecgframework.web.system.pojo.base.TSDepart;
import org.jeecgframework.web.system.service.SystemService;
import org.jeecgframework.core.util.MyBeanUtils;
import java.io.OutputStream;
import org.jeecgframework.core.util.BrowserUtils;
import org.jeecgframework.poi.excel.ExcelExportUtil;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.entity.TemplateExportParams;
import org.jeecgframework.poi.excel.entity.vo.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.vo.TemplateExcelConstants;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.jeecgframework.core.util.ResourceUtil;
import java.io.IOException;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import java.util.Map;
import java.util.HashMap;
import org.jeecgframework.core.util.ExceptionUtil;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;

View File

@ -50,7 +50,6 @@ import org.springframework.web.util.UriComponentsBuilder;
import com.zzjee.md.entity.MdSupEntity;
import com.zzjee.md.service.MdSupServiceI;
import com.zzjee.wmutil.wmIntUtil;
/**
* @Title: Controller
@ -201,28 +200,7 @@ public class MdSupController extends BaseController {
j.setMsg(message);
return j;
}
@RequestMapping(params = "doGet")
@ResponseBody
public AjaxJson dogetfromother(String formDate, HttpServletRequest request) {
String message = null;
AjaxJson j = new AjaxJson();
message = "商品信息读取成功";
try {
if(StringUtil.isEmpty(formDate)){
formDate = "2011-01-01";
}
wmIntUtil.getSup(formDate);
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);
return j;
}
/**
*
*

View File

@ -2411,167 +2411,7 @@ public class WmImNoticeHController extends BaseController {
j.setMsg(message);
return j;
}
@RequestMapping(params = "doGet")
@ResponseBody
public AjaxJson dogetfromother(String formDate, HttpServletRequest request) {
String message = null;
AjaxJson j = new AjaxJson();
message = "读取成功";
if ("UAS".equals(ResourceUtil.getConfigByName("interfacetype"))){
String masterbill[] = {"XKN_TEST","XKN_TEST"};
for(int m =0;m<masterbill.length;m++) {
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);
billResult billResult = wmIntUtil.getBillin(paramMap);
for (int s = 0; s < billResult.getData().size(); s++) {
String imcuscode = billResult.getData().get(s).getPiInoutno();
if (StringUtil.isNotEmpty(imcuscode)) {
WmImNoticeHEntity wmimh = systemService.findUniqueByProperty(WmImNoticeHEntity.class, "imCusCode", imcuscode);
if (wmimh == null) {
WmImNoticeHEntity wmImNoticeH = new WmImNoticeHEntity();
List<WmImNoticeIEntity> wmImNoticeIListnew = new ArrayList<WmImNoticeIEntity>();
wmImNoticeH.setOrderTypeCode("01");
String noticeid = wmUtil.getNextNoticeid(wmImNoticeH.getOrderTypeCode());
wmImNoticeH.setCusCode(ResourceUtil.getConfigByName("uas.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(imcuscode);
wmImNoticeH.setSupName(billResult.getData().get(s).getPiReceivename());
for (int k = 0; k < billResult.getData().get(s).getDetail().size(); k++) {
WmImNoticeIEntity wmi = new WmImNoticeIEntity();
wmi.setGoodsCode(billResult.getData().get(s).getDetail().get(k).getPdProdcode());
MvGoodsEntity mvgoods = systemService.findUniqueByProperty(
MvGoodsEntity.class, "goodsCode", wmi.getGoodsCode());
if (mvgoods != null) {
wmi.setGoodsName(mvgoods.getGoodsName());
wmi.setGoodsUnit(mvgoods.getShlDanWei());
}
wmi.setGoodsCount(Integer.toString(billResult.getData().get(s).getDetail().get(k).getPdInqty()));
// wmi.setGoodsPrdData(billResult.getData().get(s).getDetail().get(k).getPdProdmadedate2User());
wmi.setOtherId(Integer.toString(billResult.getData().get(s).getDetail().get(k).getPdPdno()));
wmImNoticeIListnew.add(wmi);
}
wmImNoticeHService.addMain(wmImNoticeH, wmImNoticeIListnew);
}
} else {
continue;
}
}
}
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);
return j;
}
@RequestMapping(params = "doPost")
@ResponseBody
public AjaxJson dopost(String id, HttpServletRequest request) {
String message = null;
AjaxJson j = new AjaxJson();
message = "读取成功";
WmImNoticeHEntity wmImNoticeH = wmImNoticeHService.getEntity(WmImNoticeHEntity.class, id);
//获取参数
Object id0 = wmImNoticeH.getNoticeId();
//===================================================================================
//查询-产品
String hql0 = "from WmImNoticeIEntity where 1 = 1 AND iM_NOTICE_ID = ? ";
try{
List<WmImNoticeIEntity> wmImNoticeIEntityList = systemService
.findHql(hql0, id0);
List<Map<String,String>> list = new ArrayList<Map<String,String>>();
for(WmImNoticeIEntity t:wmImNoticeIEntityList){
// List<WmInQmIEntity> WmInQmlist = new ArrayList<WmInQmIEntity>();
String hql = null;
hql = "from WmInQmIEntity t where t.imNoticeItem = ? ";
List<WmInQmIEntity> WmInQmlist = systemService.findHql(hql, new Object[] { t.getId() });
for(WmInQmIEntity qm:WmInQmlist){
Map<String,String> map = new HashMap<String,String>();
// [{"pd_pdno":1,"pd_outqty":"100","pi_class":"出货单","pi_id":50765226,"pi_inoutno":"JRS180800008"}]
map.put("pd_pdno",t.getOtherId());
map.put("pd_outqty",qm.getBaseGoodscount());
map.put("pi_class",wmImNoticeH.getPiClass());
map.put("pi_id",wmImNoticeH.getPlatformCode());
map.put("pi_inoutno",wmImNoticeH.getImCusCode());
map.put("pd_prodmadedate",qm.getProData());
MdGoodsEntity mvgoods = systemService.findUniqueByProperty(
MdGoodsEntity.class, "shpBianMa",
qm.getGoodsId());
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); // 日期格式
Date date = dateFormat.parse(qm.getProData()); // 指定日期
if(mvgoods!=null){
Date newDate = addDate(date, Long.parseLong(mvgoods.getBzhiQi())); // 指定日期加上10天
map.put("pd_replydate",dateFormat.format(newDate));
}else{
Date newDate = addDate(date, 1); // 指定日期加上10天
map.put("pd_replydate ",qm.getProData());
}
list.add(map);
}
}
String jsonStr = JSONArray.fromObject(list).toString();
JSONArray ja = JSONArray.fromObject(jsonStr);
resResult resResult = wmIntUtil.postBill(ja.toString(),wmImNoticeH.getPiMaster());
j.setMsg(resResult.getDetailedMessage());
}catch (Exception e){
e.printStackTrace();
message = "读取失败";
throw new BusinessException(e.getMessage());
}
j.setMsg(message);
return j;
}
public static Date addDate(Date date, long day){
long time = date.getTime(); // 得到指定日期的毫秒数
day = day * 24 * 60 * 60 * 1000; // 要加上的天数转换成毫秒数
time += day; // 相加得到新的毫秒数
return new Date(time); // 将毫秒数转换成日期
}
/**

View File

@ -17,12 +17,9 @@ import javax.validation.Validator;
import com.zzjee.ba.entity.BaStoreEntity;
import com.zzjee.md.entity.MdGoodsEntity;
import com.zzjee.tms.entity.TmsMdCheliangEntity;
import com.zzjee.tms.entity.TmsYwDingdanEntity;
import com.zzjee.wave.entity.WaveToDownEntity;
import com.zzjee.wm.entity.*;
import com.zzjee.wm.page.*;
import com.zzjee.wmutil.dsc.dscUtil;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
@ -75,21 +72,15 @@ import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.util.UriComponentsBuilder;
import com.zzjee.api.ResultDO;
import com.zzjee.md.entity.MdCusEntity;
import com.zzjee.md.entity.MdCusOtherEntity;
import com.zzjee.md.entity.MvGoodsEntity;
import com.zzjee.wm.service.WmOmNoticeHServiceI;
import com.zzjee.wmutil.resResult;
import com.zzjee.wmutil.sdresult;
import com.zzjee.wmutil.wmIntUtil;
import com.zzjee.wmutil.wmUtil;
import net.sf.json.JSONArray;
import static com.xiaoleilu.hutool.date.DateTime.now;
/**
@ -1015,65 +1006,6 @@ public class WmOmNoticeHController extends BaseController {
return j;
}
@RequestMapping(params = "doGet")
@ResponseBody
public AjaxJson dogetfromother(String formDate, HttpServletRequest request) {
String message = null;
AjaxJson j = new AjaxJson();
message = "读取成功";
if ("DSC".equals(ResourceUtil.getConfigByName("interfacetype"))){
dscUtil.updateorderFromDsc();
}
j.setMsg(message);
return j;
}
@RequestMapping(params = "doPost")
@ResponseBody
public AjaxJson dopost(String id,HttpServletRequest request) {
String message = null;
AjaxJson j = new AjaxJson();
message = "读取成功";
WmOmNoticeHEntity wmOmNoticeHEntity = wmOmNoticeHService.getEntity(WmOmNoticeHEntity.class, id);
//获取参数
Object id0 = wmOmNoticeHEntity.getOmNoticeId();
//===================================================================================
//查询-产品
String hql0 = "from WmOmNoticeIEntity where 1 = 1 AND omNoticeId = ? ";
try{
List<WmOmNoticeIEntity> wmOmNoticeIEntityList = systemService
.findHql(hql0, id0);//获取行项目
List<Map<String,String>> list = new ArrayList<Map<String,String>>();
for(WmOmNoticeIEntity t:wmOmNoticeIEntityList){
Map<String,String> map = new HashMap<String,String>();
// [{"pd_pdno":1,"pd_outqty":"100","pi_class":"出货单","pi_id":50765226,"pi_inoutno":"JRS180800008"}]
map.put("pd_pdno",t.getOtherId());
map.put("pd_outqty",t.getGoodsQua());
map.put("pi_class",wmOmNoticeHEntity.getPiClass());
map.put("pi_id",wmOmNoticeHEntity.getOmPlatNo());
map.put("pi_inoutno",wmOmNoticeHEntity.getImCusCode());
list.add(map);
}
String jsonStr = JSONArray.fromObject(list).toString();
JSONArray ja = JSONArray.fromObject(jsonStr);
resResult resResult = wmIntUtil.postBill(ja.toString(),wmOmNoticeHEntity.getPiMaster());
j.setMsg(resResult.getDetailedMessage());
}catch (Exception e){
logger.error(ExceptionUtil.getExceptionMessage(e));
}
j.setMsg(message);
return j;
}
/**

View File

@ -1,162 +0,0 @@
package com.zzjee.wmutil;
import com.zzjee.md.entity.MdCusOtherEntity;
import com.zzjee.md.entity.MdGoodsEntity;
import com.zzjee.md.entity.MdSupEntity;
import org.jeecgframework.core.util.ApplicationContextUtil;
import org.jeecgframework.core.util.MyBeanUtils;
import org.jeecgframework.core.util.ResourceUtil;
import org.jeecgframework.core.util.StringUtil;
import org.jeecgframework.web.system.service.SystemService;
import java.util.HashMap;
import java.util.Map;
public class wmIntUtil {
public static void getproduct(String formDate){
Map<String, Object> paramMap = new HashMap<String, Object>();
paramMap.put("formDate",formDate);
// paramMap.put("lastUpdateTime","2017-01-01");
// paramMap.put("pi_class","采购验收单");
try{
productResult productResult =uasUtil.getProduct(paramMap);
SystemService systemService =ApplicationContextUtil.getContext().getBean(SystemService.class);
if(productResult.getResult().size()>0){
for(int i=0;i< productResult.getResult().size();i++){
String ShpBianMa = productResult.getResult().get(i).getPrCode();
MdGoodsEntity mdn = new MdGoodsEntity();
mdn.setShpBianMa(productResult.getResult().get(i).getPrCode());
mdn.setChlShl("1");
mdn.setSuoShuKeHu(ResourceUtil.getConfigByName("uas.cuscode"));
mdn.setShpMingCheng(productResult.getResult().get(i).getPrDetail());
mdn.setBzhiQi(productResult.getResult().get(i).getPrValiddays());
mdn.setChpShuXing(productResult.getResult().get(i).getPrKind());
mdn.setJshDanWei(productResult.getResult().get(i).getPrUnit());
mdn.setShlDanWei(productResult.getResult().get(i).getPrUnit());
mdn.setShpTiaoMa(productResult.getResult().get(i).getPrBarcode());
mdn.setCfWenCeng("常温");
mdn.setJiZhunwendu("1");
mdn.setTiJiCm("1");
mdn.setZhlKg("1");
mdn.setChlKongZhi("N");
mdn.setJfShpLei("10");
mdn.setMpCengGao("99");
mdn.setMpDanCeng("99");
if("进口".equals(productResult.getResult().get(i).getPrPlace())){
try{
if(StringUtil.isNotEmpty(mdn.getBzhiQi())){
int bzhiq = Integer.parseInt(mdn.getBzhiQi());
mdn.setZhlKgm(Integer.toString(bzhiq/2));
}
}catch (Exception e){
}
}else{
try{
if(StringUtil.isNotEmpty(mdn.getBzhiQi())){
int bzhiq = Integer.parseInt(mdn.getBzhiQi());
mdn.setZhlKgm(Integer.toString(bzhiq/3*2));
}
}catch (Exception e){
}
}
MdGoodsEntity mdGoods = systemService.findUniqueByProperty(
MdGoodsEntity.class, "shpBianMa", ShpBianMa);
if(mdGoods==null){
mdGoods = new MdGoodsEntity();
MyBeanUtils.copyBeanNotNull2Bean(mdn,mdGoods);
systemService.save(mdGoods);
}else{
MyBeanUtils.copyBeanNotNull2Bean(mdn,mdGoods);
systemService.updateEntitie(mdGoods);
}
}
}
}catch (Exception e){
}
}
public static void getCus(String formDate) {
Map<String, Object> paramMap = new HashMap<String, Object>();
paramMap.put("formDate",formDate);
try{
customerResult customerResult =uasUtil.getCustomer(paramMap);
SystemService systemService =ApplicationContextUtil.getContext().getBean(SystemService.class);
if(customerResult.getResult().size()>0){
for(int i=0;i< customerResult.getResult().size();i++){
MdCusOtherEntity mdn = new MdCusOtherEntity();
String kehubianma=customerResult.getResult().get(i).getCuCode();
MdCusOtherEntity mdcusother = systemService.findUniqueByProperty(
MdCusOtherEntity.class, "keHuBianMa", kehubianma);
mdn.setSuoShuKeHu(ResourceUtil.getConfigByName("uas.cuscode"));
mdn.setKeHuBianMa(kehubianma);
mdn.setZhongWenQch(customerResult.getResult().get(i).getCuArname());
if(mdcusother==null){
mdcusother = new MdCusOtherEntity();
MyBeanUtils.copyBeanNotNull2Bean(mdn,mdcusother);
systemService.save(mdcusother);
}else{
MyBeanUtils.copyBeanNotNull2Bean(mdn,mdcusother);
systemService.updateEntitie(mdcusother);
}
}
}
}catch (Exception e){
}
}
public static void getSup(String formDate) {
Map<String, Object> paramMap = new HashMap<String, Object>();
paramMap.put("formDate",formDate);
try{
vendorResult vendorResult =uasUtil.getVendor(paramMap);
SystemService systemService =ApplicationContextUtil.getContext().getBean(SystemService.class);
if(vendorResult.getResult().size()>0){
for(int i=0;i< vendorResult.getResult().size();i++){
MdSupEntity mdn = new MdSupEntity();
String gysBianMa=vendorResult.getResult().get(i).getVeApvendcode();
MdSupEntity mdsup = systemService.findUniqueByProperty(
MdSupEntity.class, "gysBianMa", gysBianMa);
mdn.setGysBianMa(gysBianMa);
mdn.setZhongWenQch(vendorResult.getResult().get(i).getVeName());
if(mdsup==null){
mdsup = new MdSupEntity();
MyBeanUtils.copyBeanNotNull2Bean(mdn,mdsup);
systemService.save(mdsup);
}else{
MyBeanUtils.copyBeanNotNull2Bean(mdn,mdsup);
systemService.updateEntitie(mdsup);
}
}
}
}catch (Exception e){
}
}
public static void getWarehouse(String formDate) {
}
public static billResult getBillin(Map<String, Object> paramMap) {
return uasUtil.getBil(paramMap);
}
public static sdresult getsdBillin(Map<String, Object> paramMap) {
return uasUtil.getsdBil(paramMap);
}
public static resResult postBill(String data,String master){
Map<String, Object> paramMap = new HashMap<String, Object>();
paramMap.put("data",data);
paramMap.put("master",master);
return uasUtil.postBill(paramMap);
}
}