Commit b9155a67 by 肖洋洋

外部接口对接代码

parent ef459b6a
Showing with 6372 additions and 1711 deletions
......@@ -12,10 +12,16 @@ import orthopedics.dao.*;
import orthopedics.model.*;
import orthopedics.service.PropertiesServer;
import orthopedics.util.IdWorker;
import orthopedics.util.StringUtil;
import orthopedics.util.UuidUtil;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
......@@ -159,6 +165,7 @@ public class Sync {
@Autowired
private InvTransactionMapper invTransactionMapper;
@GetMapping("/sku")
public void addInvItemSku(){
List<TempItemSkuFomPmp> select = tempItemSkuFomPmpMapper.select();
......@@ -170,11 +177,17 @@ public class Sync {
data.put("inv_code","WH2");
data.put("subinv_code","KQ22");
data.put("locator_code","HJ"+tempItemSkuFomPmp.getRack());
String itemcode = invItemMapper.getPlucode(tempItemSkuFomPmp.getPlucode());
if(itemcode==null){
InvItem invItem = invItemMapper.findAllByPlucode(tempItemSkuFomPmp.getPlucode());
if(invItem==null){
logger.info("查询不到商品信息");
continue;
}
String id = invTransactionMapper.findIdByItemId(invItem.getId());
if(!StringUtil.isEmpty(id)){
logger.info(tempItemSkuFomPmp.getPlucode()+"已经同步");
continue;
}
data.put("item_code",itemcode);
data.put("item_code",invItem.getItemCode());
data.put("tx_type_code","PMP_SYN");
data.put("tx_date",new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
data.put("tx_quantity",tempItemSkuFomPmp.getQty());
......
package orthopedics.client;
import com.alibaba.fastjson.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import orthopedics.controller.v1.TransactionController;
import orthopedics.dao.InvItemMapper;
import orthopedics.dao.SalOrderHeaderMapper;
import orthopedics.dao.SalOrderLineMapper;
......@@ -14,6 +16,7 @@ import orthopedics.model.InvItem;
import orthopedics.model.SalOrderHeader;
import orthopedics.model.SalOrderLine;
import orthopedics.service.PropertiesServer;
import orthopedics.util.StringUtil;
import orthopedics.util.UuidUtil;
import java.math.BigDecimal;
......@@ -41,6 +44,9 @@ public class SyncSalFromPos {
@Autowired
PropertiesServer propertiesServer;
@Autowired
private TransactionController transactionController;
/**
* 将POS的销售订单同步到ERP(只同步我们同步过去的商品的销售订单)
*/
......@@ -66,7 +72,8 @@ public class SyncSalFromPos {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String dateStr = sdf.format(timestamp);
//查询支付方式
PreparedStatement ps1=ct.prepareStatement("SELECT * FROM shoptxns WHERE Convert(varchar,txntime,120) like ''+?+'%' and vouchnum=? and operator=? and salestype=8");
Connection ct1= DriverManager.getConnection("jdbc:sqlserver://130.1.0.32:1433;DatabaseName=shoptxns","wjkj","wjkj123456");
PreparedStatement ps1=ct1.prepareStatement("SELECT * FROM shoptxns WHERE Convert(varchar,txntime,120) like ''+?+'%' and vouchnum=? and operator=? and salestype=8");
ps1.setString(1,dateStr);
ps1.setLong(2,vouchnum);
ps1.setString(3,operator);
......@@ -89,7 +96,7 @@ public class SyncSalFromPos {
salOrderHeader.setCreateTime(LocalDateTime.now());
salOrderHeader.setSysOrgCode("A04");
salOrderHeader.setOrgId("2c9007626dde3f4f016deda2151f1a42");
salOrderHeader.setOrderTypeId("000000006c60dba1016c661283010034");
salOrderHeader.setOrderTypeId("2c9007626e0202af016e16c0672b2000");
if(timestamp!=null){
Date date = new Date(timestamp.getTime());
LocalDateTime ldt = date.toInstant()
......@@ -100,15 +107,6 @@ public class SyncSalFromPos {
salOrderHeader.setOrderNumber(propertiesServer.generateFlowingWater("SAL_ORDER_NUMBER"));
salOrderHeader.setCustomerId("2c9007626df2ab5b016dfd0edccb0039");
salOrderHeader.setOrderCurrency("CNY");
// if(paymentMethod.equals("001")){
// salOrderHeader.setPaymentMethod("CASH");
// }else if(paymentMethod.equals("098")){
// salOrderHeader.setPaymentMethod("ALIPAY");
// }else if(paymentMethod.equals("099")){
// salOrderHeader.setPaymentMethod("WECHAT");
// }else{
// salOrderHeader.setPaymentMethod("OTHER");
// }
salOrderHeader.setPaymentMethod(paymentMethod);
salOrderHeader.setSellerId("a9a2c497f64011e9a1b10242ac110002");
......@@ -135,6 +133,18 @@ public class SyncSalFromPos {
salOrderHeaderMapper.insert(salOrderHeader);
salOrderLineMapper.insert(salOrderLine);
invItemMapper.updateByAttribute6(invItem.getId(),"2");
JSONObject jsonObject=new JSONObject();
JSONObject data=new JSONObject();
data.put("inv_code","WH2");
data.put("subinv_code","KQ22");
data.put("locator_code","HJ2");
data.put("item_code",invItem.getItemCode());
data.put("tx_type_code","PMP_SYN");
data.put("tx_date",new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new java.util.Date()));
data.put("tx_quantity",quantity);
data.put("tx_price",attribute1);
jsonObject.put("data",data);
String s = transactionController.invItemInOut("201910271129039497a78b526d9a246eca0abb1025986f25cG7BHIxhVaDO6MYm", jsonObject);
}
}
......
package orthopedics.client;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import orthopedics.dao.*;
import orthopedics.model.*;
import orthopedics.service.PropertiesServer;
import orthopedics.service.UserServer;
import orthopedics.util.*;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.*;
/**
* 同步pmp库区信息
*/
@Component
public class SyncTempAreaFomPmp {
private final static Logger logger = LoggerFactory.getLogger(SyncTempAreaFomPmp.class);
@Autowired
private InvSubinventoryMapper invSubinventoryMapper;
@Autowired
private InvInventoryMapper invInventoryMapper;
//每天晚上23:10点执行
@Scheduled(cron = "0 10 23 * * ? ")
@Transactional
public void scheduler(){
String gettoken = HttpUtilRSA.getToken();
String token = (String) JSONObject.parseObject(gettoken).get("Token");
String tempEncryptKey = (String) JSONObject.parseObject(gettoken).get("TempEncryKey");
JSONObject data=new JSONObject();
data.put("uniquekey","获取区域列表");
data.put("timestamp", getTimestamp());
Map headers=new HashMap();
headers.put("Content-Type","application/json");
headers.put("token",token);
byte[] encrypt = Aes.encrypt(JSON.toJSONString(data), tempEncryptKey, tempEncryptKey);
byte[] bytes = new byte[0];
try {
bytes = HttpUtilPMP.postBy("http://pmpapi.szcbfx.com/api/pmp/ExchangePMPData", encrypt,token);
} catch (Exception e) {
logger.error(e.getMessage());
return;
}
String s = new String(bytes);
JSONObject object = JSONObject.parseObject(s);
Object result = object.get("result");
if(result==null||!result.equals("success")){
logger.error((String) object.get("ret_msg"));
return;
}
List<JSONObject> retMsg= (List<JSONObject>) object.get("ret_msg");
if(retMsg==null || retMsg.size()<=0){
logger.info("没有可同步的区域数据");
return;
}
List<InvSubinventory> invSubinventories=new ArrayList<>();
for(JSONObject jsonObject:retMsg){
String subwh = jsonObject.getString("subwh");
String wh = jsonObject.getString("wh");
String descript = jsonObject.getString("descript");
InvSubinventory bySubinvCode = invSubinventoryMapper.findBySubinvCode("KQ" + subwh);
if(bySubinvCode!=null){
continue;
}
InvSubinventory invSubinventory=new InvSubinventory();
invSubinventory.setId(UuidUtil.get32UUIDString());
invSubinventory.setCreateDate(LocalDateTime.now());
invSubinventory.setCreateBy("0f98872af64711e9a1b10242ac110002");
InvInventory bySortid = invInventoryMapper.findBySortid(wh);
if(bySortid==null){
continue;
}
invSubinventory.setInvId(bySortid.getId());
invSubinventory.setSubinvType("STORAGE");
invSubinventory.setSubinvCode("KQ"+subwh);
invSubinventory.setSubinvName("存储区");
invSubinventory.setSubinvDesc("-1");
invSubinventory.setLocatorControl("Y");
invSubinventory.setStatus("A");
invSubinventories.add(invSubinventory);
}
if(invSubinventories.size()>0){
invSubinventoryMapper.insertBatch(invSubinventories);
}
logger.info("获取区域列表同步完成");
}
/**
* 获取时间戳(匹配书城)
* @return 时间戳
*/
public static long getTimestamp() {
long milli = System.currentTimeMillis() + 8*3600*1000;
return (milli*10000)+621355968000000000L;
}
}
......@@ -2,64 +2,45 @@ package orthopedics.client;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import orthopedics.controller.pda.TakeStockController;
import orthopedics.dao.*;
import orthopedics.model.*;
import orthopedics.service.PropertiesServer;
import orthopedics.service.UserServer;
import orthopedics.util.*;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import java.time.ZoneId;
import java.util.*;
public class SyncInvItem {
private final static Logger logger = LoggerFactory.getLogger(SyncInvItem.class);
@Autowired
private RedisTemplate redisTemplate;
/**
* 同步pmp仓库信息
*/
@Component
public class SyncTempInventoryFomPmp {
private final static Logger logger = LoggerFactory.getLogger(SyncTempInventoryFomPmp.class);
@Autowired
private TakeStockController takeStockController;
private InvInventoryMapper invInventoryMapper;
//每天晚上23点执行
// @Scheduled(cron = "0 0 23 * * ? ")
// @Transactional
// public void scheduler(){
// takeStockController.getPMPInvItem("20190904153120997a6088c4da5964015a88fa7a03651c2ff003h5Ol5W04Qp61");
// }
/**
* 获取时间戳(匹配书城)
* @return 时间戳
*/
public static long getTimestamp() {
long milli = System.currentTimeMillis() + 8*3600*1000;
return (milli*10000)+621355968000000000L;
}
public static void main(String[] args) {
@Scheduled(cron = "0 0 23 * * ? ")
@Transactional
public void scheduler(){
String gettoken = HttpUtilRSA.getToken();
System.err.println(gettoken);
String token = (String) JSONObject.parseObject(gettoken).get("Token");
String tempEncryptKey = (String) JSONObject.parseObject(gettoken).get("TempEncryKey");
JSONObject data=new JSONObject();
data.put("uniquekey","获取区域列表");
data.put("uniquekey","获取仓号列表");
data.put("timestamp", getTimestamp());
System.err.println(new Date());
//data.put("begintime","1995-12-23 00:00:00");
// data.put("begintime","2015-01-11 18:00:00");
// data.put("endTime","2020-06-12 18:00:00");
Map headers=new HashMap();
headers.put("Content-Type","application/json");
headers.put("token",token);
......@@ -68,17 +49,54 @@ public class SyncInvItem {
try {
bytes = HttpUtilPMP.postBy("http://pmpapi.szcbfx.com/api/pmp/ExchangePMPData", encrypt,token);
} catch (Exception e) {
e.printStackTrace();
logger.error(e.getMessage());
return;
}
//String post = HttpUtilPMP.post("http://pmpapi.szcbfx.com/api/pmp/ExchangePMPData", data, headers, 6000, 6000, "utf-8",tempEncryptKey);
String s = new String(bytes);
JSONObject object = JSONObject.parseObject(s);
Object result = object.get("result");
if(result==null||!result.equals("success")){
logger.error((String) object.get("ret_msg"));
return;
}
List<JSONObject> retMsg= (List<JSONObject>) object.get("ret_msg");
if(retMsg==null || retMsg.size()<=0){
logger.info("没有可同步的仓号数据");
return;
}
List<InvInventory> invInventories=new ArrayList<>();
for(JSONObject jsonObject:retMsg){
String code = jsonObject.getString("code");
String descript = jsonObject.getString("descript");
InvInventory byInvCode = invInventoryMapper.findByInvCode("WH" + code);
if(byInvCode!=null){
continue;
}
InvInventory invInventory=new InvInventory();
invInventory.setId(UuidUtil.get32UUIDString());
invInventory.setOrg_id("2c9007626dde3f4f016deda2151f1a42");
invInventory.setInv_code("WH"+code);
invInventory.setInv_name(descript);
invInventory.setInv_desc("-1");
invInventory.setSortid(code);
invInventory.setStatus("A");
invInventory.setCreate_by("0f98872af64711e9a1b10242ac110002");
invInventory.setCreate_time(LocalDateTime.now());
invInventories.add(invInventory);
}
if(invInventories.size()>0){
invInventoryMapper.insertBatch(invInventories);
}
logger.info("获取仓号列表同步完成");
}
System.err.println(retMsg);
System.err.println(retMsg.size());
/**
* 获取时间戳(匹配书城)
* @return 时间戳
*/
public static long getTimestamp() {
long milli = System.currentTimeMillis() + 8*3600*1000;
return (milli*10000)+621355968000000000L;
}
}
package orthopedics.client;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import orthopedics.dao.*;
import orthopedics.model.*;
import orthopedics.service.PropertiesServer;
import orthopedics.service.UserServer;
import orthopedics.util.*;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.*;
/**
* 同步pmp商品信息
*/
@Component
public class SyncTempItemFomPmp {
private final static Logger logger = LoggerFactory.getLogger(SyncTempItemFomPmp.class);
@Autowired
private RedisTemplate redisTemplate;
@Autowired
private PropertiesServer propertiesServer;
@Autowired
private SysUserDepartMapper sysUserDepartMapper;
@Autowired
private InvItemMapper invItemMapper;
@Autowired
private InvItemSkuMapper invItemSkuMapper;
@Autowired
private InvItemAttributeMapper invItemAttributeMapper;
@Autowired
private InvItemPmpMapper invItemPmpMapper;
@Autowired
private UserServer userServer;
@Autowired
private Environment env;
@Autowired
private IdWorker idWorker;
@Autowired
private TempItemFomPmpMapper tempItemFomPmpMapper;
//每天晚上24点执行
@Scheduled(cron = "0 0 24 * * ? ")
@Transactional
public void scheduler(){
String gettoken = HttpUtilRSA.getToken();
if(StringUtil.isEmpty(gettoken)){
logger.error("获取PMP系统token失败");
return;
}
JSONObject jsonObject = JSONObject.parseObject(gettoken);
String token = jsonObject.getString("Token");
String tempEncryptKey = jsonObject.getString("TempEncryKey");
String begintime= (String) redisTemplate.opsForValue().get("temp_item_fom_pmp");
if(StringUtil.isEmpty(begintime)){
begintime="2019-11-25 00:00:00";
}
JSONObject data=new JSONObject();
String format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
data.put("uniquekey","获取商品资料列表");
data.put("timestamp", getTimestamp());
data.put("begintime",begintime);
data.put("endTime",format);
byte[] encrypt = Aes.encrypt(JSON.toJSONString(data), tempEncryptKey, tempEncryptKey);
try {
byte[] bytes = HttpUtilPMP.postBy("http://pmpapi.szcbfx.com/api/pmp/ExchangePMPData", encrypt,token);
String s = new String(bytes);
JSONObject object = JSONObject.parseObject(s);
Object result = object.get("result");
if(result==null||!result.equals("success")){
logger.error((String) object.get("ret_msg"));
return;
}
List<JSONObject> retMsg= (List<JSONObject>) object.get("ret_msg");
if(retMsg==null || retMsg.size()<=0){
logger.info("没有可同步的商品数据");
return;
}
int num=0;
List<InvItem> invItems=new ArrayList<>();
List<InvItemAttribute> invItemAttributes=new ArrayList<>();
List<InvItemSku> invItemSkus=new ArrayList<>();
List<TempItemFomPmp> tempItemFomPmps=new ArrayList<>();
for (JSONObject item:retMsg) {
//检测是否是重复数据
String plucode = item.getString("PLUCODE");
if(StringUtil.isEmpty(plucode)){
continue;
}
InvItem item1 = invItemMapper.selectByPlucode(plucode);
if(item1!=null){
invItemMapper.deleteByPlucode(plucode);
invItemSkuMapper.deleteByItemCode(invItems.get(0).getItemCode());
invItemAttributeMapper.deleteByItemCode(invItems.get(0).getItemCode());
tempItemFomPmpMapper.deleteByPlucode(plucode);
}
InvItem invItem=new InvItem();
InvItemAttribute invItemAttribute=new InvItemAttribute();
InvItemSku invItemSku=new InvItemSku();
TempItemFomPmp tempItemFomPmp=new TempItemFomPmp();
//商品表
invItem.setId(UuidUtil.get32UUIDString());
invItem.setOrgId("2c9007626dde3f4f016deda2151f1a42");
invItem.setStatus("SALE");
if(StringUtil.isEmpty(item.getString("CLSCODE"))){
invItem.setProType("14");
}else{
invItem.setProType(item.getString("CLSCODE"));
}
invItem.setItemCode(idWorker.nextId()+"");
invItem.setItemName(item.getString("TITLE"));
invItem.setItemDesc(item.getString("JP"));
invItem.setPystype(item.getString("PYSTYPE"));
invItem.setIsbn(item.getString("ISBN"));
invItem.setPlucode(item.getString("PLUCODE"));
invItem.setScancode(item.getString("SCANCODE"));
invItem.setExtcode("0");
invItem.setPurchasePrice(item.getString("PRICE"));
invItem.setGeneralName(item.getString("CLSCODE"));
invItem.setManufacturerId(item.getString("PUBLISHER"));
if(!StringUtil.isEmpty(item.getDate("PUBDATE"))){
invItem.setSpecification(item.getDate("PUBDATE").toInstant()
.atZone( ZoneId.systemDefault() )
.toLocalDateTime());
}
invItem.setPrimaryUnit("BEN");
if(item.getString("PYSTYPE").equals("0")||item.getString("PYSTYPE").equals("4")){
invItem.setAttribute1("Book");
invItem.setIsBorrow("Y");
}else{
invItem.setAttribute1("Goods");
invItem.setIsBorrow("N");
}
invItem.setAttribute2("A");
invItem.setTax(item.getString("INCTAX"));
invItem.setDefaultVendorId("000000006c60dba1016c60f839270004");
invItem.setCreateBy("PMP同步");
invItem.setCreateTime(LocalDateTime.now());
//查询当前用户部门
//SysUserDepart sysUserDepart = sysUserDepartMapper.selectByUserId(sysAccessToken.getUserId());
//图书信息
invItemAttribute.setId(UuidUtil.get32UUIDString());
invItemAttribute.setCreateBy("PMP同步");
invItemAttribute.setCreateTime(LocalDateTime.now());
invItemAttribute.setItemId(invItem.getId());
invItemAttribute.setItemCode(invItem.getItemCode());
invItemAttribute.setAuthor(item.getString("AUTHOR"));
invItemAttribute.setReader(item.getString("READER"));
//商品SKU映射
invItemSku.setId(UuidUtil.get32UUIDString());
invItemSku.setOrgId("2c9007626dde3f4f016deda2151f1a42");
invItemSku.setExternal("PMP");
invItemSku.setItemSku(item.getString("PLUCODE"));
invItemSku.setItemName(invItem.getItemName());
invItemSku.setItemCode(invItem.getItemCode());
invItemSku.setItemDesc(invItem.getItemDesc());
invItemSku.setStatus("A");
invItemSku.setCreateBy("PMP同步");
invItemSku.setCreateTime(LocalDateTime.now());
//pmp商品缓存表
tempItemFomPmp.setId(UuidUtil.get32UUIDString());
tempItemFomPmp.setPlucode(item.getString("PLUCODE"));
tempItemFomPmp.setPystype(item.getInteger("PYSTYPE"));
tempItemFomPmp.setIsbn(item.getString("ISBN"));
tempItemFomPmp.setScancode(item.getString("SCANCODE"));
tempItemFomPmp.setTitle(item.getString("TITLE"));
tempItemFomPmp.setJp(item.getString("JP"));
tempItemFomPmp.setPrice(item.getBigDecimal("PRICE"));
tempItemFomPmp.setClscode(item.getString("CLSCODE"));
tempItemFomPmp.setClsname(item.getString("CLSNAME"));
tempItemFomPmp.setPublisher(item.getString("PUBLISHER"));
tempItemFomPmp.setPubname(item.getString("PUBNAME"));
if(!StringUtil.isEmpty(item.getDate("PUBDATE"))){
tempItemFomPmp.setPubdate(item.getDate("PUBDATE").toInstant()
.atZone( ZoneId.systemDefault() )
.toLocalDateTime());
}
tempItemFomPmp.setDptcode(item.getString("DPTCODE"));
tempItemFomPmp.setDptname(item.getString("DPTNAME"));
tempItemFomPmp.setSeries(item.getString("SERIES"));
tempItemFomPmp.setAuthor(item.getString("AUTHOR"));
tempItemFomPmp.setReader(item.getString("READER"));
if(!StringUtil.isEmpty(item.getDate("FSTDATE"))){
tempItemFomPmp.setFstdate(item.getDate("FSTDATE").toInstant()
.atZone( ZoneId.systemDefault() )
.toLocalDateTime());
}
tempItemFomPmp.setFstdisc(item.getBigDecimal("FSTDISC"));
tempItemFomPmp.setLstdisc(item.getBigDecimal("LSTDISC"));
tempItemFomPmp.setMaxdisc(item.getBigDecimal("MAXDISC"));
tempItemFomPmp.setMindisc(item.getBigDecimal("MINDISC"));
tempItemFomPmp.setVendor(item.getString("VENDOR"));
tempItemFomPmp.setTranstitle(item.getString("TRANSTITLE"));
tempItemFomPmp.setInctax(item.getInteger("INCTAX"));
tempItemFomPmp.setOriginprice(item.getBigDecimal("ORIGINPRICE"));
tempItemFomPmp.setCurrency(item.getString("CURRENCY"));
tempItemFomPmp.setStatus(1);
invItems.add(invItem);
invItemSkus.add(invItemSku);
invItemAttributes.add(invItemAttribute);
tempItemFomPmps.add(tempItemFomPmp);
num=num+1;
}
if(invItems==null || retMsg.size()<=0){
return ;
}
invItemMapper.insertBatch(invItems);
invItemSkuMapper.insertBatch(invItemSkus);
invItemAttributeMapper.insertBatch(invItemAttributes);
tempItemFomPmpMapper.insertBatch(tempItemFomPmps);
redisTemplate.opsForValue().set("temp_item_fom_pmp",format);
logger.info("已同步"+num+"条数据");
} catch (Exception e) {
logger.error("数据保存发生异常");
logger.error(e.getMessage());
}
}
/**
* 获取时间戳(匹配书城)
* @return 时间戳
*/
public static long getTimestamp() {
long milli = System.currentTimeMillis() + 8*3600*1000;
return (milli*10000)+621355968000000000L;
}
}
package orthopedics.client;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import orthopedics.dao.InvInventoryMapper;
import orthopedics.dao.InvLocatorMapper;
import orthopedics.dao.InvSubinventoryMapper;
import orthopedics.model.InvInventory;
import orthopedics.model.InvLocator;
import orthopedics.model.InvSubinventory;
import orthopedics.model.TempLocatorFomPmp;
import orthopedics.util.Aes;
import orthopedics.util.HttpUtilPMP;
import orthopedics.util.HttpUtilRSA;
import orthopedics.util.UuidUtil;
import java.time.LocalDateTime;
import java.util.*;
/**
* 同步pmp货架信息
*/
@Component
public class SyncTempLocatorFomPmp {
private final static Logger logger = LoggerFactory.getLogger(SyncTempLocatorFomPmp.class);
@Autowired
private InvLocatorMapper invLocatorMapper;
@Autowired
private InvInventoryMapper invInventoryMapper;
@Autowired
private InvSubinventoryMapper invSubinventoryMapper;
//每天晚上23:20点执行
@Scheduled(cron = "0 20 23 * * ? ")
@Transactional
public void scheduler(){
String gettoken = HttpUtilRSA.getToken();
String token = (String) JSONObject.parseObject(gettoken).get("Token");
String tempEncryptKey = (String) JSONObject.parseObject(gettoken).get("TempEncryKey");
JSONObject data=new JSONObject();
data.put("uniquekey","获取架号列表");
data.put("timestamp", getTimestamp());
Map headers=new HashMap();
headers.put("Content-Type","application/json");
headers.put("token",token);
byte[] encrypt = Aes.encrypt(JSON.toJSONString(data), tempEncryptKey, tempEncryptKey);
byte[] bytes = new byte[0];
try {
bytes = HttpUtilPMP.postBy("http://pmpapi.szcbfx.com/api/pmp/ExchangePMPData", encrypt,token);
} catch (Exception e) {
logger.error(e.getMessage());
}
String s = new String(bytes);
JSONObject object = JSONObject.parseObject(s);
Object result = object.get("result");
if(result==null||!result.equals("success")){
logger.error((String) object.get("ret_msg"));
return;
}
List<JSONObject> retMsg= (List<JSONObject>) object.get("ret_msg");
if(retMsg==null || retMsg.size()<=0){
logger.info("没有可同步的区域数据");
return;
}
List<InvLocator> invLocators=new ArrayList<>();
for(JSONObject jsonObject:retMsg){
String code = jsonObject.getString("code");
String wh = jsonObject.getString("wh");
InvLocator invLocatorList = invLocatorMapper.findLocatorByCode("HJ" + code);
if(invLocatorList!=null){
continue;
}
InvLocator invLocator=new InvLocator();
invLocator.setId(UuidUtil.get32UUIDString());
invLocator.setCreateBy("0f98872af64711e9a1b10242ac110002");
invLocator.setCreateTime(LocalDateTime.now());
InvInventory bySortid = invInventoryMapper.findBySortid(wh);
if(bySortid==null){
continue;
}
invLocator.setInvId(bySortid.getId());
List<InvSubinventory> invSubinventories = invSubinventoryMapper.selectByInvIdAndSubinvName(bySortid.getId());
if(invSubinventories==null || invSubinventories.size()<=0){
continue;
}
invLocator.setSubinvId(invSubinventories.get(0).getId());
invLocator.setLocatorCode("HJ"+code);
invLocator.setLocatorName(code);
invLocator.setLocatorDesc("-1");
invLocator.setStatus("A");
invLocators.add(invLocator);
}
if(invLocators.size()>0){
invLocatorMapper.insertBatch(invLocators);
}
logger.info("获取架号列表同步完成");
}
/**
* 获取时间戳(匹配书城)
* @return 时间戳
*/
public static long getTimestamp() {
long milli = System.currentTimeMillis() + 8*3600*1000;
return (milli*10000)+621355968000000000L;
}
}
package orthopedics.client;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import orthopedics.dao.*;
import orthopedics.model.*;
import orthopedics.util.*;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.util.*;
/**
* 同步pmp采购订单
*/
@Component
public class SyncTempPurOrderFomPmp {
private final static Logger logger = LoggerFactory.getLogger(SyncTempPurOrderFomPmp.class);
@Autowired
private RedisTemplate redisTemplate;
@Autowired
private InvInventoryMapper invInventoryMapper;
@Autowired
private Environment env;
@Autowired
private PurOrderHeaderMapper purOrderHeaderMapper;
@Autowired
private PurOrderLineMapper purOrderLineMapper;
@Autowired
private InvItemMapper invItemMapper;
//每天晚上23点执行
@Scheduled(cron = "0 0 23 * * ? ")
@Transactional
public void scheduler(){
List<InvInventory> sortidByInvDesc = invInventoryMapper.getSortidByInvDesc();
String gettoken = HttpUtilRSA.getToken();
String token = (String) JSONObject.parseObject(gettoken).get("Token");
String tempEncryptKey = (String) JSONObject.parseObject(gettoken).get("TempEncryKey");
for (InvInventory invInventory:sortidByInvDesc) {
String shop = invInventory.getSortid();
try {
String begintime= (String) redisTemplate.opsForHash().get("temp_pur_order_fom_pmp",shop);
if(StringUtil.isEmpty(begintime)){
begintime=env.getProperty("synchronizationTime");
}
String format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
JSONObject data=new JSONObject();
data.put("uniquekey","请配查询");
data.put("timestamp", getTimestamp());
data.put("begintime",begintime);
data.put("endTime",format);
data.put("shop",shop);
Map headers=new HashMap();
headers.put("Content-Type","application/json");
headers.put("token",token);
byte[] encrypt = Aes.encrypt(JSON.toJSONString(data), tempEncryptKey, tempEncryptKey);
byte[] bytes = new byte[0];
bytes = HttpUtilPMP.postBy("http://pmpapi.szcbfx.com/api/pmp/ExchangePMPData", encrypt,token);
String s = new String(bytes);
JSONObject object = JSONObject.parseObject(s);
Object result = object.get("result");
if(result==null||!result.equals("success")){
logger.error((String) object.get("ret_msg"));
return;
}
List<JSONObject> retMsg= (List<JSONObject>) object.get("ret_msg");
if(retMsg==null || retMsg.size()<=0){
logger.info("没有可同步的采购订单数据");
return;
}
if(retMsg.size()<=10000 && retMsg.size()>0){
List<PurOrderHeader> purOrderHeaders=new ArrayList<>();
List<PurOrderLine> purOrderLines=new ArrayList<>();
for (JSONObject jsonObject:retMsg) {
PurOrderHeader purOrderHeader=new PurOrderHeader();
PurOrderLine purOrderLine=new PurOrderLine();
String uuidString = UuidUtil.get32UUIDString();
purOrderHeader.setId(uuidString);
purOrderHeader.setCreateBy("PMP同步");
purOrderHeader.setCreateTime(LocalDateTime.now());
purOrderHeader.setOrgId(invInventory.getOrg_id());
purOrderHeader.setOrderType("000000006c60dba1016c60f588e00002");
purOrderHeader.setOrderNumber(jsonObject.getString("number"));
if(jsonObject.getString("hdltime")==null || jsonObject.getString("hdltime").equals("") ){
purOrderHeader.setHeaderStatus("new");
purOrderLine.setLineStatus("new");
}else{
purOrderHeader.setHeaderStatus("completed");
purOrderLine.setLineStatus("completed");
purOrderHeader.setOrderDate(TimeUtil.fromDateToLocalDateTime(jsonObject.getString("hdltime")));
}
purOrderHeader.setOrderCurrency("CNY");
//行表
purOrderLine.setId(UuidUtil.get32UUIDString());
purOrderLine.setCreateBy("PMP同步");
purOrderLine.setCreateTime(LocalDateTime.now());
purOrderLine.setOrgId(invInventory.getOrg_id());
purOrderLine.setOrderId(uuidString);
InvItem invItem = invItemMapper.findAllByPlucode(jsonObject.getString("plucode"));
if(invItem==null){
logger.info(begintime+"---"+new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())+"单号为:"+jsonObject.getString("number")+"商品未同步");
continue;
}
purOrderLine.setItemId(invItem.getId());
purOrderLine.setOrderNumber(jsonObject.getString("number"));
purOrderLine.setLineNumber("1");
purOrderLine.setItemCode(invItem.getItemCode());
purOrderLine.setItemName(jsonObject.getString("title"));
purOrderLine.setQuantity(jsonObject.getInteger("qty")+"");
purOrderLine.setFixedPrice(jsonObject.getBigDecimal("price")+"");
purOrderHeaders.add(purOrderHeader);
purOrderLines.add(purOrderLine);
}
if(purOrderHeaders.size()>0){
purOrderHeaderMapper.insertBatch(purOrderHeaders);
purOrderLineMapper.insertBatch(purOrderLines);
}
}else if(retMsg.size()>10000){
List<PurOrderHeader> purOrderHeaders=new ArrayList<>();
List<PurOrderLine> purOrderLines=new ArrayList<>();
for (int i=0;i<retMsg.size();i++) {
JSONObject jsonObject = retMsg.get(i);
PurOrderHeader purOrderHeader=new PurOrderHeader();
PurOrderLine purOrderLine=new PurOrderLine();
String uuidString = UuidUtil.get32UUIDString();
purOrderHeader.setId(uuidString);
purOrderHeader.setCreateBy("PMP同步");
purOrderHeader.setCreateTime(LocalDateTime.now());
purOrderHeader.setOrgId(invInventory.getOrg_id());
purOrderHeader.setOrderType("000000006c60dba1016c60f588e00002");
purOrderHeader.setOrderNumber(jsonObject.getString("number"));
if(jsonObject.getString("hdltime")==null || jsonObject.getString("hdltime").equals("") ){
purOrderHeader.setHeaderStatus("new");
purOrderLine.setLineStatus("new");
}else{
purOrderHeader.setHeaderStatus("completed");
purOrderLine.setLineStatus("completed");
purOrderHeader.setOrderDate(TimeUtil.fromDateToLocalDateTime(jsonObject.getString("hdltime")));
}
purOrderHeader.setOrderCurrency("CNY");
//行表
purOrderLine.setId(UuidUtil.get32UUIDString());
purOrderLine.setCreateBy("PMP同步");
purOrderLine.setCreateTime(LocalDateTime.now());
purOrderLine.setOrgId(invInventory.getOrg_id());
purOrderLine.setOrderId(uuidString);
InvItem invItem = invItemMapper.findAllByPlucode(jsonObject.getString("plucode"));
if(invItem==null){
logger.info(begintime+"---"+new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())+"单号为:"+jsonObject.getString("number")+"商品未同步");
continue;
}
purOrderLine.setItemId(invItem.getId());
purOrderLine.setOrderNumber(jsonObject.getString("number"));
purOrderLine.setLineNumber("1");
purOrderLine.setItemCode(invItem.getItemCode());
purOrderLine.setItemName(jsonObject.getString("title"));
purOrderLine.setQuantity(jsonObject.getInteger("qty")+"");
purOrderLine.setFixedPrice(jsonObject.getBigDecimal("price")+"");
purOrderHeaders.add(purOrderHeader);
purOrderLines.add(purOrderLine);
if(i%10000==0 && retMsg.size()-i>10000){
if(purOrderHeaders.size()>0){
purOrderHeaderMapper.insertBatch(purOrderHeaders);
purOrderLineMapper.insertBatch(purOrderLines);
}
purOrderHeaders.clear();
purOrderLines.clear();
}
if(retMsg.size()==(i+1)){
if(purOrderHeaders.size()>0){
purOrderHeaderMapper.insertBatch(purOrderHeaders);
purOrderLineMapper.insertBatch(purOrderLines);
}
purOrderHeaders.clear();
purOrderLines.clear();
}
}
}
redisTemplate.opsForHash().put("temp_pur_order_fom_pmp",shop,format);
logger.info("同步pmp采购订单"+shop+"号仓数据量:"+retMsg.size()+"同步完成");
}catch (Exception e){
logger.error("同步pmp采购订单"+shop+"号仓同步失败");
logger.error(e.getMessage());
}
}
}
/**
* 获取时间戳(匹配书城)
* @return 时间戳
*/
public static long getTimestamp() {
long milli = System.currentTimeMillis() + 8*3600*1000;
return (milli*10000)+621355968000000000L;
}
}
package orthopedics.client;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import orthopedics.dao.*;
import orthopedics.model.*;
import orthopedics.util.*;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.util.*;
/**
* 同步pmp接收单(集团分发)
*/
@Component
public class SyncTempRcvReceiptFomPmp {
private final static Logger logger = LoggerFactory.getLogger(SyncTempRcvReceiptFomPmp.class);
@Autowired
private RedisTemplate redisTemplate;
@Autowired
private InvInventoryMapper invInventoryMapper;
@Autowired
private Environment env;
@Autowired
private RcvReceiptHeaderMapper rcvReceiptHeaderMapper;
@Autowired
private RcvReceiptLineMapper rcvReceiptLineMapper;
@Autowired
private InvItemMapper invItemMapper;
//每天晚上23点执行
@Scheduled(cron = "0 0 23 * * ? ")
@Transactional
public void scheduler(){
List<InvInventory> sortidByInvDesc = invInventoryMapper.getSortidByInvDesc();
String gettoken = HttpUtilRSA.getToken();
String token = (String) JSONObject.parseObject(gettoken).get("Token");
String tempEncryptKey = (String) JSONObject.parseObject(gettoken).get("TempEncryKey");
for (InvInventory invInventory:sortidByInvDesc) {
String shop = invInventory.getSortid();
try {
String begintime= (String) redisTemplate.opsForHash().get("temp_rcv_receipt_fom_pmp1",shop);
if(StringUtil.isEmpty(begintime)){
begintime=env.getProperty("synchronizationTime");
}
String format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
JSONObject data=new JSONObject();
data.put("uniquekey","获取待收发货单据列表");
data.put("timestamp", getTimestamp());
data.put("begintime",begintime);
data.put("endTime",format);
data.put("shop",shop);
Map headers=new HashMap();
headers.put("Content-Type","application/json");
headers.put("token",token);
byte[] encrypt = Aes.encrypt(JSON.toJSONString(data), tempEncryptKey, tempEncryptKey);
byte[] bytes = new byte[0];
bytes = HttpUtilPMP.postBy("http://pmpapi.szcbfx.com/api/pmp/ExchangePMPData", encrypt,token);
String s = new String(bytes);
JSONObject object = JSONObject.parseObject(s);
Object result = object.get("result");
if(result==null||!result.equals("success")){
logger.error((String) object.get("ret_msg"));
return;
}
List<JSONObject> retMsg= (List<JSONObject>) object.get("ret_msg");
if(retMsg==null || retMsg.size()<=0){
logger.info("没有可同步的接收单数据");
return;
}
if(retMsg.size()<=10000 && retMsg.size()>0){
List<RcvReceiptHeader> rcvReceiptHeaders=new ArrayList<>();
List<RcvReceiptLine> rcvReceiptLines=new ArrayList<>();
for (JSONObject jsonObject:retMsg) {
RcvReceiptHeader rcvReceiptHeader=new RcvReceiptHeader();
RcvReceiptLine rcvReceiptLine=new RcvReceiptLine();
String uuidString = UuidUtil.get32UUIDString();
rcvReceiptHeader.setId(uuidString);
rcvReceiptHeader.setCreateBy("PMP同步");
rcvReceiptHeader.setCreateTime(LocalDateTime.now());
rcvReceiptHeader.setSysOrgCode("A04");
rcvReceiptHeader.setInvId(invInventory.getId());
rcvReceiptHeader.setReceiptType("PURCHASE_RECEIPT");
rcvReceiptHeader.setReceiptNumber(jsonObject.getString("number"));
rcvReceiptHeader.setShipper(jsonObject.getString("rcvby"));
rcvReceiptHeader.setReceiver(jsonObject.getString("rcvby"));
rcvReceiptHeader.setPartyId("033c46f834004fa6a229f6d8a4c613e0");//暂时填入的默认值
if(jsonObject.getString("rcvtime")==null || jsonObject.getString("rcvtime").equals("")){
rcvReceiptHeader.setHeaderStatus("RECEIVED");//新建
rcvReceiptLine.setLineStatus("RECEIVED");
}else{
rcvReceiptHeader.setHeaderStatus("ACCEPTED");//已入库
rcvReceiptLine.setLineStatus("ACCEPTED");
rcvReceiptHeader.setReceiptDate(TimeUtil.fromDateToLocalDateTime(jsonObject.getString("rcvtime")));
}
//子表
rcvReceiptLine.setId(UuidUtil.get32UUIDString());
rcvReceiptLine.setCreateBy("PMP同步");
rcvReceiptLine.setCreateTime(LocalDateTime.now());
rcvReceiptLine.setSysOrgCode("A04");
rcvReceiptLine.setRcvReceiptHeaderId(uuidString);
rcvReceiptLine.setLineNumber("1");
rcvReceiptLine.setInvId(invInventory.getId());
InvItem invItem = invItemMapper.findAllByPlucode(jsonObject.getString("plucode"));
if(invItem==null){
logger.info(begintime+"---"+new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())+"单号为:"+jsonObject.getString("number")+"商品未同步");
continue;
}
rcvReceiptLine.setItemId(invItem.getId());
rcvReceiptLine.setShippedQuantity(jsonObject.getInteger("qty"));
rcvReceiptLine.setReceivedQuantity(jsonObject.getInteger("qty"));
rcvReceiptLine.setAcceptQuantity(jsonObject.getInteger("qty"));
rcvReceiptLine.setRejectQuantity(0);
rcvReceiptLine.setUnitCode("BEN");
rcvReceiptHeaders.add(rcvReceiptHeader);
rcvReceiptLines.add(rcvReceiptLine);
}
if(rcvReceiptHeaders.size()>0){
rcvReceiptHeaderMapper.insertBatch(rcvReceiptHeaders);
rcvReceiptLineMapper.insertBatch(rcvReceiptLines);
}
}else if(retMsg.size()>10000){
List<RcvReceiptHeader> rcvReceiptHeaders=new ArrayList<>();
List<RcvReceiptLine> rcvReceiptLines=new ArrayList<>();
for (int i=0;i<retMsg.size();i++) {
JSONObject jsonObject = retMsg.get(i);
RcvReceiptHeader rcvReceiptHeader=new RcvReceiptHeader();
RcvReceiptLine rcvReceiptLine=new RcvReceiptLine();
String uuidString = UuidUtil.get32UUIDString();
rcvReceiptHeader.setId(uuidString);
rcvReceiptHeader.setCreateBy("PMP同步");
rcvReceiptHeader.setCreateTime(LocalDateTime.now());
rcvReceiptHeader.setSysOrgCode("A04");
rcvReceiptHeader.setInvId(invInventory.getId());
rcvReceiptHeader.setReceiptType("PURCHASE_RECEIPT");
rcvReceiptHeader.setReceiptNumber(jsonObject.getString("number"));
rcvReceiptHeader.setShipper(jsonObject.getString("rcvby"));//暂时填入的默认值
rcvReceiptHeader.setReceiver(jsonObject.getString("rcvby"));
rcvReceiptHeader.setPartyId("033c46f834004fa6a229f6d8a4c613e0");//暂时填入的默认值
if(jsonObject.getString("rcvtime")==null || jsonObject.getString("rcvtime").equals("")){
rcvReceiptHeader.setHeaderStatus("RECEIVED");//新建
rcvReceiptLine.setLineStatus("RECEIVED");
}else{
rcvReceiptHeader.setHeaderStatus("ACCEPTED");//已入库
rcvReceiptLine.setLineStatus("ACCEPTED");
rcvReceiptHeader.setReceiptDate(TimeUtil.fromDateToLocalDateTime(jsonObject.getString("rcvtime")));
}
//子表
rcvReceiptLine.setId(UuidUtil.get32UUIDString());
rcvReceiptLine.setCreateBy("PMP同步");
rcvReceiptLine.setCreateTime(LocalDateTime.now());
rcvReceiptLine.setSysOrgCode("A04");
rcvReceiptLine.setRcvReceiptHeaderId(uuidString);
rcvReceiptLine.setLineNumber("1");
rcvReceiptLine.setInvId(invInventory.getId());
InvItem invItem = invItemMapper.findAllByPlucode(jsonObject.getString("plucode"));
if(invItem==null){
logger.info(begintime+"---"+new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())+"单号为:"+jsonObject.getString("number")+"商品未同步");
continue;
}
rcvReceiptLine.setItemId(invItem.getId());
rcvReceiptLine.setShippedQuantity(jsonObject.getInteger("qty"));
rcvReceiptLine.setReceivedQuantity(jsonObject.getInteger("qty"));
rcvReceiptLine.setAcceptQuantity(jsonObject.getInteger("qty"));
rcvReceiptLine.setRejectQuantity(0);
rcvReceiptLine.setUnitCode("BEN");
rcvReceiptHeaders.add(rcvReceiptHeader);
rcvReceiptLines.add(rcvReceiptLine);
if(i%10000==0 && retMsg.size()-i>10000){
if(rcvReceiptHeaders.size()>0){
rcvReceiptHeaderMapper.insertBatch(rcvReceiptHeaders);
rcvReceiptLineMapper.insertBatch(rcvReceiptLines);
}
rcvReceiptHeaders.clear();
rcvReceiptLines.clear();
}
if(retMsg.size()==(i+1)){
if(rcvReceiptHeaders.size()>0){
rcvReceiptHeaderMapper.insertBatch(rcvReceiptHeaders);
rcvReceiptLineMapper.insertBatch(rcvReceiptLines);
}
rcvReceiptHeaders.clear();
rcvReceiptLines.clear();
}
}
}
redisTemplate.opsForHash().put("temp_item_fom_pmp1",shop,format);
logger.info("同步pmp接收单"+shop+"号仓数据量:"+retMsg.size()+"同步完成");
}catch (Exception e){
logger.error("同步pmp接收单"+shop+"号仓同步失败");
logger.error(e.getMessage());
}
}
}
/**
* 获取时间戳(匹配书城)
* @return 时间戳
*/
public static long getTimestamp() {
long milli = System.currentTimeMillis() + 8*3600*1000;
return (milli*10000)+621355968000000000L;
}
}
package orthopedics.client;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import orthopedics.dao.InvInventoryMapper;
import orthopedics.dao.InvItemMapper;
import orthopedics.dao.RcvReceiptHeaderMapper;
import orthopedics.dao.RcvReceiptLineMapper;
import orthopedics.model.InvInventory;
import orthopedics.model.InvItem;
import orthopedics.model.RcvReceiptHeader;
import orthopedics.model.RcvReceiptLine;
import orthopedics.util.*;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.util.*;
/**
* 同步pmp接收单
*/
@Component
public class SyncTempRcvReceiptFomPmp1 {
private final static Logger logger = LoggerFactory.getLogger(SyncTempRcvReceiptFomPmp1.class);
@Autowired
private RedisTemplate redisTemplate;
@Autowired
private InvInventoryMapper invInventoryMapper;
@Autowired
private Environment env;
@Autowired
private RcvReceiptHeaderMapper rcvReceiptHeaderMapper;
@Autowired
private RcvReceiptLineMapper rcvReceiptLineMapper;
@Autowired
private InvItemMapper invItemMapper;
//每天晚上23点执行
@Scheduled(cron = "0 0 23 * * ? ")
@Transactional
public void scheduler(){
List<InvInventory> sortidByInvDesc = invInventoryMapper.getSortidByInvDesc();
String gettoken = HttpUtilRSA.getToken();
String token = (String) JSONObject.parseObject(gettoken).get("Token");
String tempEncryptKey = (String) JSONObject.parseObject(gettoken).get("TempEncryKey");
for (InvInventory invInventory:sortidByInvDesc) {
String shop = invInventory.getSortid();
try {
String begintime= (String) redisTemplate.opsForHash().get("temp_rcv_receipt_fom_pmp",shop);
if(StringUtil.isEmpty(begintime)){
begintime=env.getProperty("synchronizationTime");
}
String format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
JSONObject data=new JSONObject();
data.put("uniquekey","获取待收发货单据列表");
data.put("timestamp", getTimestamp());
data.put("begintime",begintime);
data.put("endTime",format);
data.put("shop",shop);
Map headers=new HashMap();
headers.put("Content-Type","application/json");
headers.put("token",token);
byte[] encrypt = Aes.encrypt(JSON.toJSONString(data), tempEncryptKey, tempEncryptKey);
byte[] bytes = new byte[0];
bytes = HttpUtilPMP.postBy("http://pmpapi.szcbfx.com/api/pmp/ExchangePMPData", encrypt,token);
String s = new String(bytes);
JSONObject object = JSONObject.parseObject(s);
Object result = object.get("result");
if(result==null||!result.equals("success")){
logger.error((String) object.get("ret_msg"));
return;
}
List<JSONObject> retMsg= (List<JSONObject>) object.get("ret_msg");
if(retMsg==null || retMsg.size()<=0){
logger.info("没有可同步的接收单数据");
return;
}
if(retMsg.size()<=10000 && retMsg.size()>0){
List<RcvReceiptHeader> rcvReceiptHeaders=new ArrayList<>();
List<RcvReceiptLine> rcvReceiptLines=new ArrayList<>();
for (JSONObject jsonObject:retMsg) {
RcvReceiptHeader rcvReceiptHeader=new RcvReceiptHeader();
RcvReceiptLine rcvReceiptLine=new RcvReceiptLine();
String uuidString = UuidUtil.get32UUIDString();
rcvReceiptHeader.setId(uuidString);
rcvReceiptHeader.setCreateBy("PMP同步");
rcvReceiptHeader.setCreateTime(LocalDateTime.now());
rcvReceiptHeader.setSysOrgCode("A04");
rcvReceiptHeader.setInvId(invInventory.getId());
rcvReceiptHeader.setReceiptType("PURCHASE_RECEIPT");
rcvReceiptHeader.setReceiptNumber(jsonObject.getString("number"));
rcvReceiptHeader.setShipper(jsonObject.getString("rcvby"));
rcvReceiptHeader.setReceiver(jsonObject.getString("rcvby"));
rcvReceiptHeader.setPartyId("033c46f834004fa6a229f6d8a4c613e0");//暂时填入的默认值
if(jsonObject.getString("rcvtime")==null || jsonObject.getString("rcvtime").equals("")){
rcvReceiptHeader.setHeaderStatus("RECEIVED");//新建
rcvReceiptLine.setLineStatus("RECEIVED");
}else{
rcvReceiptHeader.setHeaderStatus("ACCEPTED");//已入库
rcvReceiptLine.setLineStatus("ACCEPTED");
rcvReceiptHeader.setReceiptDate(TimeUtil.fromDateToLocalDateTime(jsonObject.getString("rcvtime")));
}
//子表
rcvReceiptLine.setId(UuidUtil.get32UUIDString());
rcvReceiptLine.setCreateBy("PMP同步");
rcvReceiptLine.setCreateTime(LocalDateTime.now());
rcvReceiptLine.setSysOrgCode("A04");
rcvReceiptLine.setRcvReceiptHeaderId(uuidString);
rcvReceiptLine.setLineNumber("1");
rcvReceiptLine.setInvId(invInventory.getId());
InvItem invItem = invItemMapper.findAllByPlucode(jsonObject.getString("plucode"));
if(invItem==null){
logger.info(begintime+"---"+new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())+"单号为:"+jsonObject.getString("number")+"商品未同步");
continue;
}
rcvReceiptLine.setItemId(invItem.getId());
rcvReceiptLine.setShippedQuantity(jsonObject.getInteger("qty"));
rcvReceiptLine.setReceivedQuantity(jsonObject.getInteger("qty"));
rcvReceiptLine.setAcceptQuantity(jsonObject.getInteger("qty"));
rcvReceiptLine.setRejectQuantity(0);
rcvReceiptLine.setUnitCode("BEN");
rcvReceiptHeaders.add(rcvReceiptHeader);
rcvReceiptLines.add(rcvReceiptLine);
}
if(rcvReceiptHeaders.size()>0){
rcvReceiptHeaderMapper.insertBatch(rcvReceiptHeaders);
rcvReceiptLineMapper.insertBatch(rcvReceiptLines);
}
}else if(retMsg.size()>10000){
List<RcvReceiptHeader> rcvReceiptHeaders=new ArrayList<>();
List<RcvReceiptLine> rcvReceiptLines=new ArrayList<>();
for (int i=0;i<retMsg.size();i++) {
JSONObject jsonObject = retMsg.get(i);
RcvReceiptHeader rcvReceiptHeader=new RcvReceiptHeader();
RcvReceiptLine rcvReceiptLine=new RcvReceiptLine();
String uuidString = UuidUtil.get32UUIDString();
rcvReceiptHeader.setId(uuidString);
rcvReceiptHeader.setCreateBy("PMP同步");
rcvReceiptHeader.setCreateTime(LocalDateTime.now());
rcvReceiptHeader.setSysOrgCode("A04");
rcvReceiptHeader.setInvId(invInventory.getId());
rcvReceiptHeader.setReceiptType("PURCHASE_RECEIPT");
rcvReceiptHeader.setReceiptNumber(jsonObject.getString("number"));
rcvReceiptHeader.setShipper(jsonObject.getString("rcvby"));//暂时填入的默认值
rcvReceiptHeader.setReceiver(jsonObject.getString("rcvby"));
rcvReceiptHeader.setPartyId("033c46f834004fa6a229f6d8a4c613e0");//暂时填入的默认值
if(jsonObject.getString("rcvtime")==null || jsonObject.getString("rcvtime").equals("")){
rcvReceiptHeader.setHeaderStatus("RECEIVED");//新建
rcvReceiptLine.setLineStatus("RECEIVED");
}else{
rcvReceiptHeader.setHeaderStatus("ACCEPTED");//已入库
rcvReceiptLine.setLineStatus("ACCEPTED");
rcvReceiptHeader.setReceiptDate(TimeUtil.fromDateToLocalDateTime(jsonObject.getString("rcvtime")));
}
//子表
rcvReceiptLine.setId(UuidUtil.get32UUIDString());
rcvReceiptLine.setCreateBy("PMP同步");
rcvReceiptLine.setCreateTime(LocalDateTime.now());
rcvReceiptLine.setSysOrgCode("A04");
rcvReceiptLine.setRcvReceiptHeaderId(uuidString);
rcvReceiptLine.setLineNumber("1");
rcvReceiptLine.setInvId(invInventory.getId());
InvItem invItem = invItemMapper.findAllByPlucode(jsonObject.getString("plucode"));
if(invItem==null){
logger.info(begintime+"---"+new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())+"单号为:"+jsonObject.getString("number")+"商品未同步");
continue;
}
rcvReceiptLine.setItemId(invItem.getId());
rcvReceiptLine.setShippedQuantity(jsonObject.getInteger("qty"));
rcvReceiptLine.setReceivedQuantity(jsonObject.getInteger("qty"));
rcvReceiptLine.setAcceptQuantity(jsonObject.getInteger("qty"));
rcvReceiptLine.setRejectQuantity(0);
rcvReceiptLine.setUnitCode("BEN");
rcvReceiptHeaders.add(rcvReceiptHeader);
rcvReceiptLines.add(rcvReceiptLine);
if(i%10000==0 && retMsg.size()-i>10000){
if(rcvReceiptHeaders.size()>0){
rcvReceiptHeaderMapper.insertBatch(rcvReceiptHeaders);
rcvReceiptLineMapper.insertBatch(rcvReceiptLines);
}
rcvReceiptHeaders.clear();
rcvReceiptLines.clear();
}
if(retMsg.size()==(i+1)){
if(rcvReceiptHeaders.size()>0){
rcvReceiptHeaderMapper.insertBatch(rcvReceiptHeaders);
rcvReceiptLineMapper.insertBatch(rcvReceiptLines);
}
rcvReceiptHeaders.clear();
rcvReceiptLines.clear();
}
}
}
redisTemplate.opsForHash().put("temp_item_fom_pmp",shop,format);
logger.info("同步pmp接收单(集团分发)"+shop+"号仓数据量:"+retMsg.size()+"同步完成");
}catch (Exception e){
logger.error("同步pmp接收单(集团分发)"+shop+"号仓同步失败");
logger.error(e.getMessage());
}
}
}
/**
* 获取时间戳(匹配书城)
* @return 时间戳
*/
public static long getTimestamp() {
long milli = System.currentTimeMillis() + 8*3600*1000;
return (milli*10000)+621355968000000000L;
}
}
//package orthopedics.client;
//
//import com.alibaba.fastjson.JSON;
//import com.alibaba.fastjson.JSONObject;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.core.env.Environment;
//import org.springframework.data.redis.core.RedisTemplate;
//import org.springframework.scheduling.annotation.Scheduled;
//import org.springframework.stereotype.Component;
//import org.springframework.transaction.annotation.Transactional;
//import orthopedics.dao.*;
//import orthopedics.model.*;
//import orthopedics.service.PropertiesServer;
//import orthopedics.util.*;
//
//import java.math.BigDecimal;
//import java.sql.*;
//import java.text.SimpleDateFormat;
//import java.time.LocalDateTime;
//import java.time.ZoneId;
//import java.util.*;
//
///**
// * 同步BMP零售的销售订单
// */
//@Component
//public class SyncTempSalOrderFomPmp {
// private final static Logger logger = LoggerFactory.getLogger(SyncTempSalOrderFomPmp.class);
//
// @Autowired
// private RedisTemplate redisTemplate;
//
// @Autowired
// private Environment env;
//
// @Autowired
// private InvItemMapper invItemMapper;
//
// @Autowired
// private SalOrderHeaderMapper salOrderHeaderMapper;
//
// @Autowired
// private SalOrderLineMapper salOrderLineMapper;
//
// @Autowired
// PropertiesServer propertiesServer;
//
// //每天晚上23点执行
// @Scheduled(cron = "0 0 23 * * ? ")
// @Transactional
// public void scheduler(){
// Connection ct=null;
// PreparedStatement ps=null;
// ResultSet rs=null;
// String begintime= (String) redisTemplate.opsForValue().get("temp_sal_order_fom_pmp");
// if(StringUtil.isEmpty(begintime)){
// begintime=env.getProperty("synchronizationTime");
// }
// try {
// Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
// ct= DriverManager.getConnection("jdbc:sqlserver://130.1.0.32:1433;DatabaseName=shoptxns;sendStringParametersAsUnicode=false","wjkj","wjkj123456");
// ps=ct.prepareStatement("select s1.OPERATOR, s1.TXNTIME,s1.VOUCHNUM,s1.SEQUENCE,s2.DPTCODE,s1.CLSCODE, s1.DISPLAY,s1.CODE, s1.QTY, s1.PRICE, s1.DISC, \n" +
// "s1.ORGAMT, s1.ITEMDISC,s2.PRICE PRICE2\n" +
// "from SHOPTXNS s1\n" +
// "left join SHOPTXNS s2 on Convert(varchar,s1.txntime,23)= Convert(varchar,s2.txntime,23) AND s1.operator=s2.operator AND s1.vouchnum=s2.vouchnum AND s1.TERMINAL=s2.TERMINAL and s2.SALESTYPE = 8\n" +
// "where s1.SALESTYPE = 2 and s1.CODE IS NOT NULL and Convert(varchar,s1.txntime,120)>=?");
// ps.setString(1,begintime);
// rs = ps.executeQuery();
// while (rs.next()){
// String operator = rs.getString(1);//收银员账号
// Timestamp timestamp = rs.getTimestamp(2);//订单时间
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
// String dateStr = sdf.format(timestamp);
// int vouchnum = rs.getInt(3);//小票单号
// int sequence = rs.getInt(4);//单据序号
// String dptcode = rs.getString(5);//支付方式
// String clscode = rs.getString(6);//分类代码(小类)
// String display = rs.getString(7);//分类代码
// String code = rs.getString(8);//商品条码
// int qty = rs.getInt(9);//数量
// int price = rs.getInt(10);//单价
// int disc = rs.getInt(11);//折扣
// int orgamt = rs.getInt(12);//订单总价
// int itemdisc = rs.getInt(13);//扣款金额
// int price2 = rs.getInt(14);//每笔支付方式支付的金额
//
// InvItem invItem = invItemMapper.findAllByPlucode(code);
// SalOrderHeader salOrderHeader=new SalOrderHeader();
// SalOrderLine salOrderLine=new SalOrderLine();
// String uuidString = UuidUtil.get32UUIDString();
// salOrderHeader.setId(uuidString);
// salOrderHeader.setCreateBy("PMP同步");
// salOrderHeader.setCreateTime(LocalDateTime.now());
// salOrderHeader.setSysOrgCode("A04");
// salOrderHeader.setOrgId("2c9007626dde3f4f016deda2151f1a42");
// salOrderHeader.setOrderTypeId("2c9007626e0202af016e16c0672b2000");
// salOrderHeader.setOrderDate(TimeUtil.fromDateToLocalDateTime(dateStr));
// salOrderHeader.setOrderNumber(propertiesServer.generateFlowingWater("SAL_ORDER_NUMBER"));
// salOrderHeader.setCustomerId("2c9007626df2ab5b016dfd0edccb0039");
// salOrderHeader.setOrderCurrency("CNY");
// salOrderHeader.setPaymentMethod(dptcode);
// salOrderHeader.setSellerId("a9a2c497f64011e9a1b10242ac110002");
//
// //封装从表数据
// salOrderLine.setId(UuidUtil.get32UUIDString());
// salOrderLine.setCreateTime(LocalDateTime.now());
// salOrderLine.setSysOrgCode("A04");
// salOrderLine.setOrgId("2c9007626dde3f4f016deda2151f1a42");
// salOrderLine.setSalOrderHeaderId(uuidString);
// salOrderLine.setLineNumber("1");
// salOrderLine.setItemCode(invItem.getItemCode());
// salOrderLine.setItemName(invItem.getItemName());
// salOrderLine.setItemDesc(invItem.getItemDesc());
// salOrderLine.setQuantity(quantity);
// salOrderLine.setUnitCode("BEN");
// salOrderLine.setSalePrice(BigDecimal.valueOf(attribute1/100));
// salOrderLine.setTaxRate("0");
// salOrderLine.setAttribute3(attribute3/100+"");
// salOrderLine.setAttribute2(Double.valueOf(attribute2/100));
// salOrderLine.setLineStatus("completed");
// salOrderLine.setOrderHeaderId(hid);
// salOrderLine.setItemId(invItem.getId());
// salOrderHeaderMapper.insert(salOrderHeader);
// salOrderLineMapper.insert(salOrderLine);
//
// }
//
// }catch (Exception e){
// logger.error("同步BMP零售的销售订单失败");
// logger.error(e.getMessage());
// }finally {
// try {
// if(rs!=null){
// rs.close();
// }
// if(ps!=null){
// ps.close();
// }
// if(ct!=null){
// ct.close();
// }
// } catch (SQLException e) {
// logger.error("将POS的销售订单同步到ERP流关闭异常");
// }
// }
//
// }
//
//
// /**
// * 获取时间戳(匹配书城)
// * @return 时间戳
// */
// public static long getTimestamp() {
// long milli = System.currentTimeMillis() + 8*3600*1000;
// return (milli*10000)+621355968000000000L;
// }
//
//}
package orthopedics.client;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import orthopedics.dao.*;
import orthopedics.model.*;
import orthopedics.util.Aes;
import orthopedics.util.HttpUtilPMP;
import orthopedics.util.HttpUtilRSA;
import orthopedics.util.UuidUtil;
import java.time.LocalDateTime;
import java.util.*;
/**
* 同步pmp供应商信息
*/
@Component
public class SyncTempSupplierFomPmp {
private final static Logger logger = LoggerFactory.getLogger(SyncTempSupplierFomPmp.class);
@Autowired
private PurSupplierMapper purSupplierMapper;
@Autowired
private PurSupplierSiteMapper purSupplierSiteMapper;
@Autowired
private PurSupplierContactMapper purSupplierContactMapper;
//每天晚上23点执行
@Scheduled(cron = "0 0 23 * * ? ")
@Transactional
public void scheduler(){
String gettoken = HttpUtilRSA.getToken();
String token = (String) JSONObject.parseObject(gettoken).get("Token");
String tempEncryptKey = (String) JSONObject.parseObject(gettoken).get("TempEncryKey");
JSONObject data=new JSONObject();
data.put("uniquekey","获取供商列表");
data.put("timestamp", getTimestamp());
data.put("begintime","1995-01-11 18:00:00");
data.put("endTime","2119-12-12 18:00:00");
Map headers=new HashMap();
headers.put("Content-Type","application/json");
headers.put("token",token);
byte[] encrypt = Aes.encrypt(JSON.toJSONString(data), tempEncryptKey, tempEncryptKey);
byte[] bytes = new byte[0];
try {
bytes = HttpUtilPMP.postBy("http://pmpapi.szcbfx.com/api/pmp/ExchangePMPData", encrypt,token);
} catch (Exception e) {
logger.error(e.getMessage());
}
String s = new String(bytes);
JSONObject object = JSONObject.parseObject(s);
Object result = object.get("result");
if(result==null||!result.equals("success")){
logger.error((String) object.get("ret_msg"));
return;
}
List<JSONObject> retMsg= (List<JSONObject>) object.get("ret_msg");
if(retMsg==null || retMsg.size()<=0){
logger.info("没有可同步的区域数据");
return;
}
List<PurSupplier> purSuppliers=new ArrayList<>();
List<PurSupplierSite> purSupplierSites=new ArrayList<>();
List<PurSupplierContact> purSupplierContacts=new ArrayList<>();
for (JSONObject jsonObject:retMsg) {
List<PurSupplier> purSuppliers1 = purSupplierMapper.selectByCode(jsonObject.getString("code"));
if(purSuppliers1!=null && purSuppliers1.size()>0){
continue;
}
PurSupplier purSupplier=new PurSupplier();
PurSupplierSite purSupplierSite=new PurSupplierSite();
PurSupplierContact purSupplierContact=new PurSupplierContact();
String uuid = UuidUtil.get32UUIDString();
purSupplier.setId(uuid);
purSupplier.setCreateBy("PMP同步");
purSupplier.setCreateTime(LocalDateTime.now());
purSupplier.setSupplierCode(jsonObject.getString("code"));
purSupplier.setSupplierName(jsonObject.getString("fullname"));
purSupplier.setSupplierShortName(jsonObject.getString("shortname"));
purSupplier.setStatus("A");
String uuidSite = UuidUtil.get32UUIDString();
purSupplierSite.setId(uuidSite);
purSupplierSite.setCreateBy("PMP同步");
purSupplierSite.setCreateTime(LocalDateTime.now());
purSupplierSite.setSupplierId(uuid);
purSupplierSite.setSupplierSiteName(jsonObject.getString("address"));
purSupplierSite.setTelephone(jsonObject.getString("phone"));
purSupplierSite.setStatus("A");
purSupplierContact.setId(UuidUtil.get32UUIDString());
purSupplierContact.setCreateBy("PMP同步");
purSupplierContact.setCreateTime(LocalDateTime.now());
purSupplierContact.setSupplierId(uuid);
purSupplierContact.setSupplierSiteId(uuidSite);
purSupplierContact.setContactName(jsonObject.getString("contact"));
purSupplierContact.setTelephone(jsonObject.getString("phone"));
purSupplierContact.setStatus("A");
purSuppliers.add(purSupplier);
purSupplierSites.add(purSupplierSite);
purSupplierContacts.add(purSupplierContact);
}
if(purSuppliers.size()>0){
purSupplierMapper.insertBatch(purSuppliers);
purSupplierSiteMapper.insertBatch(purSupplierSites);
purSupplierContactMapper.insertBatch(purSupplierContacts);
}
logger.info("获取供商列表供应商同步完成");
}
/**
* 获取时间戳(匹配书城)
* @return 时间戳
*/
public static long getTimestamp() {
long milli = System.currentTimeMillis() + 8*3600*1000;
return (milli*10000)+621355968000000000L;
}
}
package orthopedics.client;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import orthopedics.dao.*;
import orthopedics.model.*;
import orthopedics.util.*;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.util.*;
/**
* 同步pmp发运单
*/
@Component
public class SyncTempWshShipmentFomPmp {
private final static Logger logger = LoggerFactory.getLogger(SyncTempWshShipmentFomPmp.class);
@Autowired
private RedisTemplate redisTemplate;
@Autowired
private InvInventoryMapper invInventoryMapper;
@Autowired
private Environment env;
@Autowired
private WshShipmentHeaderMapper wshShipmentHeaderMapper;
@Autowired
private WshShipmentLineMapper wshShipmentLineMapper;
@Autowired
private InvItemMapper invItemMapper;
//每天晚上23点执行
@Scheduled(cron = "0 0 23 * * ? ")
@Transactional
public void scheduler(){
List<InvInventory> sortidByInvDesc = invInventoryMapper.getSortidByInvDesc();
String gettoken = HttpUtilRSA.getToken();
String token = (String) JSONObject.parseObject(gettoken).get("Token");
String tempEncryptKey = (String) JSONObject.parseObject(gettoken).get("TempEncryKey");
for (InvInventory invInventory:sortidByInvDesc) {
String shop = invInventory.getSortid();
try {
String begintime= (String) redisTemplate.opsForHash().get("temp_wsh_shipment_fom_pmp",shop);
if(StringUtil.isEmpty(begintime)){
begintime=env.getProperty("synchronizationTime");
}
String format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
JSONObject data=new JSONObject();
data.put("uniquekey","获取退仓单实际收货数");
data.put("timestamp", getTimestamp());
data.put("begintime",begintime);
data.put("endTime",format);
data.put("shop",shop);
Map headers=new HashMap();
headers.put("Content-Type","application/json");
headers.put("token",token);
byte[] encrypt = Aes.encrypt(JSON.toJSONString(data), tempEncryptKey, tempEncryptKey);
byte[] bytes = new byte[0];
bytes = HttpUtilPMP.postBy("http://pmpapi.szcbfx.com/api/pmp/ExchangePMPData", encrypt,token);
String s = new String(bytes);
JSONObject object = JSONObject.parseObject(s);
Object result = object.get("result");
if(result==null||!result.equals("success")){
logger.error((String) object.get("ret_msg"));
return;
}
List<JSONObject> retMsg= (List<JSONObject>) object.get("ret_msg");
if(retMsg==null || retMsg.size()<=0){
logger.info("没有可同步的发运单数据");
return;
}
if(retMsg.size()<=10000 && retMsg.size()>0){
List<WshShipmentHeader> wshShipmentHeaders=new ArrayList<>();
List<WshShipmentLine> wshShipmentLines=new ArrayList<>();
for (JSONObject jsonObject:retMsg) {
WshShipmentHeader wshShipmentHeader=new WshShipmentHeader();
WshShipmentLine wshShipmentLine=new WshShipmentLine();
String uuidString = UuidUtil.get32UUIDString();
wshShipmentHeader.setId(uuidString);
wshShipmentHeader.setCreateBy("PMP同步");
wshShipmentHeader.setCreateTime(LocalDateTime.now());
wshShipmentHeader.setSysOrgCode("A04");
wshShipmentHeader.setInvId(invInventory.getId());
wshShipmentHeader.setShipmentType("PURCHASE_RETURN");
wshShipmentHeader.setShipmentNumber(jsonObject.getString("number"));
wshShipmentHeader.setPartyId(jsonObject.getString("torack"));
if(jsonObject.getString("txndate")==null || jsonObject.getString("txndate").equals("")){
wshShipmentHeader.setHeaderStatus("ENTERED");
wshShipmentLine.setLineStatus("ENTERED");
}else{
wshShipmentHeader.setHeaderStatus("SHIPPED");
wshShipmentLine.setLineStatus("SHIPPED");
wshShipmentHeader.setShipmentDate(TimeUtil.fromDateToLocalDateTime(jsonObject.getString("txndate")));
}
//行表
wshShipmentLine.setId(UuidUtil.get32UUIDString());
wshShipmentLine.setCreateBy("PMP同步");
wshShipmentLine.setCreateTime(LocalDateTime.now());
wshShipmentLine.setSysOrgCode("A04");
wshShipmentLine.setInvId(invInventory.getId());
wshShipmentLine.setLineNumber("1");
InvItem invItem = invItemMapper.findAllByPlucode(jsonObject.getString("plucode"));
if(invItem==null){
logger.info(begintime+"---"+new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())+"单号为:"+jsonObject.getString("number")+"商品未同步");
continue;
}
wshShipmentLine.setItemId(invItem.getId());
wshShipmentLine.setQuantity(jsonObject.getInteger("qty"));
wshShipmentHeaders.add(wshShipmentHeader);
wshShipmentLines.add(wshShipmentLine);
}
if(wshShipmentHeaders.size()>0){
wshShipmentHeaderMapper.insertBatch(wshShipmentHeaders);
wshShipmentLineMapper.insertBatch(wshShipmentLines);
}
}else if(retMsg.size()>10000){
List<WshShipmentHeader> wshShipmentHeaders=new ArrayList<>();
List<WshShipmentLine> wshShipmentLines=new ArrayList<>();
for (int i=0;i<retMsg.size();i++) {
JSONObject jsonObject = retMsg.get(i);
WshShipmentHeader wshShipmentHeader=new WshShipmentHeader();
WshShipmentLine wshShipmentLine=new WshShipmentLine();
String uuidString = UuidUtil.get32UUIDString();
wshShipmentHeader.setId(uuidString);
wshShipmentHeader.setCreateBy("PMP同步");
wshShipmentHeader.setCreateTime(LocalDateTime.now());
wshShipmentHeader.setSysOrgCode("A04");
wshShipmentHeader.setInvId(invInventory.getId());
wshShipmentHeader.setShipmentType("PURCHASE_RETURN");
wshShipmentHeader.setShipmentNumber(jsonObject.getString("number"));
wshShipmentHeader.setPartyId(jsonObject.getString("torack"));
if(jsonObject.getString("txndate")==null || jsonObject.getString("txndate").equals("")){
wshShipmentHeader.setHeaderStatus("ENTERED");
wshShipmentLine.setLineStatus("ENTERED");
}else{
wshShipmentHeader.setHeaderStatus("SHIPPED");
wshShipmentLine.setLineStatus("SHIPPED");
wshShipmentHeader.setShipmentDate(TimeUtil.fromDateToLocalDateTime(jsonObject.getString("txndate")));
}
//行表
wshShipmentLine.setId(UuidUtil.get32UUIDString());
wshShipmentLine.setCreateBy("PMP同步");
wshShipmentLine.setCreateTime(LocalDateTime.now());
wshShipmentLine.setSysOrgCode("A04");
wshShipmentLine.setInvId(invInventory.getId());
wshShipmentLine.setLineNumber("1");
InvItem invItem = invItemMapper.findAllByPlucode(jsonObject.getString("plucode"));
if(invItem==null){
logger.info(begintime+"---"+new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())+"单号为:"+jsonObject.getString("number")+"商品未同步");
continue;
}
wshShipmentLine.setItemId(invItem.getId());
wshShipmentLine.setQuantity(jsonObject.getInteger("qty"));
wshShipmentHeaders.add(wshShipmentHeader);
wshShipmentLines.add(wshShipmentLine);
if(i%10000==0 && retMsg.size()-i>10000){
if(wshShipmentHeaders.size()>0){
wshShipmentHeaderMapper.insertBatch(wshShipmentHeaders);
wshShipmentLineMapper.insertBatch(wshShipmentLines);
}
wshShipmentHeaders.clear();
wshShipmentLines.clear();
}
if(retMsg.size()==(i+1)){
if(wshShipmentHeaders.size()>0){
wshShipmentHeaderMapper.insertBatch(wshShipmentHeaders);
wshShipmentLineMapper.insertBatch(wshShipmentLines);
}
wshShipmentHeaders.clear();
wshShipmentLines.clear();
}
}
}
redisTemplate.opsForHash().put("temp_wsh_shipment_fom_pmp",shop,format);
logger.info("同步pmp发运单"+shop+"号仓数据量:"+retMsg.size()+"同步完成");
}catch (Exception e){
logger.error("同步pmp发运单"+shop+"号仓同步失败");
logger.error(e.getMessage());
}
}
}
/**
* 获取时间戳(匹配书城)
* @return 时间戳
*/
public static long getTimestamp() {
long milli = System.currentTimeMillis() + 8*3600*1000;
return (milli*10000)+621355968000000000L;
}
}
......@@ -171,11 +171,13 @@ public class InvCountHeaderController {
}
@GetMapping("/findByHeaderStatus")
public Result findByHeaderStatus(@RequestParam(value = "access_token",required = true)String token){
public Result findByHeaderStatus(@RequestParam(value = "access_token",required = true)String token,@RequestParam(value = "invId",required = true)String invId){
SysAccessToken sysAccessToken = userServer.checkToken(token);
List<InvCountHeaderPage> ichp=new ArrayList<>();
List<InvCountHeader> invCountHeaders = invCountHeaderMapper.fingByHeaderStatus("new");
if(StringUtil.isEmpty(invId)){
return new Result(false, StatusCode.ERROR,"参数为空");
}
List<InvCountHeader> invCountHeaders = invCountHeaderMapper.fingByHeaderStatus("new",invId);
if(invCountHeaders==null ||invCountHeaders.size()<=0){
return new Result(false, StatusCode.ERROR,"没有状态为【新增】数据");
}
......
......@@ -12,9 +12,7 @@ import orthopedics.util.StatusCode;
import java.util.List;
/**
* 库存信息同步到ERS
*/
@RestController
@RequestMapping("/bookcity/InvItemRfid")
public class InvItemRfidController {
......@@ -22,12 +20,24 @@ public class InvItemRfidController {
@Autowired
private InvItemRfidService invItemRfidService;
/**
* 生成rfid保存
* @param invItemRfid
* @param token
* @return
*/
@PostMapping("/save")
public Result save(@RequestBody InvItemRfid invItemRfid,@RequestParam(value = "access_token",required = true)String token ){
String save= invItemRfidService.save(token, invItemRfid);
return new Result(true, StatusCode.OK,"已生成"+save+"条记录");
}
/**
* 将库存同步到ers
* @param strings
* @param token
* @return
*/
@PostMapping("/putaway")
public Result update(@RequestBody List<String> strings, @RequestParam(value = "access_token",required = true)String token ){
String putaway = invItemRfidService.putaway(token, strings);
......
......@@ -5,11 +5,9 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import orthopedics.dao.WarTransferLineMapper;
import orthopedics.dao.WarTransferMapper;
import orthopedics.model.SysAccessToken;
import orthopedics.model.WarTransfer;
import orthopedics.model.WarTransferLine;
import orthopedics.dao.*;
import orthopedics.model.*;
import orthopedics.service.HrPersonOrgService;
import orthopedics.service.PropertiesServer;
import orthopedics.service.UserServer;
import orthopedics.util.Result;
......@@ -37,6 +35,15 @@ public class WarTransferController {
@Autowired
private WarTransferLineMapper warTransferLineMapper;
@Autowired
private WshParameterMapper wshParameterMapper;
@Autowired
private InvInventoryMapper invInventoryMapper;
@Autowired
private HrPersonOrgMapper hrPersonOrgMapper;
@PostMapping("/add")
public Result add(@RequestBody WarTransferPage warTransferPage, @RequestParam(value = "access_token",required = true)String token){
......@@ -61,6 +68,26 @@ public class WarTransferController {
warTransferPage.setDeliveryName(sysAccessToken.getUserId());
warTransferPage.setRequestorId(sysAccessToken.getUserId());
warTransferPage.setOrderStatus("completed");
InvInventory byInvCode = invInventoryMapper.findByInvCode(warTransferPage.getInvCode());
InvInventory byInvCodeIn = invInventoryMapper.findByInvCode(warTransferPage.getInInvCode());
if(byInvCode==null){
return new Result(false, StatusCode.ERROR,"调入库存code有误");
}
if(byInvCode==null){
return new Result(false, StatusCode.ERROR,"调出库存code有误");
}
List<WshParameter> wshParameters = wshParameterMapper.selectByInvIdByupdateTime(byInvCode.getId());
if(wshParameters==null || wshParameters.size()<=0){
return new Result(false, StatusCode.ERROR,"请维护发运参数");
}
warTransferPage.setSubinvCode(wshParameters.get(0).getDefaultShippingSubinvId());
warTransferPage.setExcutorId(sysAccessToken.getUserId());
warTransferPage.setInInvName(byInvCodeIn.getInv_name());
warTransferPage.setInvName(byInvCode.getInv_name());
List<HrPersonOrg> hrPersonOrgs = hrPersonOrgMapper.selectByPersonId(sysAccessToken.getUserId());
if(hrPersonOrgs!=null && hrPersonOrgs.size()>0){
warTransferPage.setOrgId(hrPersonOrgs.get(0).getOrgId());
}
//行数据封装
List<WarTransferLine> warTransferLineList = warTransferPage.getWarTransferLineList();
......
package orthopedics.controller.bookcity;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.*;
import orthopedics.controller.v1.TransactionController;
import orthopedics.dao.*;
import orthopedics.model.*;
import orthopedics.service.UserServer;
import orthopedics.util.*;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.*;
/**
* 商品临时表
*/
@RestController
@RequestMapping("/tempItemFomPmp")
public class tempItemFomPmpController {
private final static Logger logger = LoggerFactory.getLogger(tempItemFomPmpController.class);
@Autowired
private UserServer userServer;
@Autowired
private RedisTemplate redisTemplate;
@Autowired
private InvItemMapper invItemMapper;
@Autowired
private InvItemSkuMapper invItemSkuMapper;
@Autowired
private InvItemAttributeMapper invItemAttributeMapper;
@Autowired
private TempItemFomPmpMapper tempItemFomPmpMapper;
@Autowired
private IdWorker idWorker;
/**
* C#时间戳
* @return
*/
public static long getTimestamp() {
long milli = System.currentTimeMillis() + 8*3600*1000;
return (milli*10000)+621355968000000000L;
}
/**
* 同步集团商品数据
*/
@GetMapping("/getItem")
public Result getItem(@RequestParam("access_token")String access_token){
SysAccessToken sysAccessToken = userServer.checkToken(access_token);
String gettoken = HttpUtilRSA.getToken();
if(StringUtil.isEmpty(gettoken)){
return new Result(false, StatusCode.ERROR,"获取PMP系统token失败");
}
JSONObject jsonObject = JSONObject.parseObject(gettoken);
String token = jsonObject.getString("Token");
String tempEncryptKey = jsonObject.getString("TempEncryKey");
String begintime= (String) redisTemplate.opsForValue().get("getPMPInvItem");
if(StringUtil.isEmpty(begintime)){
begintime="2019-10-17 00:12:13";
}
JSONObject data=new JSONObject();
data.put("uniquekey","获取商品资料列表");
data.put("timestamp", getTimestamp());
data.put("begintime",begintime);
data.put("endTime",new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
byte[] encrypt = Aes.encrypt(JSON.toJSONString(data), tempEncryptKey, tempEncryptKey);
try {
byte[] bytes = HttpUtilPMP.postBy("http://pmpapi.szcbfx.com/api/pmp/ExchangePMPData", encrypt,token);
String s = new String(bytes);
JSONObject object = JSONObject.parseObject(s);
Object result = object.get("result");
if(result==null||!result.equals("success")){
logger.error((String) object.get("ret_msg"));
return new Result(false,StatusCode.ERROR, (String) object.get("ret_msg"));
}
List<JSONObject> retMsg= (List<JSONObject>) object.get("ret_msg");
if(retMsg==null || retMsg.size()<=0){
return new Result(false,StatusCode.ERROR, "没有可同步的数据");
}
int num=0;
List<InvItem> invItems=new ArrayList<>();
List<InvItemAttribute> invItemAttributes=new ArrayList<>();
List<InvItemSku> invItemSkus=new ArrayList<>();
List<TempItemFomPmp> tempItemFomPmps=new ArrayList<>();
for (JSONObject item:retMsg) {
//检测是否是重复数据
String plucode = item.getString("PLUCODE");
if(StringUtil.isEmpty(plucode)){
continue;
}
InvItem item1 = invItemMapper.selectByPlucode(plucode);
if(item1!=null){
invItemMapper.deleteByPlucode(plucode);
invItemSkuMapper.deleteByItemCode(invItems.get(0).getItemCode());
invItemAttributeMapper.deleteByItemCode(invItems.get(0).getItemCode());
tempItemFomPmpMapper.deleteByPlucode(plucode);
}
InvItem invItem=new InvItem();
InvItemAttribute invItemAttribute=new InvItemAttribute();
InvItemSku invItemSku=new InvItemSku();
// InvItemPmp invItemPmp=new InvItemPmp();
TempItemFomPmp tempItemFomPmp=new TempItemFomPmp();
//商品表
invItem.setId(UuidUtil.get32UUIDString());
invItem.setOrgId("2c9007626dde3f4f016deda2151f1a42");
invItem.setStatus("SALE");
if(StringUtil.isEmpty(item.getString("CLSCODE"))){
invItem.setProType("14");
}else{
invItem.setProType(item.getString("CLSCODE"));
}
invItem.setItemCode(idWorker.nextId()+"");
invItem.setItemName(item.getString("TITLE"));
invItem.setItemDesc(item.getString("JP"));
invItem.setPystype(item.getString("PYSTYPE"));
invItem.setIsbn(item.getString("ISBN"));
invItem.setPlucode(item.getString("PLUCODE"));
invItem.setScancode(item.getString("SCANCODE"));
invItem.setExtcode("0");
invItem.setPurchasePrice(item.getString("PRICE"));
invItem.setGeneralName(item.getString("CLSCODE"));
invItem.setManufacturerId(item.getString("PUBLISHER"));
if(!StringUtil.isEmpty(item.getDate("PUBDATE"))){
invItem.setSpecification(item.getDate("PUBDATE").toInstant()
.atZone( ZoneId.systemDefault() )
.toLocalDateTime());
}
invItem.setPrimaryUnit("BEN");
if(item.getString("PYSTYPE").equals("0")||item.getString("PYSTYPE").equals("4")){
invItem.setAttribute1("Book");
invItem.setIsBorrow("Y");
}else{
invItem.setAttribute1("Goods");
invItem.setIsBorrow("N");
}
invItem.setAttribute2("A");
invItem.setTax(item.getString("INCTAX"));
invItem.setDefaultVendorId("000000006c60dba1016c60f839270004");
invItem.setCreateBy(sysAccessToken.getUserName());
invItem.setCreateTime(LocalDateTime.now());
//查询当前用户部门
//SysUserDepart sysUserDepart = sysUserDepartMapper.selectByUserId(sysAccessToken.getUserId());
//图书信息
invItemAttribute.setId(UuidUtil.get32UUIDString());
invItemAttribute.setCreateBy(sysAccessToken.getUserName());
invItemAttribute.setCreateTime(LocalDateTime.now());
// if(sysUserDepart!=null){
// invItemAttribute.setSysOrgCode(sysUserDepart.getDepId());
// }
invItemAttribute.setItemId(invItem.getId());
invItemAttribute.setItemCode(invItem.getItemCode());
invItemAttribute.setAuthor(item.getString("AUTHOR"));
invItemAttribute.setReader(item.getString("READER"));
//商品SKU映射
invItemSku.setId(UuidUtil.get32UUIDString());
// if(sysUserDepart!=null){
// invItemSku.setSysOrgCode(sysUserDepart.getDepId());
// }
invItemSku.setOrgId("2c9007626dde3f4f016deda2151f1a42");
invItemSku.setExternal("PMP");
invItemSku.setItemSku(item.getString("PLUCODE"));
invItemSku.setItemName(invItem.getItemName());
invItemSku.setItemCode(invItem.getItemCode());
invItemSku.setItemDesc(invItem.getItemDesc());
invItemSku.setStatus("A");
invItemSku.setCreateBy(sysAccessToken.getUserName());
invItemSku.setCreateTime(LocalDateTime.now());
//pmp商品缓存表
tempItemFomPmp.setId(UuidUtil.get32UUIDString());
tempItemFomPmp.setPlucode(item.getString("PLUCODE"));
tempItemFomPmp.setPystype(item.getInteger("PYSTYPE"));
tempItemFomPmp.setIsbn(item.getString("ISBN"));
tempItemFomPmp.setScancode(item.getString("SCANCODE"));
tempItemFomPmp.setTitle(item.getString("TITLE"));
tempItemFomPmp.setJp(item.getString("JP"));
tempItemFomPmp.setPrice(item.getBigDecimal("PRICE"));
tempItemFomPmp.setClscode(item.getString("CLSCODE"));
tempItemFomPmp.setClsname(item.getString("CLSNAME"));
tempItemFomPmp.setPublisher(item.getString("PUBLISHER"));
tempItemFomPmp.setPubname(item.getString("PUBNAME"));
if(!StringUtil.isEmpty(item.getDate("PUBDATE"))){
tempItemFomPmp.setPubdate(item.getDate("PUBDATE").toInstant()
.atZone( ZoneId.systemDefault() )
.toLocalDateTime());
}
tempItemFomPmp.setDptcode(item.getString("DPTCODE"));
tempItemFomPmp.setDptname(item.getString("DPTNAME"));
tempItemFomPmp.setSeries(item.getString("SERIES"));
tempItemFomPmp.setAuthor(item.getString("AUTHOR"));
tempItemFomPmp.setReader(item.getString("READER"));
if(!StringUtil.isEmpty(item.getDate("FSTDATE"))){
tempItemFomPmp.setFstdate(item.getDate("FSTDATE").toInstant()
.atZone( ZoneId.systemDefault() )
.toLocalDateTime());
}
tempItemFomPmp.setFstdisc(item.getBigDecimal("FSTDISC"));
tempItemFomPmp.setLstdisc(item.getBigDecimal("LSTDISC"));
tempItemFomPmp.setMaxdisc(item.getBigDecimal("MAXDISC"));
tempItemFomPmp.setMindisc(item.getBigDecimal("MINDISC"));
tempItemFomPmp.setVendor(item.getString("VENDOR"));
tempItemFomPmp.setTranstitle(item.getString("TRANSTITLE"));
tempItemFomPmp.setInctax(item.getInteger("INCTAX"));
tempItemFomPmp.setOriginprice(item.getBigDecimal("ORIGINPRICE"));
tempItemFomPmp.setCurrency(item.getString("CURRENCY"));
tempItemFomPmp.setStatus(1);
invItems.add(invItem);
invItemSkus.add(invItemSku);
invItemAttributes.add(invItemAttribute);
tempItemFomPmps.add(tempItemFomPmp);
num=num+1;
}
if(invItems==null || retMsg.size()<=0){
return new Result(false,StatusCode.ERROR, "没有可同步的数据");
}
invItemMapper.insertBatch(invItems);
invItemSkuMapper.insertBatch(invItemSkus);
invItemAttributeMapper.insertBatch(invItemAttributes);
tempItemFomPmpMapper.insertBatch(tempItemFomPmps);
redisTemplate.opsForValue().set("getPMPInvItem",new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
return new Result(true,StatusCode.OK,"已同步"+num+"条数据");
} catch (Exception e) {
logger.error("数据保存发生异常");
return new Result(false,StatusCode.ERROR,"数据保存发生异常");
}
}
@Autowired
private TempItemSkuFomPmpMapper tempItemSkuFomPmpMapper;
@Autowired
private TransactionController transactionController;
@Autowired
private InvTransactionMapper invTransactionMapper;
/**
* 同步集团库存信息
* @return
*/
@PostMapping("/getItemSku")
public Result getItemSku(@RequestParam("access_token")String access_token,List<String> plucodes){
SysAccessToken sysAccessToken = userServer.checkToken(access_token);
if(plucodes==null || plucodes.size()<=0){
plucodes = invItemMapper.getPlucodeAll();
}
String gettoken = HttpUtilRSA.getToken();
String token = (String) JSONObject.parseObject(gettoken).get("Token");
String tempEncryptKey = (String) JSONObject.parseObject(gettoken).get("TempEncryKey");
JSONObject data=new JSONObject();
List<JSONObject> plulist=new ArrayList<>();
for (String plucode:plucodes) {
if(StringUtil.isEmpty(plucode)){
continue;
}
JSONObject jsonObject=new JSONObject();
jsonObject.put("plucode",plucode);
plulist.add(jsonObject);
}
data.put("uniquekey","可配库存查询");
data.put("timestamp", getTimestamp());
data.put("shop", "2");
data.put("plulist",plulist);
Map headers=new HashMap();
headers.put("Content-Type","application/json");
headers.put("token",token);
byte[] encrypt = Aes.encrypt(JSON.toJSONString(data), tempEncryptKey, tempEncryptKey);
byte[] bytes = new byte[0];
try {
bytes = HttpUtilPMP.postBy("http://pmpapi.szcbfx.com/api/pmp/ExchangePMPData", encrypt,token);
} catch (Exception e) {
logger.error("请求异常");
}
String s = new String(bytes);
JSONObject object = JSONObject.parseObject(s);
List<JSONObject> retMsg= (List<JSONObject>) object.get("ret_msg");
System.err.println(retMsg.size());
List<TempItemSkuFomPmp> tempItemSkuFomPmps=new ArrayList<>();
for (JSONObject jsonObject:retMsg) {
TempItemSkuFomPmp tempItemSkuFomPmp=new TempItemSkuFomPmp();
tempItemSkuFomPmp.setId(UuidUtil.get32UUIDString());
tempItemSkuFomPmp.setRack(jsonObject.getString("rack"));
tempItemSkuFomPmp.setPlucode(jsonObject.getString("plucode"));
tempItemSkuFomPmp.setTitle(jsonObject.getString("title"));
tempItemSkuFomPmp.setPrice(jsonObject.getBigDecimal("price"));
tempItemSkuFomPmp.setQty(jsonObject.getInteger("qty"));
tempItemSkuFomPmps.add(tempItemSkuFomPmp);
}
tempItemSkuFomPmpMapper.insertBatch(tempItemSkuFomPmps);
logger.error("已同步"+retMsg.size()+"条库存数据数据");
return new Result(true,StatusCode.OK,"已同步"+retMsg.size()+"条库存数据数据");
}
}
......@@ -310,11 +310,11 @@ public class TakeStockController {
if(StringUtil.isEmpty(plucode)){
continue;
}
List<InvItem> invItems = invItemMapper.selectByPlucode(plucode);
if(invItems!=null&&invItems.size()>0){
InvItem invItem1 = invItemMapper.selectByPlucode(plucode);
if(invItem1!=null){
invItemMapper.deleteByPlucode(plucode);
invItemSkuMapper.deleteByItemCode(invItems.get(0).getItemCode());
invItemAttributeMapper.deleteByItemCode(invItems.get(0).getItemCode());
invItemSkuMapper.deleteByItemCode(invItem1.getItemCode());
invItemAttributeMapper.deleteByItemCode(invItem1.getItemCode());
invItemPmpMapper.deleteByPlucode(plucode);
}
InvItem invItem=new InvItem();
......@@ -518,11 +518,11 @@ public class TakeStockController {
if(StringUtil.isEmpty(plucode)){
continue;
}
List<InvItem> invItems = invItemMapper.selectByPlucode(plucode);
if(invItems!=null&&invItems.size()>0){
InvItem invItem1 = invItemMapper.selectByPlucode(plucode);
if(invItem1!=null){
invItemMapper.deleteByPlucode(plucode);
invItemSkuMapper.deleteByItemCode(invItems.get(0).getItemCode());
invItemAttributeMapper.deleteByItemCode(invItems.get(0).getItemCode());
invItemSkuMapper.deleteByItemCode(invItem1.getItemCode());
invItemAttributeMapper.deleteByItemCode(invItem1.getItemCode());
invItemPmpMapper.deleteByPlucode(plucode);
}
InvItem invItem=new InvItem();
......
......@@ -15,6 +15,7 @@ import orthopedics.controller.operation.PurOrderHeaderStatusEnum;
import orthopedics.controller.operation.PurOrderLineStatusEnum;
import orthopedics.dao.InvCategoryMapper;
import orthopedics.dao.PurOrderHeaderMapper;
import orthopedics.dao.RcvParameterMapper;
import orthopedics.model.*;
import orthopedics.service.*;
import orthopedics.util.*;
......@@ -53,6 +54,9 @@ public class PurchaseController {
@Autowired
private PurOrderHeaderMapper purOrderHeaderMapper;
@Autowired
private RcvParameterMapper rcvParameterMapper;
/**
* @param accessToken
* @param requestJson
......@@ -199,31 +203,22 @@ public class PurchaseController {
}
String subinvCode = object.getString("subinv_code");
if (!StringUtil.isEmpty(subinvCode)) {
InvSubinventory invSubinventory = inventoryServer.selectSubInventoryBySubInvCode(inventory.getId() ,subinvCode);
if (invSubinventory == null) {
logger.info("subinv_code值非法");
throw ErrorEnum.IllegalParamError.createException("subinv_code",subinvCode);
}
object.put("subinv_id", invSubinventory.getId());
} else {
//目的地为入库时,subinv_code必传
if (destination.equals("INVENTORY") ||
(categoryCode.startsWith(TopToolCategoryCode) && (destination.equals("INSPECTION")))) {
logger.info("subinv_code");
throw ErrorEnum.NotAllowToBeEmptyError.createException("subinv_code");
}
}
String locatorCode = object.getString("locator_code");
if (!StringUtil.isEmpty(subinvCode) && !StringUtil.isEmpty(locatorCode)) {
String locatorId = inventoryServer.selectLocatorIdByCode
(inventory.getId() ,object.getString("subinv_id"), locatorCode);
if (StringUtil.isEmpty(locatorId)) {
logger.info("locator_code");
throw ErrorEnum.IllegalParamError.createException("locator_code",locatorCode);
}
object.put("locator_id", locatorId);
List<RcvParameter> rcvParameters = rcvParameterMapper.selectByInvIdByupdateTime(inventory.getId());
if(rcvParameters==null || rcvParameters.size()<=0){
throw ErrorEnum.IllegalParamError.createException("inv_code", inventory.getId());
}
if(StringUtil.isEmpty(subinvCode)){
object.put("subinv_id", rcvParameters.get(0).getDefaultReceivingSubinvId());
}else{
object.put("subinv_id", subinvCode);
}
if(StringUtil.isEmpty(locatorCode)){
object.put("subinv_id", rcvParameters.get(0).getDefaultReceivingLocatorId());
}else{
object.put("subinv_id", locatorCode);
}
String lineSourceHeaderNumber = object.getString("source_header_number");
String lineSourceHeaderId = headerSourceHeaderId;
String lineSourceLineNumber = object.getString("source_line_number");
......@@ -242,14 +237,14 @@ public class PurchaseController {
throw ErrorEnum.RcvHeaderSourceAndLineSourceDifferenceError.createException();
}
lineSourceHeaderId = headerSourceHeaderId;
// if (StringUtil.isEmpty(lineSourceLineNumber)){
// logger.info("line number为空");
// throw ErrorEnum.NotAllowToBeEmptyError.createException("source_line_number");
// }
if (StringUtil.isEmpty(lineSourceLineNumber)){
logger.info("line number为空");
throw ErrorEnum.NotAllowToBeEmptyError.createException("source_line_number");
}
PurOrderLineV purOrderLineV = purchaseServer.selectPurOrderLineVByHeaderIdAndLineNumber
(headerSourceHeaderId, lineSourceLineNumber);
// PurOrderLineV purOrderLineV = purchaseServer.selectPurOrderLineVByHeaderIdAndLineNumber
// (headerSourceHeaderId, lineSourceLineNumber);
PurOrderLineV purOrderLineV = purchaseServer.selectPurOrderLineVByHeaderIdAndLineNumberG
(headerSourceHeaderId);
// (headerSourceHeaderId,);
if (purOrderLineV == null) {
logger.info("无对应order line");
throw ErrorEnum.IllegalParamError.createException("source_line_number",lineSourceLineNumber);
......@@ -394,6 +389,7 @@ public class PurchaseController {
rcvReceiptLine.setSourceHeaderNumber(object.getString("source_header_number"));
rcvReceiptLine.setSourceLineId(object.getString("source_line_id"));
rcvReceiptLine.setSourceLineNumber(object.getString("source_line_number"));
rcvReceiptLine.setInvId(inventory.getId());
rcvReceiptLineList.add(rcvReceiptLine);
}
//插入接收单头
......@@ -569,31 +565,22 @@ public class PurchaseController {
}
String subinvCode = object.getString("subinv_code");
if (!StringUtil.isEmpty(subinvCode)) {
InvSubinventory invSubinventory = inventoryServer.selectSubInventoryBySubInvCode(inventory.getId() ,subinvCode);
if (invSubinventory == null) {
logger.info("subinv_code值非法");
return "subinv_code值非法";
}
object.put("subinv_id", invSubinventory.getId());
} else {
//目的地为入库时,subinv_code必传
if (destination.equals("INVENTORY") ||
(categoryCode.startsWith(TopToolCategoryCode) && (destination.equals("INSPECTION")))) {
logger.info("subinv_code");
return "subinv_code为空";
}
}
String locatorCode = object.getString("locator_code");
if (!StringUtil.isEmpty(subinvCode) && !StringUtil.isEmpty(locatorCode)) {
String locatorId = inventoryServer.selectLocatorIdByCode
(inventory.getId() ,object.getString("subinv_id"), locatorCode);
if (StringUtil.isEmpty(locatorId)) {
logger.info("locator_code");
return "locator_code不能为"+locatorCode;
}
object.put("locator_id", locatorId);
List<RcvParameter> rcvParameters = rcvParameterMapper.selectByInvIdByupdateTime(inventory.getId());
if(rcvParameters==null || rcvParameters.size()<=0){
throw ErrorEnum.IllegalParamError.createException("inv_code", inventory.getId());
}
if(StringUtil.isEmpty(subinvCode)){
object.put("subinv_id", rcvParameters.get(0).getDefaultReceivingSubinvId());
}else{
object.put("subinv_id", subinvCode);
}
if(StringUtil.isEmpty(locatorCode)){
object.put("subinv_id", rcvParameters.get(0).getDefaultReceivingLocatorId());
}else{
object.put("subinv_id", locatorCode);
}
String lineSourceHeaderNumber = object.getString("source_header_number");
String lineSourceHeaderId = headerSourceHeaderId;
String lineSourceLineNumber = object.getString("source_line_number");
......@@ -764,6 +751,7 @@ public class PurchaseController {
rcvReceiptLine.setSourceHeaderNumber(object.getString("source_header_number"));
rcvReceiptLine.setSourceLineId(object.getString("source_line_id"));
rcvReceiptLine.setSourceLineNumber(object.getString("source_line_number"));
rcvReceiptLine.setInvId(inventory.getId());
rcvReceiptLineList.add(rcvReceiptLine);
}
//插入接收单头
......@@ -773,14 +761,14 @@ public class PurchaseController {
logger.info("---插入行-----");
purchaseServer.batchInsertRcvReceiptLine(rcvReceiptLineList);
itemInspect(InspectionOrInventoryToolObjects, rcvReceiptHeader, sysUser, now, accessToken);
List<JSONObject> implantsBeforeAccept = itemInspect(InspectionImplantLinesOrContainersObjects, rcvReceiptHeader, sysUser, now,accessToken);
for (JSONObject object : implantsBeforeAccept) {
if (object.getString("destination").equals("INVENTORY")) {
InventoryImplantLinesOrContainersObjects.add(object);
}
}
implantOrContainerAccept(InventoryImplantLinesOrContainersObjects, rcvReceiptHeader, sysUser, now, accessToken);
// itemInspect(InspectionOrInventoryToolObjects, rcvReceiptHeader, sysUser, now, accessToken);
// List<JSONObject> implantsBeforeAccept = itemInspect(InspectionImplantLinesOrContainersObjects, rcvReceiptHeader, sysUser, now,accessToken);
// for (JSONObject object : implantsBeforeAccept) {
// if (object.getString("destination").equals("INVENTORY")) {
// InventoryImplantLinesOrContainersObjects.add(object);
// }
// }
//implantOrContainerAccept(InventoryImplantLinesOrContainersObjects, rcvReceiptHeader, sysUser, now, accessToken);
JSONObject reponseResult = new JSONObject();
ErrorEnum.SUCCESS.putIntoMap(reponseResult);
JSONObject temp = new JSONObject();
......@@ -909,7 +897,7 @@ public class PurchaseController {
object.put("locator_id", locatorId);
}
if (rcvReceiptHeader.getSourceType().equals("PUR_ORDER_HEADER")) {
if (rcvReceiptHeader.getSourceType()!=null && rcvReceiptHeader.getSourceType().equals("PUR_ORDER_HEADER")) {
if (StringUtil.isEmpty(object.getString("source_type"))) {
object.put("source_type","PUR_ORDER_LINE");
} else if (!object.getString("source_type").equals("PUR_ORDER_LINE")){
......@@ -1179,7 +1167,7 @@ public class PurchaseController {
//骨仓接收单入库修改状态为已关闭
//书城改为以已入库
// autoReceiptHeaderStatusCheck(rcvReceiptHeader.getId(), "CLOSED");
purchaseServer.updateRcvReceiptHeaderStatusByHeaderId(rcvReceiptHeader.getId(), "ACCEPTED");
// purchaseServer.updateRcvReceiptHeaderStatusByHeaderId(rcvReceiptHeader.getId(), "ACCEPTED");
}
private void InvItemIn(String accessToken, String rcvReceiptHeaderId,
......@@ -1491,28 +1479,28 @@ public class PurchaseController {
purOrderHeaderVListFilter = purOrderHeaderVList;
}
if (propertiesServer.getProperty("RECEIVABLE_QUANTITY_INCLUDE_REJECT", sysAccessToken.getUserId()).equals("Y")) {
for (int i=0; i < purOrderHeaderVListFilter.size(); i++) {
PurOrderHeaderV purOrderHeaderV = purOrderHeaderVListFilter.get(i);
purOrderHeaderV.setIsReceivable(purOrderHeaderV.getIsReceivableIncludeRejects());
purOrderHeaderVListFilter.set(i,purOrderHeaderV);
}
}
// if (propertiesServer.getProperty("RECEIVABLE_QUANTITY_INCLUDE_REJECT", sysAccessToken.getUserId()).equals("Y")) {
// for (int i=0; i < purOrderHeaderVListFilter.size(); i++) {
// PurOrderHeaderV purOrderHeaderV = purOrderHeaderVListFilter.get(i);
// purOrderHeaderV.setIsReceivable(purOrderHeaderV.getIsReceivableIncludeRejects());
// purOrderHeaderVListFilter.set(i,purOrderHeaderV);
// }
// }
JSONArray data = new JSONArray();
SimplePropertyPreFilter filter = new SimplePropertyPreFilter(PurOrderHeaderV.class);
List<String> excludeList = Arrays.asList("id","sys_org_code", "create_time", "update_time", "org_id",
"bill_to_location_id", "ship_to_location_id", "order_type_id", "supplier_id", "supplier_site_id",
"buyer_id", "source_header_id", "source_line_id","is_receivable_include_rejects");
filter.getExcludes().addAll(excludeList);
purOrderHeaderVListFilter.forEach(v -> {
JSONObject o = JSONObject.parseObject(JSON.toJSONString(v, filter));
data.add(o);
});
// JSONArray data = new JSONArray();
// SimplePropertyPreFilter filter = new SimplePropertyPreFilter(PurOrderHeaderV.class);
// List<String> excludeList = Arrays.asList("id","sys_org_code", "create_time", "update_time", "org_id",
// "bill_to_location_id", "ship_to_location_id", "order_type_id", "supplier_id", "supplier_site_id",
// "buyer_id", "source_header_id", "source_line_id","is_receivable_include_rejects");
// filter.getExcludes().addAll(excludeList);
// purOrderHeaderVListFilter.forEach(v -> {
// JSONObject o = JSONObject.parseObject(JSON.toJSONString(v, filter));
// data.add(o);
// });
JSONObject responseResult = new JSONObject();
responseResult.put("data", data);
responseResult.put("data", purOrderHeaderVListFilter);
ErrorEnum.SUCCESS.putIntoMap(responseResult);
logger.info("采购订单头信息查询接口返回结果" + responseResult.toJSONString());
return responseResult.toJSONString();
......
......@@ -15,6 +15,9 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import orthopedics.controller.error.ErrorEnum;
import orthopedics.controller.operation.ShipProcessEnum;
import orthopedics.dao.InvAccessMapper;
import orthopedics.dao.SysRoleMapper;
import orthopedics.dao.SysUserRoleMapper;
import orthopedics.model.InvItem;
import orthopedics.model.InvItemLot;
import orthopedics.model.InvItemSerial;
......@@ -134,6 +137,8 @@ public class ShipController {
header.setCreateBy(sysAccessToken.getUserName());
header.setCreateTime(now);
Object orgCode = organzitionServer.selectByUserId(sysAccessToken.getUserId()).get("org_code");
if (orgCode != null) {
header.setSysOrgCode((String) orgCode);
}
......@@ -359,6 +364,12 @@ public class ShipController {
return responseResult.toJSONString();
}
@Autowired
private InvAccessMapper invAccessMapper;
@Autowired
private SysUserRoleMapper sysUserRoleMapper;
@RequestMapping(value = "/header/search", method = RequestMethod.GET)
public String shipmentHeaderSearch(@RequestParam(value="access_token")String accessToken,
@RequestParam(value = "inv_code", required = false)String invCode, @RequestParam(value = "party_code", required = false)String partyCode,
......@@ -386,7 +397,16 @@ public class ShipController {
throw ErrorEnum.IllegalParamError.createException("shipment_header_status", shipmentHeaderStatus);
}
}
List<String> invIds = inventoryServer.selectInvAccessByUserId(sysAccessToken.getUserId()).stream().map(v -> v.getInvId()).distinct().collect(Collectors.toList());
//List<String> invIds = inventoryServer.selectInvAccessByUserId(sysAccessToken.getUserId()).stream().map(v -> v.getInvId()).distinct().collect(Collectors.toList());
List<String> invIds=new ArrayList<>();
List<SysUserRole> sysUserRoles = sysUserRoleMapper.selectRoleByUserId(sysAccessToken.getUserId(),LocalDateTime.now());
if(sysUserRoles==null || sysUserRoles.size()<=0){
throw ErrorEnum.IllegalParamError.createException("UserId", sysAccessToken.getUserId());
}
for (SysUserRole sysUserRole:sysUserRoles) {
List<String> attribute1 = invAccessMapper.getAttribute1(sysUserRole.getRoleId(), LocalDateTime.now());
invIds.addAll(attribute1);
}
if (invIds.size() <= 0) {
logger.info(String.format("该用户%s没有配置可访问的仓库", sysAccessToken.getUserName()));
......@@ -437,7 +457,16 @@ public class ShipController {
}
}
JSONArray lines = new JSONArray();
List<String> invIds = inventoryServer.selectInvAccessByUserId(sysAccessToken.getUserId()).stream().map(v -> v.getInvId()).distinct().collect(Collectors.toList());
//List<String> invIds = inventoryServer.selectInvAccessByUserId(sysAccessToken.getUserId()).stream().map(v -> v.getInvId()).distinct().collect(Collectors.toList());
List<String> invIds=new ArrayList<>();
List<SysUserRole> sysUserRoles = sysUserRoleMapper.selectRoleByUserId(sysAccessToken.getUserId(),LocalDateTime.now());
if(sysUserRoles==null || sysUserRoles.size()<=0){
throw ErrorEnum.IllegalParamError.createException("UserId", sysAccessToken.getUserId());
}
for (SysUserRole sysUserRole:sysUserRoles) {
List<String> attribute1 = invAccessMapper.getAttribute1(sysUserRole.getRoleId(), LocalDateTime.now());
invIds.addAll(attribute1);
}
if (invIds.size() <= 0) {
logger.info(String.format("该用户%s没有配置可访问的仓库", sysAccessToken.getUserName()));
......
......@@ -85,7 +85,7 @@ int updateInvCountHeaderStatus(@Param("status") String status, @Param("id") Stri
public InvCountHeader fingByCountNumber(@Param("countNumber") String countNumber);
//根据header_status查询
@Select("select * from inv_count_header where header_status = #{status}")
@Select("select * from inv_count_header where header_status = #{status} and inv_id = #{invId}")
@ResultMap("invcountheader")
public List<InvCountHeader> fingByHeaderStatus(@Param("status") String status);
public List<InvCountHeader> fingByHeaderStatus(@Param("status") String status,@Param("invId") String invId);
}
\ No newline at end of file
......@@ -83,4 +83,11 @@ Integer insert(InvInventory InvInventory);
@Select("SELECT * FROM inv_inventory WHERE sortid = #{sortid}")
@ResultMap("invinventory")
InvInventory findBySortid(@Param("sortid") String sortid);
@Select("SELECT sortid FROM inv_inventory")
List<String> getSortidAll();
//查询书吧仓库
@Select("SELECT id,org_id,,sortid FROM inv_inventory where inv_desc='-1'")
List<InvInventory> getSortidByInvDesc();
}
\ No newline at end of file
......@@ -121,7 +121,7 @@ public interface InvItemMapper{
@Select("SELECT * FROM inv_item WHERE plucode = #{plucode}")
@ResultMap("invitem")
List<InvItem> selectByPlucode( @Param("plucode") String plucode);
InvItem selectByPlucode(@Param("plucode") String plucode);
@Delete("DELETE FROM inv_item WHERE plucode = #{plucode}")
int deleteByPlucode( @Param("plucode") String plucode);
......@@ -143,4 +143,12 @@ public interface InvItemMapper{
@Select("SELECT item_code FROM inv_item WHERE plucode = #{plucode}")
String getPlucode(@Param("plucode") String plucode);
@Select("SELECT id,item_code,item_name,item_desc FROM inv_item WHERE plucode = #{plucode}")
@ResultMap("invitem")
InvItem findAllByPlucode(@Param("plucode") String plucode);
@Select("SELECT plucode FROM inv_item")
List<String> getPlucodeAll();
}
\ No newline at end of file
......@@ -118,4 +118,7 @@ public interface InvTransactionMapper{
"i.inv_id = w.inv_id AND i.subinv_id = w.default_shipping_subinv_id AND i.locator_id = w.default_shipping_locator_id " +
"and item_id = #{itemId}")
Integer selectByOrgIdAndItemId(@Param("orgId")String orgId,@Param("itemId")String itemId);
@Select("select id from inv_transaction where item_id=#{itemId}")
public String findIdByItemId(@Param("itemId")String itemId);
}
\ No newline at end of file
......@@ -10,48 +10,49 @@ import org.apache.ibatis.annotations.*;
*/
public interface PurOrderHeaderMapper{
@Select("SELECT * FROM pur_order_header")
@Results(id = "purorderheader", value ={
@Result(property = "id", column = "id"),
@Result(property = "createBy", column = "create_by"),
@Result(property = "createTime", column = "create_time"),
@Result(property = "updateBy", column = "update_by"),
@Result(property = "updateTime", column = "update_time"),
@Result(property = "attributeCategory", column = "attribute_category"),
@Result(property = "attribute1", column = "attribute1"),
@Result(property = "attribute2", column = "attribute2"),
@Result(property = "attribute3", column = "attribute3"),
@Result(property = "attribute4", column = "attribute4"),
@Result(property = "attribute5", column = "attribute5"),
@Result(property = "attribute6", column = "attribute6"),
@Result(property = "attribute7", column = "attribute7"),
@Result(property = "attribute8", column = "attribute8"),
@Result(property = "attribute9", column = "attribute9"),
@Result(property = "orgId", column = "org_id"),
@Result(property = "orderType", column = "order_type"),
@Result(property = "billToLocationId", column = "bill_to_location_id"),
@Result(property = "orderNumber", column = "order_number"),
@Result(property = "shipToLocationId", column = "ship_to_location_id"),
@Result(property = "orderDate", column = "order_date"),
@Result(property = "orderCurrency", column = "order_currency"),
@Result(property = "supplierId", column = "supplier_id"),
@Result(property = "supplierSiteId", column = "supplier_site_id"),
@Result(property = "paymentTerms", column = "payment_terms"),
@Result(property = "paymentMethod", column = "payment_method"),
@Result(property = "deliveryTerms", column = "delivery_terms"),
@Result(property = "headerRemark", column = "header_remark"),
@Result(property = "buyerId", column = "buyer_id"),
@Result(property = "consignedFlag", column = "consigned_flag"),
@Result(property = "sourceType", column = "source_type"),
@Result(property = "sourceHeaderId", column = "source_header_id"),
@Result(property = "sourceLineId", column = "source_line_id"),
@Result(property = "headerStatus", column = "header_status"),
@Result(property = "sysOrgCode", column = "sys_org_code"),
@Result(property = "sourceHeaderNumber", column = "source_header_number"),
@Result(property = "sourceLineNumber", column = "source_line_number"),
@Result(property = "attribute10", column = "attribute10"),
})
public List<PurOrderHeader> select();
@Select("SELECT * FROM pur_order_header")
@Results(id = "purorderheader", value ={
@Result(property = "id", column = "id"),
@Result(property = "createBy", column = "create_by"),
@Result(property = "createTime", column = "create_time"),
@Result(property = "updateBy", column = "update_by"),
@Result(property = "updateTime", column = "update_time"),
@Result(property = "attributeCategory", column = "attribute_category"),
@Result(property = "attribute1", column = "attribute1"),
@Result(property = "attribute2", column = "attribute2"),
@Result(property = "attribute3", column = "attribute3"),
@Result(property = "attribute4", column = "attribute4"),
@Result(property = "attribute5", column = "attribute5"),
@Result(property = "attribute6", column = "attribute6"),
@Result(property = "attribute7", column = "attribute7"),
@Result(property = "attribute8", column = "attribute8"),
@Result(property = "attribute9", column = "attribute9"),
@Result(property = "orgId", column = "org_id"),
@Result(property = "orderType", column = "order_type"),
@Result(property = "billToLocationId", column = "bill_to_location_id"),
@Result(property = "orderNumber", column = "order_number"),
@Result(property = "shipToLocationId", column = "ship_to_location_id"),
@Result(property = "orderDate", column = "order_date"),
@Result(property = "orderCurrency", column = "order_currency"),
@Result(property = "supplierId", column = "supplier_id"),
@Result(property = "supplierSiteId", column = "supplier_site_id"),
@Result(property = "paymentTerms", column = "payment_terms"),
@Result(property = "paymentMethod", column = "payment_method"),
@Result(property = "deliveryTerms", column = "delivery_terms"),
@Result(property = "headerRemark", column = "header_remark"),
@Result(property = "buyerId", column = "buyer_id"),
@Result(property = "consignedFlag", column = "consigned_flag"),
@Result(property = "sourceType", column = "source_type"),
@Result(property = "sourceHeaderId", column = "source_header_id"),
@Result(property = "sourceLineId", column = "source_line_id"),
@Result(property = "headerStatus", column = "header_status"),
@Result(property = "sysOrgCode", column = "sys_org_code"),
@Result(property = "sourceHeaderNumber", column = "source_header_number"),
@Result(property = "sourceLineNumber", column = "source_line_number"),
@Result(property = "attribute10", column = "attribute10"),
@Result(property = "supplierCode", column = "supplier_code"),
})
public List<PurOrderHeader> select();
@Select("SELECT * FROM pur_buyer_v v WHERE v.id = #{id}")
@Results(value = {
......@@ -110,19 +111,19 @@ public List<PurOrderHeader> select();
@Update("UPDATE pur_order_header SET header_status = #{status} WHERE id = #{id}")
void updateStatusById(@Param("id")String id,@Param("status")String status);
@Insert("<script>" +
"INSERT INTO pur_order_header(id,create_by,create_time,update_by,update_time,attribute_category,attribute1,attribute2,attribute3,attribute4,attribute5,attribute6,attribute7,attribute8,attribute9,org_id,order_type,bill_to_location_id,order_number,ship_to_location_id,order_date,order_currency,supplier_id,supplier_site_id,payment_terms,payment_method,delivery_terms,header_remark,buyer_id,consigned_flag,source_type,source_header_id,source_line_id,header_status,sys_org_code,source_header_number,source_line_number,attribute10) VALUES" +
"<foreach collection='purorderheaders' item='item' index='index' separator=','>" +
"(#{item.id},#{item.createBy},#{item.createTime},#{item.updateBy},#{item.updateTime},#{item.attributeCategory},#{item.attribute1},#{item.attribute2},#{item.attribute3},#{item.attribute4},#{item.attribute5},#{item.attribute6},#{item.attribute7},#{item.attribute8},#{item.attribute9},#{item.orgId},#{item.orderType},#{item.billToLocationId},#{item.orderNumber},#{item.shipToLocationId},#{item.orderDate},#{item.orderCurrency},#{item.supplierId},#{item.supplierSiteId},#{item.paymentTerms},#{item.paymentMethod},#{item.deliveryTerms},#{item.headerRemark},#{item.buyerId},#{item.consignedFlag},#{item.sourceType},#{item.sourceHeaderId},#{item.sourceLineId},#{item.headerStatus},#{item.sysOrgCode},#{item.sourceHeaderNumber},#{item.sourceLineNumber},#{item.attribute10})" +
"</foreach>" +
"</script>")
Integer insertBatch(@Param("purorderheaders")List<PurOrderHeader> PurOrderHeaderList);
@Insert(
"INSERT INTO pur_order_header(id,create_by,create_time,update_by,update_time,attribute_category,attribute1,attribute2,attribute3,attribute4,attribute5,attribute6,attribute7,attribute8,attribute9,org_id,order_type,bill_to_location_id,order_number,ship_to_location_id,order_date,order_currency,supplier_id,supplier_site_id,payment_terms,payment_method,delivery_terms,header_remark,buyer_id,consigned_flag,source_type,source_header_id,source_line_id,header_status,sys_org_code,source_header_number,source_line_number,attribute10) VALUES" +
"(#{id},#{createBy},#{createTime},#{updateBy},#{updateTime},#{attributeCategory},#{attribute1},#{attribute2},#{attribute3},#{attribute4},#{attribute5},#{attribute6},#{attribute7},#{attribute8},#{attribute9},#{orgId},#{orderType},#{billToLocationId},#{orderNumber},#{shipToLocationId},#{orderDate},#{orderCurrency},#{supplierId},#{supplierSiteId},#{paymentTerms},#{paymentMethod},#{deliveryTerms},#{headerRemark},#{buyerId},#{consignedFlag},#{sourceType},#{sourceHeaderId},#{sourceLineId},#{headerStatus},#{sysOrgCode},#{sourceHeaderNumber},#{sourceLineNumber},#{attribute10})"
)
Integer insert(PurOrderHeader PurOrderHeader);
@Insert("<script>" +
"INSERT INTO pur_order_header(id,create_by,create_time,update_by,update_time,attribute_category,attribute1,attribute2,attribute3,attribute4,attribute5,attribute6,attribute7,attribute8,attribute9,org_id,order_type,bill_to_location_id,order_number,ship_to_location_id,order_date,order_currency,supplier_id,supplier_site_id,payment_terms,payment_method,delivery_terms,header_remark,buyer_id,consigned_flag,source_type,source_header_id,source_line_id,header_status,sys_org_code,source_header_number,source_line_number,attribute10,supplier_code) VALUES" +
"<foreach collection='purorderheaders' item='item' index='index' separator=','>" +
"(#{item.id},#{item.createBy},#{item.createTime},#{item.updateBy},#{item.updateTime},#{item.attributeCategory},#{item.attribute1},#{item.attribute2},#{item.attribute3},#{item.attribute4},#{item.attribute5},#{item.attribute6},#{item.attribute7},#{item.attribute8},#{item.attribute9},#{item.orgId},#{item.orderType},#{item.billToLocationId},#{item.orderNumber},#{item.shipToLocationId},#{item.orderDate},#{item.orderCurrency},#{item.supplierId},#{item.supplierSiteId},#{item.paymentTerms},#{item.paymentMethod},#{item.deliveryTerms},#{item.headerRemark},#{item.buyerId},#{item.consignedFlag},#{item.sourceType},#{item.sourceHeaderId},#{item.sourceLineId},#{item.headerStatus},#{item.sysOrgCode},#{item.sourceHeaderNumber},#{item.sourceLineNumber},#{item.attribute10},#{item.supplierCode})" +
"</foreach>" +
"</script>")
Integer insertBatch(@Param("purorderheaders")List<PurOrderHeader> PurOrderHeaderList);
@Insert(
"INSERT INTO pur_order_header(id,create_by,create_time,update_by,update_time,attribute_category,attribute1,attribute2,attribute3,attribute4,attribute5,attribute6,attribute7,attribute8,attribute9,org_id,order_type,bill_to_location_id,order_number,ship_to_location_id,order_date,order_currency,supplier_id,supplier_site_id,payment_terms,payment_method,delivery_terms,header_remark,buyer_id,consigned_flag,source_type,source_header_id,source_line_id,header_status,sys_org_code,source_header_number,source_line_number,attribute10,supplier_code) VALUES" +
"(#{id},#{createBy},#{createTime},#{updateBy},#{updateTime},#{attributeCategory},#{attribute1},#{attribute2},#{attribute3},#{attribute4},#{attribute5},#{attribute6},#{attribute7},#{attribute8},#{attribute9},#{orgId},#{orderType},#{billToLocationId},#{orderNumber},#{shipToLocationId},#{orderDate},#{orderCurrency},#{supplierId},#{supplierSiteId},#{paymentTerms},#{paymentMethod},#{deliveryTerms},#{headerRemark},#{buyerId},#{consignedFlag},#{sourceType},#{sourceHeaderId},#{sourceLineId},#{headerStatus},#{sysOrgCode},#{sourceHeaderNumber},#{sourceLineNumber},#{attribute10},#{supplierCode})"
)
Integer insert(PurOrderHeader PurOrderHeader);
//修改采购订单状态
@Update("update pur_order_header set header_status = #{headerStatus},update_by=#{updateBy},update_time=#{updateTime} WHERE id= #{id}")
......
package orthopedics.dao;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Insert;
import orthopedics.model.PurSupplierContact;
/**
* @author author
*/
public interface PurSupplierContactMapper{
@Select("SELECT * FROM pur_supplier_contact")
@Results(id = "pursuppliercontact", value ={
@Result(property = "id", column = "id"),
@Result(property = "createBy", column = "create_by"),
@Result(property = "createTime", column = "create_time"),
@Result(property = "updateBy", column = "update_by"),
@Result(property = "updateTime", column = "update_time"),
@Result(property = "attributeCategory", column = "attribute_category"),
@Result(property = "attribute1", column = "attribute1"),
@Result(property = "attribute2", column = "attribute2"),
@Result(property = "attribute3", column = "attribute3"),
@Result(property = "attribute4", column = "attribute4"),
@Result(property = "attribute5", column = "attribute5"),
@Result(property = "attribute6", column = "attribute6"),
@Result(property = "attribute7", column = "attribute7"),
@Result(property = "attribute8", column = "attribute8"),
@Result(property = "attribute9", column = "attribute9"),
@Result(property = "attribute10", column = "attribute10"),
@Result(property = "supplierId", column = "supplier_id"),
@Result(property = "supplierSiteId", column = "supplier_site_id"),
@Result(property = "contactType", column = "contact_type"),
@Result(property = "contactName", column = "contact_name"),
@Result(property = "country", column = "country"),
@Result(property = "province", column = "province"),
@Result(property = "city", column = "city"),
@Result(property = "county", column = "county"),
@Result(property = "town", column = "town"),
@Result(property = "address", column = "address"),
@Result(property = "postalCode", column = "postal_code"),
@Result(property = "telephone", column = "telephone"),
@Result(property = "fax", column = "fax"),
@Result(property = "contactDesc", column = "contact_desc"),
@Result(property = "email", column = "email"),
@Result(property = "wechatOpenId", column = "wechat_open_id"),
@Result(property = "status", column = "status"),
})
public List<PurSupplierContact> select();
@Insert("<script>" +
"INSERT INTO pur_supplier_contact(id,create_by,create_time,update_by,update_time,attribute_category,attribute1,attribute2,attribute3,attribute4,attribute5,attribute6,attribute7,attribute8,attribute9,attribute10,supplier_id,supplier_site_id,contact_type,contact_name,country,province,city,county,town,address,postal_code,telephone,fax,contact_desc,email,wechat_open_id,status) VALUES" +
"<foreach collection='pursuppliercontacts' item='item' index='index' separator=','>" +
"(#{item.id},#{item.createBy},#{item.createTime},#{item.updateBy},#{item.updateTime},#{item.attributeCategory},#{item.attribute1},#{item.attribute2},#{item.attribute3},#{item.attribute4},#{item.attribute5},#{item.attribute6},#{item.attribute7},#{item.attribute8},#{item.attribute9},#{item.attribute10},#{item.supplierId},#{item.supplierSiteId},#{item.contactType},#{item.contactName},#{item.country},#{item.province},#{item.city},#{item.county},#{item.town},#{item.address},#{item.postalCode},#{item.telephone},#{item.fax},#{item.contactDesc},#{item.email},#{item.wechatOpenId},#{item.status})" +
"</foreach>" +
"</script>")
Integer insertBatch(@Param("pursuppliercontacts") List<PurSupplierContact> PurSupplierContactList);
@Insert(
"INSERT INTO pur_supplier_contact(id,create_by,create_time,update_by,update_time,attribute_category,attribute1,attribute2,attribute3,attribute4,attribute5,attribute6,attribute7,attribute8,attribute9,attribute10,supplier_id,supplier_site_id,contact_type,contact_name,country,province,city,county,town,address,postal_code,telephone,fax,contact_desc,email,wechat_open_id,status) VALUES" +
"(#{id},#{createBy},#{createTime},#{updateBy},#{updateTime},#{attributeCategory},#{attribute1},#{attribute2},#{attribute3},#{attribute4},#{attribute5},#{attribute6},#{attribute7},#{attribute8},#{attribute9},#{attribute10},#{supplierId},#{supplierSiteId},#{contactType},#{contactName},#{country},#{province},#{city},#{county},#{town},#{address},#{postalCode},#{telephone},#{fax},#{contactDesc},#{email},#{wechatOpenId},#{status})"
)
Integer insert(PurSupplierContact PurSupplierContact);
}
\ No newline at end of file
package orthopedics.dao;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.*;
import orthopedics.model.PurSupplier;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Insert;
/**
* @author cen.zhihong
......@@ -53,6 +49,9 @@ List<PurSupplier> selectById(@Param("id")String id);
@ResultMap("pursupplier")
List<PurSupplier> selectByCode(@Param("supplier_code")String supplier_code);
@Delete("delete from pur_supplier where supplier_code = #{supplier_code}")
public int deleteByCode(@Param("supplier_code")String supplier_code);
@Insert("<script>" +
"INSERT INTO pur_supplier(id,create_by,create_time,update_by,update_time,attribute_category,attribute1,attribute2,attribute3,attribute4,attribute5,attribute6,attribute7,attribute8,attribute9,attribute10,org_id,supplier_type,supplier_code,supplier_name,supplier_short_name,organization_code,tax_registration_code,supplier_desc,status) VALUES" +
......
......@@ -14,61 +14,54 @@ import org.apache.ibatis.annotations.ResultMap;
*/
public interface PurSupplierSiteMapper{
@Select("SELECT * FROM pur_supplier_site")
@Results(id = "pursuppliersite", value ={
@Result(property = "id", column = "id"),
@Result(property = "createBy", column = "create_by"),
@Result(property = "createTime", column = "create_time"),
@Result(property = "updateBy", column = "update_by"),
@Result(property = "updateTime", column = "update_time"),
@Result(property = "attributeCategory", column = "attribute_category"),
@Result(property = "attribute1", column = "attribute1"),
@Result(property = "attribute2", column = "attribute2"),
@Result(property = "attribute3", column = "attribute3"),
@Result(property = "attribute4", column = "attribute4"),
@Result(property = "attribute5", column = "attribute5"),
@Result(property = "attribute6", column = "attribute6"),
@Result(property = "attribute7", column = "attribute7"),
@Result(property = "attribute8", column = "attribute8"),
@Result(property = "attribute9", column = "attribute9"),
@Result(property = "attribute10", column = "attribute10"),
@Result(property = "orgId", column = "org_id"),
@Result(property = "supplierId", column = "supplier_id"),
@Result(property = "supplierSiteType", column = "supplier_site_type"),
@Result(property = "supplierSiteCode", column = "supplier_site_code"),
@Result(property = "supplierSiteName", column = "supplier_site_name"),
@Result(property = "supplierSiteShortName", column = "supplier_site_short_name"),
@Result(property = "country", column = "country"),
@Result(property = "province", column = "province"),
@Result(property = "city", column = "city"),
@Result(property = "county", column = "county"),
@Result(property = "town", column = "town"),
@Result(property = "address", column = "address"),
@Result(property = "postalCode", column = "postal_code"),
@Result(property = "telephone", column = "telephone"),
@Result(property = "fax", column = "fax"),
@Result(property = "locationId", column = "location_id"),
@Result(property = "supplierSiteDesc", column = "supplier_site_desc"),
@Result(property = "defaultFlag", column = "default_flag"),
@Result(property = "status", column = "status"),
})
public List<PurSupplierSite> select();
@Select("SELECT * FROM pur_supplier_site")
@Results(id = "pursuppliersite", value ={
@Result(property = "id", column = "id"),
@Result(property = "createBy", column = "create_by"),
@Result(property = "createTime", column = "create_time"),
@Result(property = "updateBy", column = "update_by"),
@Result(property = "updateTime", column = "update_time"),
@Result(property = "attributeCategory", column = "attribute_category"),
@Result(property = "attribute1", column = "attribute1"),
@Result(property = "attribute2", column = "attribute2"),
@Result(property = "attribute3", column = "attribute3"),
@Result(property = "attribute4", column = "attribute4"),
@Result(property = "attribute5", column = "attribute5"),
@Result(property = "attribute6", column = "attribute6"),
@Result(property = "attribute7", column = "attribute7"),
@Result(property = "attribute8", column = "attribute8"),
@Result(property = "attribute9", column = "attribute9"),
@Result(property = "attribute10", column = "attribute10"),
@Result(property = "supplierId", column = "supplier_id"),
@Result(property = "supplierSiteType", column = "supplier_site_type"),
@Result(property = "supplierSiteCode", column = "supplier_site_code"),
@Result(property = "supplierSiteName", column = "supplier_site_name"),
@Result(property = "supplierSiteShortName", column = "supplier_site_short_name"),
@Result(property = "address", column = "address"),
@Result(property = "postalCode", column = "postal_code"),
@Result(property = "telephone", column = "telephone"),
@Result(property = "fax", column = "fax"),
@Result(property = "status", column = "status"),
@Result(property = "supplierName", column = "supplier_name"),
@Result(property = "supplierCode", column = "supplier_code"),
})
public List<PurSupplierSite> select();
@Select("SELECT * FROM pur_supplier_site WHERE id = #{id}")
@ResultMap("pursuppliersite")
List<PurSupplierSite> selectById(@Param("id")String id);
@Insert("<script>" +
"INSERT INTO pur_supplier_site(id,create_by,create_time,update_by,update_time,attribute_category,attribute1,attribute2,attribute3,attribute4,attribute5,attribute6,attribute7,attribute8,attribute9,attribute10,org_id,supplier_id,supplier_site_type,supplier_site_code,supplier_site_name,supplier_site_short_name,country,province,city,county,town,address,postal_code,telephone,fax,location_id,supplier_site_desc,default_flag,status) VALUES" +
"<foreach collection='pursuppliersites' item='item' index='index' separator=','>" +
"(#{item.id},#{item.createBy},#{item.createTime},#{item.updateBy},#{item.updateTime},#{item.attributeCategory},#{item.attribute1},#{item.attribute2},#{item.attribute3},#{item.attribute4},#{item.attribute5},#{item.attribute6},#{item.attribute7},#{item.attribute8},#{item.attribute9},#{item.attribute10},#{item.orgId},#{item.supplierId},#{item.supplierSiteType},#{item.supplierSiteCode},#{item.supplierSiteName},#{item.supplierSiteShortName},#{item.country},#{item.province},#{item.city},#{item.county},#{item.town},#{item.address},#{item.postalCode},#{item.telephone},#{item.fax},#{item.locationId},#{item.supplierSiteDesc},#{item.defaultFlag},#{item.status})" +
"</foreach>" +
"</script>")
Integer insertBatch(@Param("pursuppliersites")List<PurSupplierSite> PurSupplierSiteList);
@Insert("<script>" +
"INSERT INTO pur_supplier_site(id,create_by,create_time,update_by,update_time,attribute_category,attribute1,attribute2,attribute3,attribute4,attribute5,attribute6,attribute7,attribute8,attribute9,attribute10,supplier_id,supplier_site_type,supplier_site_code,supplier_site_name,supplier_site_short_name,address,postal_code,telephone,fax,status,supplier_name,supplier_code) VALUES" +
"<foreach collection='pursuppliersites' item='item' index='index' separator=','>" +
"(#{item.id},#{item.createBy},#{item.createTime},#{item.updateBy},#{item.updateTime},#{item.attributeCategory},#{item.attribute1},#{item.attribute2},#{item.attribute3},#{item.attribute4},#{item.attribute5},#{item.attribute6},#{item.attribute7},#{item.attribute8},#{item.attribute9},#{item.attribute10},#{item.supplierId},#{item.supplierSiteType},#{item.supplierSiteCode},#{item.supplierSiteName},#{item.supplierSiteShortName},#{item.address},#{item.postalCode},#{item.telephone},#{item.fax},#{item.status},#{item.supplierName},#{item.supplierCode})" +
"</foreach>" +
"</script>")
Integer insertBatch(@Param("pursuppliersites")List<PurSupplierSite> PurSupplierSiteList);
@Insert(
"INSERT INTO pur_supplier_site(id,create_by,create_time,update_by,update_time,attribute_category,attribute1,attribute2,attribute3,attribute4,attribute5,attribute6,attribute7,attribute8,attribute9,attribute10,org_id,supplier_id,supplier_site_type,supplier_site_code,supplier_site_name,supplier_site_short_name,country,province,city,county,town,address,postal_code,telephone,fax,location_id,supplier_site_desc,default_flag,status) VALUES" +
"(#{id},#{createBy},#{createTime},#{updateBy},#{updateTime},#{attributeCategory},#{attribute1},#{attribute2},#{attribute3},#{attribute4},#{attribute5},#{attribute6},#{attribute7},#{attribute8},#{attribute9},#{attribute10},#{orgId},#{supplierId},#{supplierSiteType},#{supplierSiteCode},#{supplierSiteName},#{supplierSiteShortName},#{country},#{province},#{city},#{county},#{town},#{address},#{postalCode},#{telephone},#{fax},#{locationId},#{supplierSiteDesc},#{defaultFlag},#{status})"
)
Integer insert(PurSupplierSite PurSupplierSite);
@Insert(
"INSERT INTO pur_supplier_site(id,create_by,create_time,update_by,update_time,attribute_category,attribute1,attribute2,attribute3,attribute4,attribute5,attribute6,attribute7,attribute8,attribute9,attribute10,supplier_id,supplier_site_type,supplier_site_code,supplier_site_name,supplier_site_short_name,address,postal_code,telephone,fax,status,supplier_name,supplier_code) VALUES" +
"(#{id},#{createBy},#{createTime},#{updateBy},#{updateTime},#{attributeCategory},#{attribute1},#{attribute2},#{attribute3},#{attribute4},#{attribute5},#{attribute6},#{attribute7},#{attribute8},#{attribute9},#{attribute10},#{supplierId},#{supplierSiteType},#{supplierSiteCode},#{supplierSiteName},#{supplierSiteShortName},#{address},#{postalCode},#{telephone},#{fax},#{status},#{supplierName},#{supplierCode})"
)
Integer insert(PurSupplierSite PurSupplierSite);
}
\ No newline at end of file
package orthopedics.dao;
import java.util.List;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Insert;
import orthopedics.model.TempItemFomPmp;
/**
......@@ -66,10 +62,22 @@ Integer insert(TempItemFomPmp TempItemFomPmp);
@Select("select count(temp_item_fom_pmp.`id`) from temp_item_fom_pmp")
Integer findCount();
@Select("SELECT * FROM temp_item_fom_pmp LIMIT ${sta},1000")
@Select("SELECT * FROM temp_item_fom_pmp where status=0 LIMIT ${sta},50000")
@ResultMap("tempitemfompmp")
public List<TempItemFomPmp> findLimit(@Param("sta") int sta);
@Select("SELECT plucode FROM temp_item_fom_pmp LIMIT ${sta},${end}")
public List<String> findLimitByStaEnd(@Param("sta") int sta,@Param("end") int end);
@Update("UPDATE temp_item_fom_pmp SET temp_item_fom_pmp.status=0 WHERE plucode=#{plucode}")
public void updateByStatus(@Param("plucode") String plucode);
@Delete("DELETE FROM temp_item_fom_pmp WHERE plucode = #{plucode}")
int deleteByPlucode(@Param("plucode") String plucode);
@Select("select plucode from temp_item_fom_pmp where plucode = #{plucode}")
public String getPlucodeByPlucode(@Param("plucode") String plucode);
@Select("select * from temp_item_fom_pmp a where a.plucode not in (select b.plucode from inv_item b)")
public List<TempItemFomPmp> getDifference();
}
\ No newline at end of file
package orthopedics.dao;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Insert;
import orthopedics.model.TempPurOrderFomPmp;
/**
* @author author
*/
public interface TempPurOrderFomPmpMapper{
@Select("SELECT * FROM temp_pur_order_fom_pmp")
@Results(id = "temppurorderfompmp", value ={
@Result(property = "id", column = "id"),
@Result(property = "number", column = "number"),
@Result(property = "shop", column = "shop"),
@Result(property = "plucode", column = "plucode"),
@Result(property = "title", column = "title"),
@Result(property = "price", column = "price"),
@Result(property = "qty", column = "qty"),
@Result(property = "hdltime", column = "hdltime"),
})
public List<TempPurOrderFomPmp> select();
@Insert("<script>" +
"INSERT INTO temp_pur_order_fom_pmp(id,number,shop,plucode,title,price,qty,hdltime) VALUES" +
"<foreach collection='temppurorderfompmps' item='item' index='index' separator=','>" +
"(#{item.id},#{item.number},#{item.shop},#{item.plucode},#{item.title},#{item.price},#{item.qty},#{item.hdltime})" +
"</foreach>" +
"</script>")
Integer insertBatch(@Param("temppurorderfompmps") List<TempPurOrderFomPmp> TempPurOrderFomPmpList);
@Insert(
"INSERT INTO temp_pur_order_fom_pmp(id,number,shop,plucode,title,price,qty,hdltime) VALUES" +
"(#{id},#{number},#{shop},#{plucode},#{title},#{price},#{qty},#{hdltime})"
)
Integer insert(TempPurOrderFomPmp TempPurOrderFomPmp);
@Select("select number feom temp_pur_order_fom_pmp where number = #{number} ")
public String findByNumber(@Param("number") String number);
}
\ No newline at end of file
package orthopedics.dao;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Insert;
import orthopedics.model.TempRcvReceiptFomPmp;
/**
* @author author
*/
public interface TempRcvReceiptFomPmpMapper{
@Select("SELECT * FROM temp_rcv_receipt_fom_pmp")
@Results(id = "temprcvreceiptfompmp", value ={
@Result(property = "id", column = "id"),
@Result(property = "number", column = "number"),
@Result(property = "shop", column = "shop"),
@Result(property = "descript", column = "descript"),
@Result(property = "rcvby", column = "rcvby"),
@Result(property = "rcvtime", column = "rcvtime"),
@Result(property = "plucode", column = "plucode"),
@Result(property = "title", column = "title"),
@Result(property = "qty", column = "qty"),
@Result(property = "money", column = "money"),
@Result(property = "realmoney", column = "realmoney"),
@Result(property = "status", column = "status"),
})
public List<TempRcvReceiptFomPmp> select();
@Insert("<script>" +
"INSERT INTO temp_rcv_receipt_fom_pmp(id,number,shop,descript,rcvby,rcvtime,plucode,title,qty,money,realmoney,status) VALUES" +
"<foreach collection='temprcvreceiptfompmps' item='item' index='index' separator=','>" +
"(#{item.id},#{item.number},#{item.shop},#{item.descript},#{item.rcvby},#{item.rcvtime},#{item.plucode},#{item.title},#{item.qty},#{item.money},#{item.realmoney},#{item.status})" +
"</foreach>" +
"</script>")
Integer insertBatch(@Param("temprcvreceiptfompmps")List<TempRcvReceiptFomPmp> TempRcvReceiptFomPmpList);
@Insert(
"INSERT INTO temp_rcv_receipt_fom_pmp(id,number,shop,descript,rcvby,rcvtime,plucode,title,qty,money,realmoney,status) VALUES" +
"(#{id},#{number},#{shop},#{descript},#{rcvby},#{rcvtime},#{plucode},#{title},#{qty},#{money},#{realmoney},#{status})"
)
Integer insert(TempRcvReceiptFomPmp TempRcvReceiptFomPmp);
}
\ No newline at end of file
package orthopedics.dao;
import java.util.List;
import org.apache.ibatis.annotations.*;
import orthopedics.model.TempSalOrderFomPmp;
import org.apache.ibatis.annotations.Param;
/**
* @author author
*/
public interface TempSalOrderFomPmpMapper{
@Select("SELECT * FROM temp_sal_order_fom_pmp")
@Results(id = "tempsalorderfompmp", value ={
@Result(property = "id", column = "id"),
@Result(property = "txntime", column = "txntime"),
@Result(property = "operator", column = "operator"),
@Result(property = "vouchnum", column = "vouchnum"),
@Result(property = "dptcode", column = "dptcode"),
@Result(property = "code", column = "code"),
@Result(property = "qty", column = "qty"),
@Result(property = "price", column = "price"),
@Result(property = "disc", column = "disc"),
@Result(property = "orgamt", column = "orgamt"),
@Result(property = "sequence", column = "sequence"),
@Result(property = "clscode", column = "clscode"),
@Result(property = "display", column = "display"),
@Result(property = "itemdisc", column = "itemdisc"),
@Result(property = "price2", column = "price2"),
@Result(property = "status", column = "status"),
})
public List<TempSalOrderFomPmp> select();
@Insert("<script>" +
"INSERT INTO temp_sal_order_fom_pmp(id,txntime,operator,vouchnum,dptcode,code,qty,price,disc,orgamt,sequence,clscode,display,itemdisc,price2,status) VALUES" +
"<foreach collection='tempsalorderfompmps' item='item' index='index' separator=','>" +
"(#{item.id},#{item.txntime},#{item.operator},#{item.vouchnum},#{item.dptcode},#{item.code},#{item.qty},#{item.price},#{item.disc},#{item.orgamt},#{item.sequence},#{item.clscode},#{item.display},#{item.itemdisc},#{item.price2},#{item.status})" +
"</foreach>" +
"</script>")
Integer insertBatch(@Param("tempsalorderfompmps")List<TempSalOrderFomPmp> TempSalOrderFomPmpList);
@Insert(
"INSERT INTO temp_sal_order_fom_pmp(id,txntime,operator,vouchnum,dptcode,code,qty,price,disc,orgamt,sequence,clscode,display,itemdisc,price2,status) VALUES" +
"(#{id},#{txntime},#{operator},#{vouchnum},#{dptcode},#{code},#{qty},#{price},#{disc},#{orgamt},#{sequence},#{clscode},#{display},#{itemdisc},#{price2},#{status})"
)
Integer insert(TempSalOrderFomPmp TempSalOrderFomPmp);
@Select("select txntime,operator,vouchnum,uptime from temp_sal_order_fom_pmp")
public List<TempSalOrderFomPmp> getTxntimeAndOperatorAndVouchnumAll();
@Update("update temp_sal_order_fom_pmp set dptcode=#{dptcode} where uptime=#{uptime}")
public void updateByDptcode(@Param("dptcode")String dptcode,@Param("uptime")String uptime);
}
\ No newline at end of file
package orthopedics.dao;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Insert;
import orthopedics.model.TempSupplierFomPmp;
/**
* @author author
*/
public interface TempSupplierFomPmpMapper{
@Select("SELECT * FROM temp_supplier_fom_pmp")
@Results(id = "tempsupplierfompmp", value ={
@Result(property = "id", column = "id"),
@Result(property = "code", column = "code"),
@Result(property = "fullname", column = "fullname"),
@Result(property = "shortname", column = "shortname"),
@Result(property = "contact", column = "contact"),
@Result(property = "phone", column = "phone"),
@Result(property = "address", column = "address"),
})
public List<TempSupplierFomPmp> select();
@Insert("<script>" +
"INSERT INTO temp_supplier_fom_pmp(id,code,fullname,shortname,contact,phone,address) VALUES" +
"<foreach collection='tempsupplierfompmps' item='item' index='index' separator=','>" +
"(#{item.id},#{item.code},#{item.fullname},#{item.shortname},#{item.contact},#{item.phone},#{item.address})" +
"</foreach>" +
"</script>")
Integer insertBatch(@Param("tempsupplierfompmps") List<TempSupplierFomPmp> TempSupplierFomPmpList);
@Insert(
"INSERT INTO temp_supplier_fom_pmp(id,code,fullname,shortname,contact,phone,address) VALUES" +
"(#{id},#{code},#{fullname},#{shortname},#{contact},#{phone},#{address})"
)
Integer insert(TempSupplierFomPmp TempSupplierFomPmp);
}
\ No newline at end of file
package orthopedics.dao;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Insert;
import orthopedics.model.TempWarTransferFomPmp1;
/**
* @author author
*/
public interface TempWarTransferFomPmp1Mapper{
@Select("SELECT * FROM temp_war_transfer_fom_pmp1")
@Results(id = "tempwartransferfompmp1", value ={
@Result(property = "id", column = "id"),
@Result(property = "number", column = "number"),
@Result(property = "shop", column = "shop"),
@Result(property = "rcvshop", column = "rcvshop"),
@Result(property = "finishtime", column = "finishtime"),
@Result(property = "remarks", column = "remarks"),
@Result(property = "plucnt", column = "plucnt"),
@Result(property = "qty", column = "qty"),
@Result(property = "rqty", column = "rqty"),
@Result(property = "money", column = "money"),
@Result(property = "status", column = "status"),
})
public List<TempWarTransferFomPmp1> select();
@Insert("<script>" +
"INSERT INTO temp_war_transfer_fom_pmp1(id,number,shop,rcvshop,finishtime,remarks,plucnt,qty,rqty,money,status) VALUES" +
"<foreach collection='tempwartransferfompmp1s' item='item' index='index' separator=','>" +
"(#{item.id},#{item.number},#{item.shop},#{item.rcvshop},#{item.finishtime},#{item.remarks},#{item.plucnt},#{item.qty},#{item.rqty},#{item.money},#{item.status})" +
"</foreach>" +
"</script>")
Integer insertBatch(@Param("tempwartransferfompmp1s") List<TempWarTransferFomPmp1> TempWarTransferFomPmp1List);
@Insert(
"INSERT INTO temp_war_transfer_fom_pmp1(id,number,shop,rcvshop,finishtime,remarks,plucnt,qty,rqty,money,status) VALUES" +
"(#{id},#{number},#{shop},#{rcvshop},#{finishtime},#{remarks},#{plucnt},#{qty},#{rqty},#{money},#{status})"
)
Integer insert(TempWarTransferFomPmp1 TempWarTransferFomPmp1);
}
\ No newline at end of file
package orthopedics.dao;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Insert;
import orthopedics.model.TempWarTransferFomPmp;
/**
* @author author
*/
public interface TempWarTransferFomPmpMapper{
@Select("SELECT * FROM temp_war_transfer_fom_pmp")
@Results(id = "tempwartransferfompmp", value ={
@Result(property = "id", column = "id"),
@Result(property = "number", column = "number"),
@Result(property = "shop", column = "shop"),
@Result(property = "rcvshop", column = "rcvshop"),
@Result(property = "plucode", column = "plucode"),
@Result(property = "title", column = "title"),
@Result(property = "qty", column = "qty"),
@Result(property = "money", column = "money"),
@Result(property = "realmoney", column = "realmoney"),
@Result(property = "status", column = "status"),
})
public List<TempWarTransferFomPmp> select();
@Insert("<script>" +
"INSERT INTO temp_war_transfer_fom_pmp(id,number,shop,rcvshop,plucode,title,qty,money,realmoney,status) VALUES" +
"<foreach collection='tempwartransferfompmps' item='item' index='index' separator=','>" +
"(#{item.id},#{item.number},#{item.shop},#{item.rcvshop},#{item.plucode},#{item.title},#{item.qty},#{item.money},#{item.realmoney},#{item.status})" +
"</foreach>" +
"</script>")
Integer insertBatch(@Param("tempwartransferfompmps") List<TempWarTransferFomPmp> TempWarTransferFomPmpList);
@Insert(
"INSERT INTO temp_war_transfer_fom_pmp(id,number,shop,rcvshop,plucode,title,qty,money,realmoney,status) VALUES" +
"(#{id},#{number},#{shop},#{rcvshop},#{plucode},#{title},#{qty},#{money},#{realmoney},#{status})"
)
Integer insert(TempWarTransferFomPmp TempWarTransferFomPmp);
}
\ No newline at end of file
package orthopedics.dao;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Insert;
import orthopedics.model.TempWshShipmentFomPmp;
/**
* @author author
*/
public interface TempWshShipmentFomPmpMapper{
@Select("SELECT * FROM temp_wsh_shipment_fom_pmp")
@Results(id = "tempwshshipmentfompmp", value ={
@Result(property = "id", column = "id"),
@Result(property = "number", column = "number"),
@Result(property = "seq", column = "seq"),
@Result(property = "plucode", column = "plucode"),
@Result(property = "fromrack", column = "fromrack"),
@Result(property = "torack", column = "torack"),
@Result(property = "txndate", column = "txndate"),
@Result(property = "price", column = "price"),
@Result(property = "disc", column = "disc"),
@Result(property = "qty", column = "qty"),
@Result(property = "rcvqty", column = "rcvqty"),
@Result(property = "casenum", column = "casenum"),
})
public List<TempWshShipmentFomPmp> select();
@Insert("<script>" +
"INSERT INTO temp_wsh_shipment_fom_pmp(id,number,seq,plucode,fromrack,torack,txndate,price,disc,qty,rcvqty,casenum) VALUES" +
"<foreach collection='tempwshshipmentfompmps' item='item' index='index' separator=','>" +
"(#{item.id},#{item.number},#{item.seq},#{item.plucode},#{item.fromrack},#{item.torack},#{item.txndate},#{item.price},#{item.disc},#{item.qty},#{item.rcvqty},#{item.casenum})" +
"</foreach>" +
"</script>")
Integer insertBatch(@Param("tempwshshipmentfompmps") List<TempWshShipmentFomPmp> TempWshShipmentFomPmpList);
@Insert(
"INSERT INTO temp_wsh_shipment_fom_pmp(id,number,seq,plucode,fromrack,torack,txndate,price,disc,qty,rcvqty,casenum) VALUES" +
"(#{id},#{number},#{seq},#{plucode},#{fromrack},#{torack},#{txndate},#{price},#{disc},#{qty},#{rcvqty},#{casenum})"
)
Integer insert(TempWshShipmentFomPmp TempWshShipmentFomPmp);
}
\ No newline at end of file
......@@ -38,15 +38,15 @@ public class GlobalExceptionHandler {
return JSON.toJSONString(reponseResult);
}
@ExceptionHandler(MyException.class)
@ResponseBody
public String handleMyException(MyException exception) {
logger.error(getExceptionTrace(exception));
logger.info("异常发生:" + exception.getErrorEnum().getErrorCode() + "--" + exception.getErrorEnum().getErrorMsg());
Map<String, Object> reponseResult = new HashMap<>();
exception.getErrorEnum().putIntoMap(reponseResult);
return JSON.toJSONString(reponseResult);
}
// @ExceptionHandler(MyException.class)
// @ResponseBody
// public String handleMyException(MyException exception) {
// logger.error(getExceptionTrace(exception));
// logger.info("异常发生:" + exception.getErrorEnum().getErrorCode() + "--" + exception.getErrorEnum().getErrorMsg());
// Map<String, Object> reponseResult = new HashMap<>();
// exception.getErrorEnum().putIntoMap(reponseResult);
// return JSON.toJSONString(reponseResult);
// }
@ExceptionHandler({PersistenceException.class, DataAccessException.class})
@ResponseBody
......
......@@ -5,289 +5,289 @@ import java.util.HashMap;
import java.util.Map;
import java.util.List;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
/**
*
* @author ice
*/
*
* @author author
*/
public class PurOrderHeader implements Serializable {
private static final long serialVersionUID = 1566299147331L;
private static final long serialVersionUID = 1574760082295L;
/**
* 主键
* 主键
* isNullAble:0
*/
@JSONField(name = "id")
* 主键
* 主键
* isNullAble:0
*/
@JSONField(name = "id")
private String id;
/**
* 创建人
* isNullAble:1
*/
@JSONField(name = "create_by")
* 创建人
* isNullAble:1
*/
@JSONField(name = "create_by")
private String createBy;
/**
* 创建时间
* isNullAble:1
*/
@JSONField(name = "create_time")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
* 创建时间
* isNullAble:1
*/
@JSONField(name = "create_time")
private java.time.LocalDateTime createTime;
/**
* 最后更新人
* isNullAble:1
*/
@JSONField(name = "update_by")
* 最后更新人
* isNullAble:1
*/
@JSONField(name = "update_by")
private String updateBy;
/**
* 最后更新时间
* isNullAble:1
*/
@JSONField(name = "update_time")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
* 最后更新时间
* isNullAble:1
*/
@JSONField(name = "update_time")
private java.time.LocalDateTime updateTime;
/**
* 备用字段分类
* isNullAble:1
*/
@JSONField(name = "attribute_category")
* 备用字段分类
* isNullAble:1
*/
@JSONField(name = "attribute_category")
private String attributeCategory;
/**
* 备用字段1
* isNullAble:1
*/
@JSONField(name = "attribute1")
* 备用字段1
* isNullAble:1
*/
@JSONField(name = "attribute1")
private String attribute1;
/**
* 备用字段2
* isNullAble:1
*/
@JSONField(name = "attribute2")
* 备用字段2
* isNullAble:1
*/
@JSONField(name = "attribute2")
private String attribute2;
/**
* 备用子段3
* isNullAble:1
*/
@JSONField(name = "attribute3")
* 备用子段3
* isNullAble:1
*/
@JSONField(name = "attribute3")
private String attribute3;
/**
* 备用字段4
* isNullAble:1
*/
@JSONField(name = "attribute4")
* 备用字段4
* isNullAble:1
*/
@JSONField(name = "attribute4")
private String attribute4;
/**
* 备用字段5
* isNullAble:1
*/
@JSONField(name = "attribute5")
* 备用字段5
* isNullAble:1
*/
@JSONField(name = "attribute5")
private String attribute5;
/**
* 备用字段6
* isNullAble:1
*/
@JSONField(name = "attribute6")
* 备用字段6
* isNullAble:1
*/
@JSONField(name = "attribute6")
private String attribute6;
/**
* 备用字段7
* isNullAble:1
*/
@JSONField(name = "attribute7")
* 备用字段7
* isNullAble:1
*/
@JSONField(name = "attribute7")
private String attribute7;
/**
* 备用字段8
* isNullAble:1
*/
@JSONField(name = "attribute8")
* 备用字段8
* isNullAble:1
*/
@JSONField(name = "attribute8")
private String attribute8;
/**
* 备用字段9
* isNullAble:1
*/
@JSONField(name = "attribute9")
* 备用字段9
* isNullAble:1
*/
@JSONField(name = "attribute9")
private String attribute9;
/**
* 组织
* isNullAble:0
*/
@JSONField(name = "org_id")
* 组织
* isNullAble:0
*/
@JSONField(name = "org_id")
private String orgId;
/**
* 类型
* isNullAble:0
*/
@JSONField(name = "order_type")
* 类型
* isNullAble:0
*/
@JSONField(name = "order_type")
private String orderType;
/**
* 收单地点
* isNullAble:0
*/
@JSONField(name = "bill_to_location_id")
* 收单地点
* isNullAble:1
*/
@JSONField(name = "bill_to_location_id")
private String billToLocationId;
/**
* 编号
* isNullAble:0
*/
@JSONField(name = "order_number")
* 编号
* isNullAble:0
*/
@JSONField(name = "order_number")
private String orderNumber;
/**
* 收货地点
* isNullAble:0
*/
@JSONField(name = "ship_to_location_id")
* 收货地点
* isNullAble:1
*/
@JSONField(name = "ship_to_location_id")
private String shipToLocationId;
/**
* 订购日期
* isNullAble:0
*/
@JSONField(name = "order_date")
private String orderDate;
* 订购日期
* isNullAble:0
*/
@JSONField(name = "order_date")
private java.time.LocalDateTime orderDate;
/**
* 币种
* isNullAble:0
*/
@JSONField(name = "order_currency")
* 币种
* isNullAble:0
*/
@JSONField(name = "order_currency")
private String orderCurrency;
/**
* 供应商
* isNullAble:0
*/
@JSONField(name = "supplier_id")
* 供应商
* isNullAble:0
*/
@JSONField(name = "supplier_id")
private String supplierId;
/**
* 供应商地点
* isNullAble:0
*/
@JSONField(name = "supplier_site_id")
* 供应商地点
* isNullAble:1
*/
@JSONField(name = "supplier_site_id")
private String supplierSiteId;
/**
* 付款条款
* isNullAble:1
*/
@JSONField(name = "payment_terms")
* 付款条款
* isNullAble:1
*/
@JSONField(name = "payment_terms")
private String paymentTerms;
/**
* 付款方式
* isNullAble:1
*/
@JSONField(name = "payment_method")
* 付款方式
* isNullAble:1
*/
@JSONField(name = "payment_method")
private String paymentMethod;
/**
* 交货条款
* isNullAble:1
*/
@JSONField(name = "delivery_terms")
* 交货条款
* isNullAble:1
*/
@JSONField(name = "delivery_terms")
private String deliveryTerms;
/**
* 订单备注
* isNullAble:1
*/
@JSONField(name = "header_remark")
* 订单备注
* isNullAble:1
*/
@JSONField(name = "header_remark")
private String headerRemark;
/**
* 采购员
* isNullAble:0
*/
@JSONField(name = "buyer_id")
* 采购员
* isNullAble:0
*/
@JSONField(name = "buyer_id")
private String buyerId;
/**
* 寄售
* isNullAble:0
*/
@JSONField(name = "consigned_flag")
* 寄售
* isNullAble:1
*/
@JSONField(name = "consigned_flag")
private String consignedFlag;
/**
* 来源类型
* isNullAble:1
*/
@JSONField(name = "source_type")
* 来源类型
* isNullAble:1
*/
@JSONField(name = "source_type")
private String sourceType;
/**
* 来源头标识
* isNullAble:1
*/
@JSONField(name = "source_header_id")
* 来源头标识
* isNullAble:1
*/
@JSONField(name = "source_header_id")
private String sourceHeaderId;
/**
* 来源行标识
* isNullAble:1
*/
@JSONField(name = "source_line_id")
* 来源行标识
* isNullAble:1
*/
@JSONField(name = "source_line_id")
private String sourceLineId;
/**
* 订单状态
* isNullAble:1
*/
@JSONField(name = "header_status")
* 订单状态
* isNullAble:1,defaultVal:new
*/
@JSONField(name = "header_status")
private String headerStatus;
/**
* 创建人组织代码
* isNullAble:1
*/
@JSONField(name = "sys_org_code")
* 创建人组织代码
* isNullAble:1
*/
@JSONField(name = "sys_org_code")
private String sysOrgCode;
/**
* 来源单号
* isNullAble:1
*/
@JSONField(name = "source_header_number")
* 来源单号
* isNullAble:1
*/
@JSONField(name = "source_header_number")
private String sourceHeaderNumber;
/**
* 来源行号
* isNullAble:1
*/
@JSONField(name = "source_line_number")
* 来源行号
* isNullAble:1
*/
@JSONField(name = "source_line_number")
private String sourceLineNumber;
/**
* 备用字段10
* isNullAble:1
*/
@JSONField(name = "attribute10")
* 备用字段10
* isNullAble:1
*/
@JSONField(name = "attribute10")
private String attribute10;
/**
* 供应商编码
* isNullAble:1
*/
@JSONField(name = "supplier_code")
private String supplierCode;
public void setId(String id){this.id = id;}
......@@ -369,9 +369,9 @@ public class PurOrderHeader implements Serializable {
public String getShipToLocationId(){return this.shipToLocationId;}
public void setOrderDate(String orderDate){this.orderDate = orderDate;}
public void setOrderDate(java.time.LocalDateTime orderDate){this.orderDate = orderDate;}
public String getOrderDate(){return this.orderDate;}
public java.time.LocalDateTime getOrderDate(){return this.orderDate;}
public void setOrderCurrency(String orderCurrency){this.orderCurrency = orderCurrency;}
......@@ -440,6 +440,10 @@ public class PurOrderHeader implements Serializable {
public void setAttribute10(String attribute10){this.attribute10 = attribute10;}
public String getAttribute10(){return this.attribute10;}
public void setSupplierCode(String supplierCode){this.supplierCode = supplierCode;}
public String getSupplierCode(){return this.supplierCode;}
@Override
public String toString() {
return "PurOrderHeader{" +
......@@ -481,7 +485,8 @@ public class PurOrderHeader implements Serializable {
"sourceHeaderNumber='" + sourceHeaderNumber + '\'' +
"sourceLineNumber='" + sourceLineNumber + '\'' +
"attribute10='" + attribute10 + '\'' +
'}';
"supplierCode='" + supplierCode + '\'' +
'}';
}
}
package orthopedics.model;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.List;
import com.alibaba.fastjson.annotation.JSONField;
/**
*
* @author author
*/
public class PurSupplierContact implements Serializable {
private static final long serialVersionUID = 1574334555521L;
/**
* 主键
* id
* isNullAble:0
*/
@JSONField(name = "id")
private String id;
/**
* 创建人
* isNullAble:1
*/
@JSONField(name = "create_by")
private String createBy;
/**
* 创建日期
* isNullAble:1
*/
@JSONField(name = "create_time")
private java.time.LocalDateTime createTime;
/**
* 最后更新人
* isNullAble:1
*/
@JSONField(name = "update_by")
private String updateBy;
/**
* 最后更新日期
* isNullAble:1
*/
@JSONField(name = "update_time")
private java.time.LocalDateTime updateTime;
/**
* 备用字段分类
* isNullAble:1
*/
@JSONField(name = "attribute_category")
private String attributeCategory;
/**
* 备用字段1
* isNullAble:1
*/
@JSONField(name = "attribute1")
private String attribute1;
/**
* 备用字段2
* isNullAble:1
*/
@JSONField(name = "attribute2")
private String attribute2;
/**
* 备用子段3
* isNullAble:1
*/
@JSONField(name = "attribute3")
private String attribute3;
/**
* 备用字段4
* isNullAble:1
*/
@JSONField(name = "attribute4")
private String attribute4;
/**
* 备用字段5
* isNullAble:1
*/
@JSONField(name = "attribute5")
private String attribute5;
/**
* 备用字段6
* isNullAble:1
*/
@JSONField(name = "attribute6")
private String attribute6;
/**
* 备用字段7
* isNullAble:1
*/
@JSONField(name = "attribute7")
private String attribute7;
/**
* 备用字段8
* isNullAble:1
*/
@JSONField(name = "attribute8")
private String attribute8;
/**
* 备用字段9
* isNullAble:1
*/
@JSONField(name = "attribute9")
private String attribute9;
/**
* 备用字段10
* isNullAble:1
*/
@JSONField(name = "attribute10")
private String attribute10;
/**
* 供应商
* isNullAble:1
*/
@JSONField(name = "supplier_id")
private String supplierId;
/**
* 供应商地点
* isNullAble:1
*/
@JSONField(name = "supplier_site_id")
private String supplierSiteId;
/**
* 联系人类型
* isNullAble:1
*/
@JSONField(name = "contact_type")
private String contactType;
/**
* 联系人姓名
* isNullAble:1
*/
@JSONField(name = "contact_name")
private String contactName;
/**
* 国家
* isNullAble:1
*/
@JSONField(name = "country")
private String country;
/**
* 省份
* isNullAble:1
*/
@JSONField(name = "province")
private String province;
/**
* 城市
* isNullAble:1
*/
@JSONField(name = "city")
private String city;
/**
* 区县
* isNullAble:1
*/
@JSONField(name = "county")
private String county;
/**
* 乡镇
* isNullAble:1
*/
@JSONField(name = "town")
private String town;
/**
* 详细地址
* isNullAble:1
*/
@JSONField(name = "address")
private String address;
/**
* 邮政编码
* isNullAble:1
*/
@JSONField(name = "postal_code")
private String postalCode;
/**
* 电话
* isNullAble:1
*/
@JSONField(name = "telephone")
private String telephone;
/**
* 传真
* isNullAble:1
*/
@JSONField(name = "fax")
private String fax;
/**
* 说明
* isNullAble:1
*/
@JSONField(name = "contact_desc")
private String contactDesc;
/**
* 邮箱
* isNullAble:1
*/
@JSONField(name = "email")
private String email;
/**
* 微信
* isNullAble:1
*/
@JSONField(name = "wechat_open_id")
private String wechatOpenId;
/**
* 状态
* isNullAble:1
*/
@JSONField(name = "status")
private String status;
public void setId(String id){this.id = id;}
public String getId(){return this.id;}
public void setCreateBy(String createBy){this.createBy = createBy;}
public String getCreateBy(){return this.createBy;}
public void setCreateTime(java.time.LocalDateTime createTime){this.createTime = createTime;}
public java.time.LocalDateTime getCreateTime(){return this.createTime;}
public void setUpdateBy(String updateBy){this.updateBy = updateBy;}
public String getUpdateBy(){return this.updateBy;}
public void setUpdateTime(java.time.LocalDateTime updateTime){this.updateTime = updateTime;}
public java.time.LocalDateTime getUpdateTime(){return this.updateTime;}
public void setAttributeCategory(String attributeCategory){this.attributeCategory = attributeCategory;}
public String getAttributeCategory(){return this.attributeCategory;}
public void setAttribute1(String attribute1){this.attribute1 = attribute1;}
public String getAttribute1(){return this.attribute1;}
public void setAttribute2(String attribute2){this.attribute2 = attribute2;}
public String getAttribute2(){return this.attribute2;}
public void setAttribute3(String attribute3){this.attribute3 = attribute3;}
public String getAttribute3(){return this.attribute3;}
public void setAttribute4(String attribute4){this.attribute4 = attribute4;}
public String getAttribute4(){return this.attribute4;}
public void setAttribute5(String attribute5){this.attribute5 = attribute5;}
public String getAttribute5(){return this.attribute5;}
public void setAttribute6(String attribute6){this.attribute6 = attribute6;}
public String getAttribute6(){return this.attribute6;}
public void setAttribute7(String attribute7){this.attribute7 = attribute7;}
public String getAttribute7(){return this.attribute7;}
public void setAttribute8(String attribute8){this.attribute8 = attribute8;}
public String getAttribute8(){return this.attribute8;}
public void setAttribute9(String attribute9){this.attribute9 = attribute9;}
public String getAttribute9(){return this.attribute9;}
public void setAttribute10(String attribute10){this.attribute10 = attribute10;}
public String getAttribute10(){return this.attribute10;}
public void setSupplierId(String supplierId){this.supplierId = supplierId;}
public String getSupplierId(){return this.supplierId;}
public void setSupplierSiteId(String supplierSiteId){this.supplierSiteId = supplierSiteId;}
public String getSupplierSiteId(){return this.supplierSiteId;}
public void setContactType(String contactType){this.contactType = contactType;}
public String getContactType(){return this.contactType;}
public void setContactName(String contactName){this.contactName = contactName;}
public String getContactName(){return this.contactName;}
public void setCountry(String country){this.country = country;}
public String getCountry(){return this.country;}
public void setProvince(String province){this.province = province;}
public String getProvince(){return this.province;}
public void setCity(String city){this.city = city;}
public String getCity(){return this.city;}
public void setCounty(String county){this.county = county;}
public String getCounty(){return this.county;}
public void setTown(String town){this.town = town;}
public String getTown(){return this.town;}
public void setAddress(String address){this.address = address;}
public String getAddress(){return this.address;}
public void setPostalCode(String postalCode){this.postalCode = postalCode;}
public String getPostalCode(){return this.postalCode;}
public void setTelephone(String telephone){this.telephone = telephone;}
public String getTelephone(){return this.telephone;}
public void setFax(String fax){this.fax = fax;}
public String getFax(){return this.fax;}
public void setContactDesc(String contactDesc){this.contactDesc = contactDesc;}
public String getContactDesc(){return this.contactDesc;}
public void setEmail(String email){this.email = email;}
public String getEmail(){return this.email;}
public void setWechatOpenId(String wechatOpenId){this.wechatOpenId = wechatOpenId;}
public String getWechatOpenId(){return this.wechatOpenId;}
public void setStatus(String status){this.status = status;}
public String getStatus(){return this.status;}
@Override
public String toString() {
return "PurSupplierContact{" +
"id='" + id + '\'' +
"createBy='" + createBy + '\'' +
"createTime='" + createTime + '\'' +
"updateBy='" + updateBy + '\'' +
"updateTime='" + updateTime + '\'' +
"attributeCategory='" + attributeCategory + '\'' +
"attribute1='" + attribute1 + '\'' +
"attribute2='" + attribute2 + '\'' +
"attribute3='" + attribute3 + '\'' +
"attribute4='" + attribute4 + '\'' +
"attribute5='" + attribute5 + '\'' +
"attribute6='" + attribute6 + '\'' +
"attribute7='" + attribute7 + '\'' +
"attribute8='" + attribute8 + '\'' +
"attribute9='" + attribute9 + '\'' +
"attribute10='" + attribute10 + '\'' +
"supplierId='" + supplierId + '\'' +
"supplierSiteId='" + supplierSiteId + '\'' +
"contactType='" + contactType + '\'' +
"contactName='" + contactName + '\'' +
"country='" + country + '\'' +
"province='" + province + '\'' +
"city='" + city + '\'' +
"county='" + county + '\'' +
"town='" + town + '\'' +
"address='" + address + '\'' +
"postalCode='" + postalCode + '\'' +
"telephone='" + telephone + '\'' +
"fax='" + fax + '\'' +
"contactDesc='" + contactDesc + '\'' +
"email='" + email + '\'' +
"wechatOpenId='" + wechatOpenId + '\'' +
"status='" + status + '\'' +
'}';
}
}
......@@ -6,259 +6,210 @@ import java.util.Map;
import java.util.List;
import com.alibaba.fastjson.annotation.JSONField;
/**
*
* @author cen.zhihong
*/
*
* @author author
*/
public class PurSupplierSite implements Serializable {
private static final long serialVersionUID = 1564040141259L;
private static final long serialVersionUID = 1574734758598L;
/**
* 主键
* 主键
* isNullAble:0
*/
@JSONField(name = "id")
* 主键
* 主键
* isNullAble:0
*/
@JSONField(name = "id")
private String id;
/**
* 创建人
* isNullAble:1
*/
@JSONField(name = "create_by")
* 创建人
* isNullAble:1
*/
@JSONField(name = "create_by")
private String createBy;
/**
* 创建日期
* isNullAble:1
*/
@JSONField(name = "create_time")
* 创建日期
* isNullAble:1
*/
@JSONField(name = "create_time")
private java.time.LocalDateTime createTime;
/**
* 最后更新人
* isNullAble:1
*/
@JSONField(name = "update_by")
* 最后更新人
* isNullAble:1
*/
@JSONField(name = "update_by")
private String updateBy;
/**
* 最后更新日期
* isNullAble:1
*/
@JSONField(name = "update_time")
* 最后更新日期
* isNullAble:1
*/
@JSONField(name = "update_time")
private java.time.LocalDateTime updateTime;
/**
* 备用字段分类
* isNullAble:1
*/
@JSONField(name = "attribute_category")
* 备用字段分类
* isNullAble:1
*/
@JSONField(name = "attribute_category")
private String attributeCategory;
/**
* 备用字段1
* isNullAble:1
*/
@JSONField(name = "attribute1")
* 备用字段1
* isNullAble:1
*/
@JSONField(name = "attribute1")
private String attribute1;
/**
* 备用字段2
* isNullAble:1
*/
@JSONField(name = "attribute2")
* 备用字段2
* isNullAble:1
*/
@JSONField(name = "attribute2")
private String attribute2;
/**
* 备用子段3
* isNullAble:1
*/
@JSONField(name = "attribute3")
* 备用子段3
* isNullAble:1
*/
@JSONField(name = "attribute3")
private String attribute3;
/**
* 备用字段4
* isNullAble:1
*/
@JSONField(name = "attribute4")
* 备用字段4
* isNullAble:1
*/
@JSONField(name = "attribute4")
private String attribute4;
/**
* 备用字段5
* isNullAble:1
*/
@JSONField(name = "attribute5")
* 备用字段5
* isNullAble:1
*/
@JSONField(name = "attribute5")
private String attribute5;
/**
* 备用字段6
* isNullAble:1
*/
@JSONField(name = "attribute6")
* 备用字段6
* isNullAble:1
*/
@JSONField(name = "attribute6")
private String attribute6;
/**
* 备用字段7
* isNullAble:1
*/
@JSONField(name = "attribute7")
* 备用字段7
* isNullAble:1
*/
@JSONField(name = "attribute7")
private String attribute7;
/**
* 备用字段8
* isNullAble:1
*/
@JSONField(name = "attribute8")
* 备用字段8
* isNullAble:1
*/
@JSONField(name = "attribute8")
private String attribute8;
/**
* 备用字段9
* isNullAble:1
*/
@JSONField(name = "attribute9")
* 备用字段9
* isNullAble:1
*/
@JSONField(name = "attribute9")
private String attribute9;
/**
* 备用字段10
* isNullAble:1
*/
@JSONField(name = "attribute10")
* 备用字段10
* isNullAble:1
*/
@JSONField(name = "attribute10")
private String attribute10;
/**
* 组织
* isNullAble:0
*/
@JSONField(name = "org_id")
private String orgId;
/**
* 供应商
* isNullAble:1
*/
@JSONField(name = "supplier_id")
* 供应商
* isNullAble:0
*/
@JSONField(name = "supplier_id")
private String supplierId;
/**
* 供应商地点类型
* isNullAble:0
*/
@JSONField(name = "supplier_site_type")
* 地点类型
* isNullAble:1
*/
@JSONField(name = "supplier_site_type")
private String supplierSiteType;
/**
* 供应商地点编码
* isNullAble:1
*/
@JSONField(name = "supplier_site_code")
* 地点编码
* isNullAble:1
*/
@JSONField(name = "supplier_site_code")
private String supplierSiteCode;
/**
* 供应商地点名称
* isNullAble:1
*/
@JSONField(name = "supplier_site_name")
* 地点名称
* isNullAble:1
*/
@JSONField(name = "supplier_site_name")
private String supplierSiteName;
/**
* 供应商地点简称
* isNullAble:1
*/
@JSONField(name = "supplier_site_short_name")
* 地点简称
* isNullAble:1
*/
@JSONField(name = "supplier_site_short_name")
private String supplierSiteShortName;
/**
* 国家
* isNullAble:1
*/
@JSONField(name = "country")
private String country;
/**
* 省份
* isNullAble:1
*/
@JSONField(name = "province")
private String province;
/**
* 城市
* isNullAble:1
*/
@JSONField(name = "city")
private String city;
/**
* 区县
* isNullAble:1
*/
@JSONField(name = "county")
private String county;
/**
* 乡镇
* isNullAble:1
*/
@JSONField(name = "town")
private String town;
/**
* 地址
* isNullAble:1
*/
@JSONField(name = "address")
* 详细地址
* isNullAble:1
*/
@JSONField(name = "address")
private String address;
/**
* 邮政编码
* isNullAble:1
*/
@JSONField(name = "postal_code")
* 邮政编码
* isNullAble:1
*/
@JSONField(name = "postal_code")
private String postalCode;
/**
* 电话
* isNullAble:1
*/
@JSONField(name = "telephone")
* 电话
* isNullAble:1
*/
@JSONField(name = "telephone")
private String telephone;
/**
* 传真
* isNullAble:1
*/
@JSONField(name = "fax")
* 传真
* isNullAble:1
*/
@JSONField(name = "fax")
private String fax;
/**
* 地点
* isNullAble:1
*/
@JSONField(name = "location_id")
private String locationId;
/**
* 供应商地点说明
* isNullAble:1
*/
@JSONField(name = "supplier_site_desc")
private String supplierSiteDesc;
* 状态
* isNullAble:1
*/
@JSONField(name = "status")
private String status;
/**
* 默认地点
* isNullAble:1
*/
@JSONField(name = "default_flag")
private String defaultFlag;
* 供应商名称
* isNullAble:1
*/
@JSONField(name = "supplier_name")
private String supplierName;
/**
* 状态
* isNullAble:1
*/
@JSONField(name = "status")
private String status;
* 供应商编码
* isNullAble:1
*/
@JSONField(name = "supplier_code")
private String supplierCode;
public void setId(String id){this.id = id;}
......@@ -325,10 +276,6 @@ public class PurSupplierSite implements Serializable {
public String getAttribute10(){return this.attribute10;}
public void setOrgId(String orgId){this.orgId = orgId;}
public String getOrgId(){return this.orgId;}
public void setSupplierId(String supplierId){this.supplierId = supplierId;}
public String getSupplierId(){return this.supplierId;}
......@@ -349,26 +296,6 @@ public class PurSupplierSite implements Serializable {
public String getSupplierSiteShortName(){return this.supplierSiteShortName;}
public void setCountry(String country){this.country = country;}
public String getCountry(){return this.country;}
public void setProvince(String province){this.province = province;}
public String getProvince(){return this.province;}
public void setCity(String city){this.city = city;}
public String getCity(){return this.city;}
public void setCounty(String county){this.county = county;}
public String getCounty(){return this.county;}
public void setTown(String town){this.town = town;}
public String getTown(){return this.town;}
public void setAddress(String address){this.address = address;}
public String getAddress(){return this.address;}
......@@ -385,21 +312,17 @@ public class PurSupplierSite implements Serializable {
public String getFax(){return this.fax;}
public void setLocationId(String locationId){this.locationId = locationId;}
public String getLocationId(){return this.locationId;}
public void setSupplierSiteDesc(String supplierSiteDesc){this.supplierSiteDesc = supplierSiteDesc;}
public void setStatus(String status){this.status = status;}
public String getSupplierSiteDesc(){return this.supplierSiteDesc;}
public String getStatus(){return this.status;}
public void setDefaultFlag(String defaultFlag){this.defaultFlag = defaultFlag;}
public void setSupplierName(String supplierName){this.supplierName = supplierName;}
public String getDefaultFlag(){return this.defaultFlag;}
public String getSupplierName(){return this.supplierName;}
public void setStatus(String status){this.status = status;}
public void setSupplierCode(String supplierCode){this.supplierCode = supplierCode;}
public String getStatus(){return this.status;}
public String getSupplierCode(){return this.supplierCode;}
@Override
public String toString() {
return "PurSupplierSite{" +
......@@ -419,26 +342,19 @@ public class PurSupplierSite implements Serializable {
"attribute8='" + attribute8 + '\'' +
"attribute9='" + attribute9 + '\'' +
"attribute10='" + attribute10 + '\'' +
"orgId='" + orgId + '\'' +
"supplierId='" + supplierId + '\'' +
"supplierSiteType='" + supplierSiteType + '\'' +
"supplierSiteCode='" + supplierSiteCode + '\'' +
"supplierSiteName='" + supplierSiteName + '\'' +
"supplierSiteShortName='" + supplierSiteShortName + '\'' +
"country='" + country + '\'' +
"province='" + province + '\'' +
"city='" + city + '\'' +
"county='" + county + '\'' +
"town='" + town + '\'' +
"address='" + address + '\'' +
"postalCode='" + postalCode + '\'' +
"telephone='" + telephone + '\'' +
"fax='" + fax + '\'' +
"locationId='" + locationId + '\'' +
"supplierSiteDesc='" + supplierSiteDesc + '\'' +
"defaultFlag='" + defaultFlag + '\'' +
"status='" + status + '\'' +
'}';
"supplierName='" + supplierName + '\'' +
"supplierCode='" + supplierCode + '\'' +
'}';
}
}
}
\ No newline at end of file
package orthopedics.model;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.List;
import com.alibaba.fastjson.annotation.JSONField;
/**
*
* @author author
*/
public class TempPurOrderFomPmp implements Serializable {
private static final long serialVersionUID = 1573724042918L;
/**
* 主键
* 主键
* isNullAble:0
*/
@JSONField(name = "id")
private Integer id;
/**
* 请配单号
* isNullAble:1
*/
@JSONField(name = "number")
private String number;
/**
* 请配仓号
* isNullAble:1
*/
@JSONField(name = "shop")
private String shop;
/**
* 货号
* isNullAble:1
*/
@JSONField(name = "plucode")
private String plucode;
/**
* 货名
* isNullAble:1
*/
@JSONField(name = "title")
private String title;
/**
* 价格
* isNullAble:1
*/
@JSONField(name = "price")
private java.math.BigDecimal price;
/**
* 数量
* isNullAble:1
*/
@JSONField(name = "qty")
private Integer qty;
/**
* 为空:未转配拣;不为空:已转配拣
* isNullAble:1
*/
@JSONField(name = "hdltime")
private String hdltime;
public void setId(Integer id){this.id = id;}
public Integer getId(){return this.id;}
public void setNumber(String number){this.number = number;}
public String getNumber(){return this.number;}
public void setShop(String shop){this.shop = shop;}
public String getShop(){return this.shop;}
public void setPlucode(String plucode){this.plucode = plucode;}
public String getPlucode(){return this.plucode;}
public void setTitle(String title){this.title = title;}
public String getTitle(){return this.title;}
public void setPrice(java.math.BigDecimal price){this.price = price;}
public java.math.BigDecimal getPrice(){return this.price;}
public void setQty(Integer qty){this.qty = qty;}
public Integer getQty(){return this.qty;}
public void setHdltime(String hdltime){this.hdltime = hdltime;}
public String getHdltime(){return this.hdltime;}
@Override
public String toString() {
return "TempPurOrderFomPmp{" +
"id='" + id + '\'' +
"number='" + number + '\'' +
"shop='" + shop + '\'' +
"plucode='" + plucode + '\'' +
"title='" + title + '\'' +
"price='" + price + '\'' +
"qty='" + qty + '\'' +
"hdltime='" + hdltime + '\'' +
'}';
}
}
package orthopedics.model;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.List;
import com.alibaba.fastjson.annotation.JSONField;
/**
*
* @author author
*/
public class TempRcvReceiptFomPmp implements Serializable {
private static final long serialVersionUID = 1573797812141L;
/**
* 主键
* 主键
* isNullAble:0
*/
@JSONField(name = "id")
private Integer id;
/**
* 分发单号,唯一标识
* isNullAble:1
*/
@JSONField(name = "number")
private String number;
/**
* 仓号
* isNullAble:1
*/
@JSONField(name = "shop")
private String shop;
/**
* 仓号名称
* isNullAble:1
*/
@JSONField(name = "descript")
private String descript;
/**
* 确认人
* isNullAble:1
*/
@JSONField(name = "rcvby")
private String rcvby;
/**
* 确认时间
* isNullAble:1
*/
@JSONField(name = "rcvtime")
private String rcvtime;
/**
* 货号
* isNullAble:1
*/
@JSONField(name = "plucode")
private String plucode;
/**
* 货名
* isNullAble:1
*/
@JSONField(name = "title")
private String title;
/**
* 数量
* isNullAble:1
*/
@JSONField(name = "qty")
private Integer qty;
/**
* 码洋
* isNullAble:1
*/
@JSONField(name = "money")
private java.math.BigDecimal money;
/**
* 实洋
* isNullAble:1
*/
@JSONField(name = "realmoney")
private java.math.BigDecimal realmoney;
/**
* 状态
* isNullAble:1
*/
@JSONField(name = "status")
private Integer status;
public void setId(Integer id){this.id = id;}
public Integer getId(){return this.id;}
public void setNumber(String number){this.number = number;}
public String getNumber(){return this.number;}
public void setShop(String shop){this.shop = shop;}
public String getShop(){return this.shop;}
public void setDescript(String descript){this.descript = descript;}
public String getDescript(){return this.descript;}
public void setRcvby(String rcvby){this.rcvby = rcvby;}
public String getRcvby(){return this.rcvby;}
public void setRcvtime(String rcvtime){this.rcvtime = rcvtime;}
public String getRcvtime(){return this.rcvtime;}
public void setPlucode(String plucode){this.plucode = plucode;}
public String getPlucode(){return this.plucode;}
public void setTitle(String title){this.title = title;}
public String getTitle(){return this.title;}
public void setQty(Integer qty){this.qty = qty;}
public Integer getQty(){return this.qty;}
public void setMoney(java.math.BigDecimal money){this.money = money;}
public java.math.BigDecimal getMoney(){return this.money;}
public void setRealmoney(java.math.BigDecimal realmoney){this.realmoney = realmoney;}
public java.math.BigDecimal getRealmoney(){return this.realmoney;}
public void setStatus(Integer status){this.status = status;}
public Integer getStatus(){return this.status;}
@Override
public String toString() {
return "TempRcvReceiptFomPmp{" +
"id='" + id + '\'' +
"number='" + number + '\'' +
"shop='" + shop + '\'' +
"descript='" + descript + '\'' +
"rcvby='" + rcvby + '\'' +
"rcvtime='" + rcvtime + '\'' +
"plucode='" + plucode + '\'' +
"title='" + title + '\'' +
"qty='" + qty + '\'' +
"money='" + money + '\'' +
"realmoney='" + realmoney + '\'' +
"status='" + status + '\'' +
'}';
}
}
package orthopedics.model;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.List;
import com.alibaba.fastjson.annotation.JSONField;
/**
*
* @author author
*/
public class TempSalOrderFomPmp implements Serializable {
private static final long serialVersionUID = 1574306443677L;
/**
* 主键
* 主键
* isNullAble:0
*/
@JSONField(name = "id")
private Integer id;
/**
* 操作时间
* isNullAble:1
*/
@JSONField(name = "txntime")
private java.time.LocalDateTime txntime;
/**
* 收银员账号
* isNullAble:1
*/
@JSONField(name = "operator")
private String operator;
/**
* 小票单号
* isNullAble:1
*/
@JSONField(name = "vouchnum")
private Integer vouchnum;
/**
* 支付方式
* isNullAble:1
*/
@JSONField(name = "dptcode")
private String dptcode;
/**
* 商品条码
* isNullAble:1
*/
@JSONField(name = "code")
private String code;
/**
* 数量
* isNullAble:1
*/
@JSONField(name = "qty")
private Integer qty;
/**
* 单价
* isNullAble:1
*/
@JSONField(name = "price")
private Integer price;
/**
* 折扣
* isNullAble:1
*/
@JSONField(name = "disc")
private Integer disc;
/**
* 订单总价
* isNullAble:1
*/
@JSONField(name = "orgamt")
private Integer orgamt;
/**
* 单据序号
* isNullAble:1
*/
@JSONField(name = "sequence")
private Integer sequence;
/**
* 分类代码(小类)
* isNullAble:1
*/
@JSONField(name = "clscode")
private String clscode;
/**
* 分类代码
* isNullAble:1
*/
@JSONField(name = "display")
private String display;
/**
* 扣款金额
* isNullAble:1
*/
@JSONField(name = "itemdisc")
private Integer itemdisc;
/**
* 每笔支付方式支付的金额
* isNullAble:1
*/
@JSONField(name = "price2")
private Integer price2;
/**
* 状态
* isNullAble:1
*/
@JSONField(name = "status")
private Integer status;
public void setId(Integer id){this.id = id;}
public Integer getId(){return this.id;}
public void setTxntime(java.time.LocalDateTime txntime){this.txntime = txntime;}
public java.time.LocalDateTime getTxntime(){return this.txntime;}
public void setOperator(String operator){this.operator = operator;}
public String getOperator(){return this.operator;}
public void setVouchnum(Integer vouchnum){this.vouchnum = vouchnum;}
public Integer getVouchnum(){return this.vouchnum;}
public void setDptcode(String dptcode){this.dptcode = dptcode;}
public String getDptcode(){return this.dptcode;}
public void setCode(String code){this.code = code;}
public String getCode(){return this.code;}
public void setQty(Integer qty){this.qty = qty;}
public Integer getQty(){return this.qty;}
public void setPrice(Integer price){this.price = price;}
public Integer getPrice(){return this.price;}
public void setDisc(Integer disc){this.disc = disc;}
public Integer getDisc(){return this.disc;}
public void setOrgamt(Integer orgamt){this.orgamt = orgamt;}
public Integer getOrgamt(){return this.orgamt;}
public void setSequence(Integer sequence){this.sequence = sequence;}
public Integer getSequence(){return this.sequence;}
public void setClscode(String clscode){this.clscode = clscode;}
public String getClscode(){return this.clscode;}
public void setDisplay(String display){this.display = display;}
public String getDisplay(){return this.display;}
public void setItemdisc(Integer itemdisc){this.itemdisc = itemdisc;}
public Integer getItemdisc(){return this.itemdisc;}
public void setPrice2(Integer price2){this.price2 = price2;}
public Integer getPrice2(){return this.price2;}
public void setStatus(Integer status){this.status = status;}
public Integer getStatus(){return this.status;}
@Override
public String toString() {
return "TempSalOrderFomPmp{" +
"id='" + id + '\'' +
"txntime='" + txntime + '\'' +
"operator='" + operator + '\'' +
"vouchnum='" + vouchnum + '\'' +
"dptcode='" + dptcode + '\'' +
"code='" + code + '\'' +
"qty='" + qty + '\'' +
"price='" + price + '\'' +
"disc='" + disc + '\'' +
"orgamt='" + orgamt + '\'' +
"sequence='" + sequence + '\'' +
"clscode='" + clscode + '\'' +
"display='" + display + '\'' +
"itemdisc='" + itemdisc + '\'' +
"price2='" + price2 + '\'' +
"status='" + status + '\'' +
'}';
}
}
\ No newline at end of file
package orthopedics.model;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.List;
import com.alibaba.fastjson.annotation.JSONField;
/**
*
* @author author
*/
public class TempSupplierFomPmp implements Serializable {
private static final long serialVersionUID = 1573721281639L;
/**
* 主键
* 主键
* isNullAble:0
*/
@JSONField(name = "id")
private Integer id;
/**
* 供商代码
* isNullAble:1
*/
@JSONField(name = "code")
private String code;
/**
* 供商全称
* isNullAble:1
*/
@JSONField(name = "fullname")
private String fullname;
/**
* 供商简称
* isNullAble:1
*/
@JSONField(name = "shortname")
private String shortname;
/**
* 联系人
* isNullAble:1
*/
@JSONField(name = "contact")
private String contact;
/**
* 联系电话
* isNullAble:1
*/
@JSONField(name = "phone")
private String phone;
/**
* 联系地址
* isNullAble:1
*/
@JSONField(name = "address")
private String address;
public void setId(Integer id){this.id = id;}
public Integer getId(){return this.id;}
public void setCode(String code){this.code = code;}
public String getCode(){return this.code;}
public void setFullname(String fullname){this.fullname = fullname;}
public String getFullname(){return this.fullname;}
public void setShortname(String shortname){this.shortname = shortname;}
public String getShortname(){return this.shortname;}
public void setContact(String contact){this.contact = contact;}
public String getContact(){return this.contact;}
public void setPhone(String phone){this.phone = phone;}
public String getPhone(){return this.phone;}
public void setAddress(String address){this.address = address;}
public String getAddress(){return this.address;}
@Override
public String toString() {
return "TempSupplierFomPmp{" +
"id='" + id + '\'' +
"code='" + code + '\'' +
"fullname='" + fullname + '\'' +
"shortname='" + shortname + '\'' +
"contact='" + contact + '\'' +
"phone='" + phone + '\'' +
"address='" + address + '\'' +
'}';
}
}
package orthopedics.model;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.List;
import com.alibaba.fastjson.annotation.JSONField;
/**
*
* @author author
*/
public class TempWarTransferFomPmp implements Serializable {
private static final long serialVersionUID = 1574323964496L;
/**
* 主键
* 主键
* isNullAble:0
*/
@JSONField(name = "id")
private Integer id;
/**
* pmp调剂单号,唯一标识
* isNullAble:1
*/
@JSONField(name = "number")
private String number;
/**
* 出货仓号
* isNullAble:1
*/
@JSONField(name = "shop")
private String shop;
/**
* 收货仓号
* isNullAble:1
*/
@JSONField(name = "rcvshop")
private String rcvshop;
/**
* 货号
* isNullAble:1
*/
@JSONField(name = "plucode")
private String plucode;
/**
* 货名
* isNullAble:1
*/
@JSONField(name = "title")
private String title;
/**
* 数量
* isNullAble:1
*/
@JSONField(name = "qty")
private Integer qty;
/**
* 码洋
* isNullAble:1
*/
@JSONField(name = "money")
private java.math.BigDecimal money;
/**
* 实洋
* isNullAble:1
*/
@JSONField(name = "realmoney")
private java.math.BigDecimal realmoney;
/**
* 状态
* isNullAble:1
*/
@JSONField(name = "status")
private Integer status;
public void setId(Integer id){this.id = id;}
public Integer getId(){return this.id;}
public void setNumber(String number){this.number = number;}
public String getNumber(){return this.number;}
public void setShop(String shop){this.shop = shop;}
public String getShop(){return this.shop;}
public void setRcvshop(String rcvshop){this.rcvshop = rcvshop;}
public String getRcvshop(){return this.rcvshop;}
public void setPlucode(String plucode){this.plucode = plucode;}
public String getPlucode(){return this.plucode;}
public void setTitle(String title){this.title = title;}
public String getTitle(){return this.title;}
public void setQty(Integer qty){this.qty = qty;}
public Integer getQty(){return this.qty;}
public void setMoney(java.math.BigDecimal money){this.money = money;}
public java.math.BigDecimal getMoney(){return this.money;}
public void setRealmoney(java.math.BigDecimal realmoney){this.realmoney = realmoney;}
public java.math.BigDecimal getRealmoney(){return this.realmoney;}
public void setStatus(Integer status){this.status = status;}
public Integer getStatus(){return this.status;}
@Override
public String toString() {
return "TempWarTransferFomPmp{" +
"id='" + id + '\'' +
"number='" + number + '\'' +
"shop='" + shop + '\'' +
"rcvshop='" + rcvshop + '\'' +
"plucode='" + plucode + '\'' +
"title='" + title + '\'' +
"qty='" + qty + '\'' +
"money='" + money + '\'' +
"realmoney='" + realmoney + '\'' +
"status='" + status + '\'' +
'}';
}
}
package orthopedics.model;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.List;
import com.alibaba.fastjson.annotation.JSONField;
/**
*
* @author author
*/
public class TempWarTransferFomPmp1 implements Serializable {
private static final long serialVersionUID = 1574325830387L;
/**
* 主键
* 主键
* isNullAble:0
*/
@JSONField(name = "id")
private Integer id;
/**
* 单号
* isNullAble:1
*/
@JSONField(name = "number")
private String number;
/**
* 退仓门市
* isNullAble:1
*/
@JSONField(name = "shop")
private String shop;
/**
* 收货门市
* isNullAble:1
*/
@JSONField(name = "rcvshop")
private String rcvshop;
/**
* 收货时间
* isNullAble:1
*/
@JSONField(name = "finishtime")
private String finishtime;
/**
* 备注
* isNullAble:1
*/
@JSONField(name = "remarks")
private String remarks;
/**
* 品种数
* isNullAble:1
*/
@JSONField(name = "plucnt")
private String plucnt;
/**
* 发货数
* isNullAble:1
*/
@JSONField(name = "qty")
private String qty;
/**
* 实收数
* isNullAble:1
*/
@JSONField(name = "rqty")
private java.math.BigDecimal rqty;
/**
* 实洋
* isNullAble:1
*/
@JSONField(name = "money")
private java.math.BigDecimal money;
/**
* 状态
* isNullAble:1
*/
@JSONField(name = "status")
private Integer status;
public void setId(Integer id){this.id = id;}
public Integer getId(){return this.id;}
public void setNumber(String number){this.number = number;}
public String getNumber(){return this.number;}
public void setShop(String shop){this.shop = shop;}
public String getShop(){return this.shop;}
public void setRcvshop(String rcvshop){this.rcvshop = rcvshop;}
public String getRcvshop(){return this.rcvshop;}
public void setFinishtime(String finishtime){this.finishtime = finishtime;}
public String getFinishtime(){return this.finishtime;}
public void setRemarks(String remarks){this.remarks = remarks;}
public String getRemarks(){return this.remarks;}
public void setPlucnt(String plucnt){this.plucnt = plucnt;}
public String getPlucnt(){return this.plucnt;}
public void setQty(String qty){this.qty = qty;}
public String getQty(){return this.qty;}
public void setRqty(java.math.BigDecimal rqty){this.rqty = rqty;}
public java.math.BigDecimal getRqty(){return this.rqty;}
public void setMoney(java.math.BigDecimal money){this.money = money;}
public java.math.BigDecimal getMoney(){return this.money;}
public void setStatus(Integer status){this.status = status;}
public Integer getStatus(){return this.status;}
@Override
public String toString() {
return "TempWarTransferFomPmp1{" +
"id='" + id + '\'' +
"number='" + number + '\'' +
"shop='" + shop + '\'' +
"rcvshop='" + rcvshop + '\'' +
"finishtime='" + finishtime + '\'' +
"remarks='" + remarks + '\'' +
"plucnt='" + plucnt + '\'' +
"qty='" + qty + '\'' +
"rqty='" + rqty + '\'' +
"money='" + money + '\'' +
"status='" + status + '\'' +
'}';
}
}
package orthopedics.model;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.List;
import com.alibaba.fastjson.annotation.JSONField;
/**
*
* @author author
*/
public class TempWshShipmentFomPmp implements Serializable {
private static final long serialVersionUID = 1573800933839L;
/**
* 主键
* 主键
* isNullAble:0
*/
@JSONField(name = "id")
private Integer id;
/**
* 单号
* isNullAble:1
*/
@JSONField(name = "number")
private String number;
/**
* 序号
* isNullAble:1
*/
@JSONField(name = "seq")
private Integer seq;
/**
* 货号
* isNullAble:1
*/
@JSONField(name = "plucode")
private String plucode;
/**
* 调出仓
* isNullAble:1
*/
@JSONField(name = "fromrack")
private String fromrack;
/**
* 调入仓
* isNullAble:1
*/
@JSONField(name = "torack")
private String torack;
/**
*
* isNullAble:1
*/
@JSONField(name = "txndate")
private String txndate;
/**
* 价格
* isNullAble:1
*/
@JSONField(name = "price")
private java.math.BigDecimal price;
/**
* 折扣
* isNullAble:1
*/
@JSONField(name = "disc")
private java.math.BigDecimal disc;
/**
* 下架数量
* isNullAble:1
*/
@JSONField(name = "qty")
private Integer qty;
/**
* 收货数量
* isNullAble:1
*/
@JSONField(name = "rcvqty")
private Integer rcvqty;
/**
* 箱号
* isNullAble:1
*/
@JSONField(name = "casenum")
private String casenum;
public void setId(Integer id){this.id = id;}
public Integer getId(){return this.id;}
public void setNumber(String number){this.number = number;}
public String getNumber(){return this.number;}
public void setSeq(Integer seq){this.seq = seq;}
public Integer getSeq(){return this.seq;}
public void setPlucode(String plucode){this.plucode = plucode;}
public String getPlucode(){return this.plucode;}
public void setFromrack(String fromrack){this.fromrack = fromrack;}
public String getFromrack(){return this.fromrack;}
public void setTorack(String torack){this.torack = torack;}
public String getTorack(){return this.torack;}
public void setTxndate(String txndate){this.txndate = txndate;}
public String getTxndate(){return this.txndate;}
public void setPrice(java.math.BigDecimal price){this.price = price;}
public java.math.BigDecimal getPrice(){return this.price;}
public void setDisc(java.math.BigDecimal disc){this.disc = disc;}
public java.math.BigDecimal getDisc(){return this.disc;}
public void setQty(Integer qty){this.qty = qty;}
public Integer getQty(){return this.qty;}
public void setRcvqty(Integer rcvqty){this.rcvqty = rcvqty;}
public Integer getRcvqty(){return this.rcvqty;}
public void setCasenum(String casenum){this.casenum = casenum;}
public String getCasenum(){return this.casenum;}
@Override
public String toString() {
return "TempWshShipmentFomPmp{" +
"id='" + id + '\'' +
"number='" + number + '\'' +
"seq='" + seq + '\'' +
"plucode='" + plucode + '\'' +
"fromrack='" + fromrack + '\'' +
"torack='" + torack + '\'' +
"txndate='" + txndate + '\'' +
"price='" + price + '\'' +
"disc='" + disc + '\'' +
"qty='" + qty + '\'' +
"rcvqty='" + rcvqty + '\'' +
"casenum='" + casenum + '\'' +
'}';
}
}
......@@ -14,7 +14,7 @@ spring.datasource.driverClassName = com.mysql.jdbc.Driver
#书城测试服务器
#spring.datasource.url = jdbc:mysql://116.62.111.56:3306/bookcity?useUnicode=true&characterEncoding=utf-8&useSSL=false&allowMultiQueries=true
#书城正式服务器
spring.datasource.url = jdbc:mysql://127.0.0.1:3306/bookcity?useUnicode=true&characterEncoding=utf-8&useSSL=false&allowMultiQueries=true
spring.datasource.url = jdbc:mysql://10.200.5.47:3306/bookcity?useUnicode=true&characterEncoding=utf-8&useSSL=false&allowMultiQueries=true
spring.datasource.username = root
spring.datasource.password = 123456
......@@ -25,7 +25,6 @@ spring.datasource.password = 123456
invoice_output_path = /var/www/orthopedics/invoice/
#\u5E8F\u5217\u7684\u4E0A\u4F20\u8DEF\u5F84
UPLOAD_PATH = /var/www/tomcat/upload/serial/
UPLOAD_PATH_IN_DATABASE = upload/serial/
......@@ -49,5 +48,10 @@ SRB_INV_ITEM = http://116.62.111.56:5000/invItem/
SRB_INV_INVENTORY = http://116.62.111.56:5000/store/
# 打印sql
#logging.level.orthopedics.dao=debug
synchronizationTime = 2019-10-26 00-00-00
temp_fom_pmp_token = 20190904153120997a6088c4da5964015a88fa7a03651c2ff003h5Ol5W04Qp61
......@@ -11,12 +11,12 @@ import java.util.Set;
public class Demo {
public static void main(String[] args) {
Set s=new HashSet();
IdWorker id=new IdWorker();
for (long i=0;i<10000000;i++){
s.add(id.nextId());
}
System.err.println(s.size());
// Set s=new HashSet();
// IdWorker id=new IdWorker();
// for (long i=0;i<10000000;i++){
// s.add(id.nextId());
// }
System.err.println(2/10000==0);
}
......
//package orthopedics.test;
//
//import com.alibaba.fastjson.JSON;
//import com.alibaba.fastjson.JSONObject;
//import org.apache.ibatis.annotations.Update;
//import org.junit.Test;
//import org.junit.runner.RunWith;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.boot.test.context.SpringBootTest;
//import org.springframework.data.redis.core.RedisTemplate;
//import org.springframework.jdbc.core.JdbcTemplate;
//import org.springframework.test.context.junit4.SpringRunner;
//import org.springframework.web.bind.annotation.PostMapping;
//import org.springframework.web.bind.annotation.RequestParam;
//import orthopedics.dao.*;
//import orthopedics.model.*;
//import orthopedics.service.PropertiesServer;
//import orthopedics.service.UserServer;
//import orthopedics.util.*;
//
//import java.sql.*;
//import java.text.ParseException;
//import java.text.SimpleDateFormat;
//import java.time.LocalDateTime;
//import java.time.ZoneId;
//import java.util.*;
//import java.util.Date;
//
///**
// * 将pmp的数据同步到erp临时表
// */
//@RunWith(SpringRunner.class)
//@SpringBootTest
//public class SyncPMPTest {
//
// @Autowired
// private UserServer userServer;
//
// @Autowired
// private RedisTemplate redisTemplate;
//
// @Autowired
// private PropertiesServer propertiesServer;
//
// @Autowired
// private SysUserDepartMapper sysUserDepartMapper;
//
// @Autowired
// private InvItemMapper invItemMapper;
//
// @Autowired
// private InvItemSkuMapper invItemSkuMapper;
//
// @Autowired
// private InvItemAttributeMapper invItemAttributeMapper;
//
// @Autowired
// private InvItemPmpMapper invItemPmpMapper;
//
// public static long getTimestamp() {
// long milli = System.currentTimeMillis() + 8*3600*1000;
// return (milli*10000)+621355968000000000L;
// }
//
//
//
// public Result getPMPInvItemTest(String access_token, String sta, String end) {
// SysAccessToken sysAccessToken = userServer.checkToken(access_token);
// String gettoken = HttpUtilRSA.getToken();
// if(StringUtil.isEmpty(gettoken)){
// return new Result(false, StatusCode.ERROR,"获取PMP系统token失败");
// }
// JSONObject jsonObject = JSONObject.parseObject(gettoken);
// String token = jsonObject.getString("Token");
// String tempEncryptKey = jsonObject.getString("TempEncryKey");
//
// JSONObject data=new JSONObject();
// data.put("uniquekey","获取商品资料列表");
// data.put("timestamp", getTimestamp());
// data.put("begintime",sta);
// data.put("endTime",end);
// byte[] encrypt = Aes.encrypt(JSON.toJSONString(data), tempEncryptKey, tempEncryptKey);
// try {
// byte[] bytes = HttpUtilPMP.postBy("http://pmpapi.szcbfx.com/api/pmp/ExchangePMPData", encrypt,token);
// String s = new String(bytes);
// JSONObject object = JSONObject.parseObject(s);
// Object result = object.get("result");
// if(result==null||!result.equals("success")){
// return new Result(false,StatusCode.ERROR,"获取商品信息失败");
// }
// List<JSONObject> retMsg= (List<JSONObject>) object.get("ret_msg");
// for (JSONObject item:retMsg) {
// //检测是否是重复数据
// String plucode = item.getString("PLUCODE");
// if(StringUtil.isEmpty(plucode)){
// continue;
// }
// List<InvItem> invItems = invItemMapper.selectByPlucode(plucode);
// if(invItems!=null&&invItems.size()>0){
// continue;
// }
// InvItem invItem=new InvItem();
// InvItemAttribute invItemAttribute=new InvItemAttribute();
// InvItemSku invItemSku=new InvItemSku();
// InvItemPmp invItemPmp=new InvItemPmp();
// //商品表
// invItem.setId(UuidUtil.get32UUIDString());
// invItem.setOrgId("964daee94b604cd58e5e6bf48dd9670a");
// invItem.setStatus("SALE");
// String itemCode = propertiesServer.generateFlowingWater("ITEM_SERIAL");
// if(StringUtil.isEmpty(itemCode)){
// invItem.setItemCode(UuidUtil.get32UUIDString());
// }else{
// invItem.setItemCode(itemCode);
// }
// invItem.setItemName(item.getString("TITLE"));
// invItem.setProType("14");
// invItem.setItemDesc(item.getString("JP"));
// invItem.setPystype(item.getString("PYSTYPE"));
// invItem.setIsbn(item.getString("ISBN"));
// invItem.setPlucode(item.getString("PLUCODE"));
// invItem.setScancode(item.getString("SCANCODE"));
// invItem.setExtcode("0");
// invItem.setPurchasePrice(item.getString("PRICE"));
// invItem.setGeneralName(item.getString("CLSCODE"));
// invItem.setManufacturerId(item.getString("PUBLISHER"));
// if(!StringUtil.isEmpty(item.getDate("PUBDATE"))){
// invItem.setSpecification(item.getDate("PUBDATE").toInstant()
// .atZone( ZoneId.systemDefault() )
// .toLocalDateTime());
// }
// invItem.setPrimaryUnit("BEN");
// if(item.getString("PYSTYPE").equals("0")||item.getString("PYSTYPE").equals("4")){
// invItem.setAttribute1("Book");
// invItem.setIsBorrow("Y");
// }else{
// invItem.setAttribute1("Goods");
// invItem.setIsBorrow("N");
// }
// invItem.setAttribute2("A");
// invItem.setTax(item.getString("INCTAX"));
// invItem.setDefaultVendorId("000000006c60dba1016c60f839270004");
// invItem.setCreateBy(sysAccessToken.getUserName());
// invItem.setCreateTime(LocalDateTime.now());
// //查询当前用户部门
// SysUserDepart sysUserDepart = sysUserDepartMapper.selectByUserId(sysAccessToken.getUserId());
//
// //图书信息
// invItemAttribute.setId(UuidUtil.get32UUIDString());
// invItemAttribute.setCreateBy(sysAccessToken.getUserName());
// invItemAttribute.setCreateTime(LocalDateTime.now());
// if(sysUserDepart!=null){
// invItemAttribute.setSysOrgCode(sysUserDepart.getDepId());
// }
// invItemAttribute.setItemId(invItem.getId());
// invItemAttribute.setItemCode(invItem.getItemCode());
// invItemAttribute.setAuthor(item.getString("AUTHOR"));
// invItemAttribute.setReader(item.getString("READER"));
//
//
// //商品SKU映射
// invItemSku.setId(UuidUtil.get32UUIDString());
// if(sysUserDepart!=null){
// invItemSku.setSysOrgCode(sysUserDepart.getDepId());
// }
// invItemSku.setOrgId("964daee94b604cd58e5e6bf48dd9670a");
// invItemSku.setExternal("PMP");
// invItemSku.setItemSku(item.getString("PLUCODE"));
// invItemSku.setItemName(invItem.getItemName());
// invItemSku.setItemCode(invItem.getItemCode());
// invItemSku.setItemDesc(invItem.getItemDesc());
// invItemSku.setStatus("A");
// invItemSku.setCreateBy(sysAccessToken.getUserName());
// invItemSku.setCreateTime(LocalDateTime.now());
//
// //pmp商品缓存表
// invItemPmp.setId(UuidUtil.get32UUIDString());
// invItemPmp.setPlucode(item.getString("PLUCODE"));
// invItemPmp.setPystype(item.getInteger("PYSTYPE"));
// invItemPmp.setIsbn(item.getString("ISBN"));
// invItemPmp.setScancode(item.getString("SCANCODE"));
// invItemPmp.setTitle(item.getString("TITLE"));
// invItemPmp.setJp(item.getString("JP"));
// invItemPmp.setPrice(item.getBigDecimal("PRICE"));
// invItemPmp.setClscode(item.getString("CLSCODE"));
// invItemPmp.setClsname(item.getString("CLSNAME"));
// invItemPmp.setPublisher(item.getString("PUBLISHER"));
// invItemPmp.setPubname(item.getString("PUBNAME"));
// if(!StringUtil.isEmpty(item.getDate("PUBDATE"))){
// invItemPmp.setPubdate(item.getDate("PUBDATE").toInstant()
// .atZone( ZoneId.systemDefault() )
// .toLocalDateTime());
// }
// invItemPmp.setDptcode(item.getString("DPTCODE"));
// invItemPmp.setDptname(item.getString("DPTNAME"));
// invItemPmp.setSeries(item.getString("SERIES"));
// invItemPmp.setAuthor(item.getString("AUTHOR"));
// invItemPmp.setReader(item.getString("READER"));
// if(!StringUtil.isEmpty(item.getDate("FSTDATE"))){
// invItemPmp.setFstdate(item.getDate("FSTDATE").toInstant()
// .atZone( ZoneId.systemDefault() )
// .toLocalDateTime());
// }
// invItemPmp.setFstdisc(item.getBigDecimal("FSTDISC"));
// invItemPmp.setLstdisc(item.getBigDecimal("LSTDISC"));
// invItemPmp.setMaxdisc(item.getBigDecimal("MAXDISC"));
// invItemPmp.setMindisc(item.getBigDecimal("MINDISC"));
// invItemPmp.setVendor(item.getString("VENDOR"));
// invItemPmp.setTranstitle(item.getString("TRANSTITLE"));
// invItemPmp.setInctax(item.getInteger("INCTAX"));
// invItemPmp.setOriginprice(item.getBigDecimal("ORIGINPRICE"));
// invItemPmp.setCurrency(item.getString("CURRENCY"));
// invItemPmp.setStatus(1);
// invItemMapper.insert(invItem);
// invItemSkuMapper.insert(invItemSku);
// invItemAttributeMapper.insert(invItemAttribute);
// invItemPmpMapper.insert(invItemPmp);
// }
// return new Result(true,StatusCode.OK,"获取商品信息成功");
// } catch (Exception e) {
//
// }
// return new Result(false,StatusCode.ERROR,"获取商品信息失败");
// }
//
// //获取一年后的时间
// public String getDate1(String str) throws ParseException {
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
// Date parse = sdf.parse(str);
// Calendar cal = Calendar.getInstance();
// cal.setTime(parse);
// cal.add(Calendar.DATE, 10);//增加5年
// return sdf.format(cal.getTime());
// }
//
//
// /**
// * 获取pmp商品同步到临时表
// */
// @Autowired
// private TempItemFomPmpMapper tempItemFomPmpMapper;
//
// @Test
// public void getPMPHistoryInvItem(){
// String sta = null;
// String end = null;
// String begintime= (String) redisTemplate.opsForValue().get("getPMPInvItem");
// SimpleDateFormat sdf = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss" );
// if(StringUtil.isEmpty(begintime)){
// sta = "1995-1-1 00:00:00";
// }else{
// sta = begintime;
// }
//
// try {
// Date parse = sdf.parse(sta);
// long time = parse.getTime();
// while (time<=new Date().getTime()){
// end = getDate1(sta);
// String gettoken = HttpUtilRSA.getToken();
// JSONObject jsonObject = JSONObject.parseObject(gettoken);
// String token = jsonObject.getString("Token");
// String tempEncryptKey = jsonObject.getString("TempEncryKey");
//
// JSONObject data=new JSONObject();
// data.put("uniquekey","获取商品资料列表");
// data.put("timestamp", getTimestamp());
// data.put("begintime",sta);
// data.put("endTime",end);
// byte[] encrypt = Aes.encrypt(JSON.toJSONString(data), tempEncryptKey, tempEncryptKey);
// byte[] bytes = HttpUtilPMP.postBy("http://pmpapi.szcbfx.com/api/pmp/ExchangePMPData", encrypt,token);
// String s = new String(bytes);
// JSONObject object = JSONObject.parseObject(s);
// List<JSONObject> retMsg= (List<JSONObject>) object.get("ret_msg");
// System.err.println(sta+"获取到"+retMsg.size()+"条商品");
// if(retMsg.size()<=0){
// redisTemplate.opsForValue().set("getPMPInvItem",end);
// System.err.println(sta+"同步了"+retMsg.size()+"条商品");
// sta = end;
// continue;
// }
// List<TempItemFomPmp> tempItemFomPmpList=new ArrayList<>();
// for (JSONObject item:retMsg){
// TempItemFomPmp invItemPmp=new TempItemFomPmp();
// //pmp商品缓存表
// invItemPmp.setId(UuidUtil.get32UUIDString());
// invItemPmp.setPlucode(item.getString("PLUCODE"));
// invItemPmp.setPystype(item.getInteger("PYSTYPE"));
// invItemPmp.setIsbn(item.getString("ISBN"));
// invItemPmp.setScancode(item.getString("SCANCODE"));
// invItemPmp.setTitle(item.getString("TITLE"));
// invItemPmp.setJp(item.getString("JP"));
// invItemPmp.setPrice(item.getBigDecimal("PRICE"));
// invItemPmp.setClscode(item.getString("CLSCODE"));
// invItemPmp.setClsname(item.getString("CLSNAME"));
// invItemPmp.setPublisher(item.getString("PUBLISHER"));
// invItemPmp.setPubname(item.getString("PUBNAME"));
// if(!StringUtil.isEmpty(item.getDate("PUBDATE"))){
// invItemPmp.setPubdate(item.getDate("PUBDATE").toInstant()
// .atZone( ZoneId.systemDefault() )
// .toLocalDateTime());
package orthopedics.test;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.apache.ibatis.annotations.Update;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import orthopedics.controller.v1.TransactionController;
import orthopedics.dao.*;
import orthopedics.model.*;
import orthopedics.service.PropertiesServer;
import orthopedics.service.UserServer;
import orthopedics.util.*;
import java.math.BigDecimal;
import java.sql.*;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.Date;
/**
* 将pmp的数据同步到erp临时表
*/
@RunWith(SpringRunner.class)
@SpringBootTest
public class SyncPMPTest {
private final static Logger logger = LoggerFactory.getLogger(SyncPMPTest.class);
@Autowired
private UserServer userServer;
@Autowired
private RedisTemplate redisTemplate;
@Autowired
private PropertiesServer propertiesServer;
@Autowired
private SysUserDepartMapper sysUserDepartMapper;
@Autowired
private InvItemMapper invItemMapper;
@Autowired
private InvItemSkuMapper invItemSkuMapper;
@Autowired
private InvItemAttributeMapper invItemAttributeMapper;
@Autowired
private InvItemPmpMapper invItemPmpMapper;
public static long getTimestamp() {
long milli = System.currentTimeMillis() + 8*3600*1000;
return (milli*10000)+621355968000000000L;
}
public Result getPMPInvItemTest(String access_token, String sta, String end) {
SysAccessToken sysAccessToken = userServer.checkToken(access_token);
String gettoken = HttpUtilRSA.getToken();
if(StringUtil.isEmpty(gettoken)){
return new Result(false, StatusCode.ERROR,"获取PMP系统token失败");
}
JSONObject jsonObject = JSONObject.parseObject(gettoken);
String token = jsonObject.getString("Token");
String tempEncryptKey = jsonObject.getString("TempEncryKey");
JSONObject data=new JSONObject();
data.put("uniquekey","获取商品资料列表");
data.put("timestamp", getTimestamp());
data.put("begintime",sta);
data.put("endTime",end);
byte[] encrypt = Aes.encrypt(JSON.toJSONString(data), tempEncryptKey, tempEncryptKey);
try {
byte[] bytes = HttpUtilPMP.postBy("http://pmpapi.szcbfx.com/api/pmp/ExchangePMPData", encrypt,token);
String s = new String(bytes);
JSONObject object = JSONObject.parseObject(s);
Object result = object.get("result");
if(result==null||!result.equals("success")){
return new Result(false,StatusCode.ERROR,"获取商品信息失败");
}
List<JSONObject> retMsg= (List<JSONObject>) object.get("ret_msg");
for (JSONObject item:retMsg) {
//检测是否是重复数据
String plucode = item.getString("PLUCODE");
if(StringUtil.isEmpty(plucode)){
continue;
}
InvItem invItems1 = invItemMapper.selectByPlucode(plucode);
if(invItems1!=null){
continue;
}
InvItem invItem=new InvItem();
InvItemAttribute invItemAttribute=new InvItemAttribute();
InvItemSku invItemSku=new InvItemSku();
InvItemPmp invItemPmp=new InvItemPmp();
//商品表
invItem.setId(UuidUtil.get32UUIDString());
invItem.setOrgId("964daee94b604cd58e5e6bf48dd9670a");
invItem.setStatus("SALE");
String itemCode = propertiesServer.generateFlowingWater("ITEM_SERIAL");
if(StringUtil.isEmpty(itemCode)){
invItem.setItemCode(UuidUtil.get32UUIDString());
}else{
invItem.setItemCode(itemCode);
}
invItem.setItemName(item.getString("TITLE"));
invItem.setProType("14");
invItem.setItemDesc(item.getString("JP"));
invItem.setPystype(item.getString("PYSTYPE"));
invItem.setIsbn(item.getString("ISBN"));
invItem.setPlucode(item.getString("PLUCODE"));
invItem.setScancode(item.getString("SCANCODE"));
invItem.setExtcode("0");
invItem.setPurchasePrice(item.getString("PRICE"));
invItem.setGeneralName(item.getString("CLSCODE"));
invItem.setManufacturerId(item.getString("PUBLISHER"));
if(!StringUtil.isEmpty(item.getDate("PUBDATE"))){
invItem.setSpecification(item.getDate("PUBDATE").toInstant()
.atZone( ZoneId.systemDefault() )
.toLocalDateTime());
}
invItem.setPrimaryUnit("BEN");
if(item.getString("PYSTYPE").equals("0")||item.getString("PYSTYPE").equals("4")){
invItem.setAttribute1("Book");
invItem.setIsBorrow("Y");
}else{
invItem.setAttribute1("Goods");
invItem.setIsBorrow("N");
}
invItem.setAttribute2("A");
invItem.setTax(item.getString("INCTAX"));
invItem.setDefaultVendorId("000000006c60dba1016c60f839270004");
invItem.setCreateBy(sysAccessToken.getUserName());
invItem.setCreateTime(LocalDateTime.now());
//查询当前用户部门
SysUserDepart sysUserDepart = sysUserDepartMapper.selectByUserId(sysAccessToken.getUserId());
//图书信息
invItemAttribute.setId(UuidUtil.get32UUIDString());
invItemAttribute.setCreateBy(sysAccessToken.getUserName());
invItemAttribute.setCreateTime(LocalDateTime.now());
if(sysUserDepart!=null){
invItemAttribute.setSysOrgCode(sysUserDepart.getDepId());
}
invItemAttribute.setItemId(invItem.getId());
invItemAttribute.setItemCode(invItem.getItemCode());
invItemAttribute.setAuthor(item.getString("AUTHOR"));
invItemAttribute.setReader(item.getString("READER"));
//商品SKU映射
invItemSku.setId(UuidUtil.get32UUIDString());
if(sysUserDepart!=null){
invItemSku.setSysOrgCode(sysUserDepart.getDepId());
}
invItemSku.setOrgId("964daee94b604cd58e5e6bf48dd9670a");
invItemSku.setExternal("PMP");
invItemSku.setItemSku(item.getString("PLUCODE"));
invItemSku.setItemName(invItem.getItemName());
invItemSku.setItemCode(invItem.getItemCode());
invItemSku.setItemDesc(invItem.getItemDesc());
invItemSku.setStatus("A");
invItemSku.setCreateBy(sysAccessToken.getUserName());
invItemSku.setCreateTime(LocalDateTime.now());
//pmp商品缓存表
invItemPmp.setId(UuidUtil.get32UUIDString());
invItemPmp.setPlucode(item.getString("PLUCODE"));
invItemPmp.setPystype(item.getInteger("PYSTYPE"));
invItemPmp.setIsbn(item.getString("ISBN"));
invItemPmp.setScancode(item.getString("SCANCODE"));
invItemPmp.setTitle(item.getString("TITLE"));
invItemPmp.setJp(item.getString("JP"));
invItemPmp.setPrice(item.getBigDecimal("PRICE"));
invItemPmp.setClscode(item.getString("CLSCODE"));
invItemPmp.setClsname(item.getString("CLSNAME"));
invItemPmp.setPublisher(item.getString("PUBLISHER"));
invItemPmp.setPubname(item.getString("PUBNAME"));
if(!StringUtil.isEmpty(item.getDate("PUBDATE"))){
invItemPmp.setPubdate(item.getDate("PUBDATE").toInstant()
.atZone( ZoneId.systemDefault() )
.toLocalDateTime());
}
invItemPmp.setDptcode(item.getString("DPTCODE"));
invItemPmp.setDptname(item.getString("DPTNAME"));
invItemPmp.setSeries(item.getString("SERIES"));
invItemPmp.setAuthor(item.getString("AUTHOR"));
invItemPmp.setReader(item.getString("READER"));
if(!StringUtil.isEmpty(item.getDate("FSTDATE"))){
invItemPmp.setFstdate(item.getDate("FSTDATE").toInstant()
.atZone( ZoneId.systemDefault() )
.toLocalDateTime());
}
invItemPmp.setFstdisc(item.getBigDecimal("FSTDISC"));
invItemPmp.setLstdisc(item.getBigDecimal("LSTDISC"));
invItemPmp.setMaxdisc(item.getBigDecimal("MAXDISC"));
invItemPmp.setMindisc(item.getBigDecimal("MINDISC"));
invItemPmp.setVendor(item.getString("VENDOR"));
invItemPmp.setTranstitle(item.getString("TRANSTITLE"));
invItemPmp.setInctax(item.getInteger("INCTAX"));
invItemPmp.setOriginprice(item.getBigDecimal("ORIGINPRICE"));
invItemPmp.setCurrency(item.getString("CURRENCY"));
invItemPmp.setStatus(1);
invItemMapper.insert(invItem);
invItemSkuMapper.insert(invItemSku);
invItemAttributeMapper.insert(invItemAttribute);
invItemPmpMapper.insert(invItemPmp);
}
return new Result(true,StatusCode.OK,"获取商品信息成功");
} catch (Exception e) {
}
return new Result(false,StatusCode.ERROR,"获取商品信息失败");
}
//获取一年后的时间
public String getDate1(String str) throws ParseException {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date parse = sdf.parse(str);
Calendar cal = Calendar.getInstance();
cal.setTime(parse);
cal.add(Calendar.DATE, 10);//增加5年
return sdf.format(cal.getTime());
}
/**
* 获取pmp商品同步到临时表
*/
@Autowired
private TempItemFomPmpMapper tempItemFomPmpMapper;
@Test
public void getPMPHistoryInvItem(){
String sta = null;
String end = null;
String begintime= (String) redisTemplate.opsForValue().get("temp_item_fom_pmp");
SimpleDateFormat sdf = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss" );
if(StringUtil.isEmpty(begintime)){
sta = "2019-10-17 00:12:13";
}else{
sta = begintime;
}
try {
Date parse = sdf.parse(sta);
long time = parse.getTime();
while (time<=new Date().getTime()){
end = getDate1(sta);
String gettoken = HttpUtilRSA.getToken();
JSONObject jsonObject = JSONObject.parseObject(gettoken);
String token = jsonObject.getString("Token");
String tempEncryptKey = jsonObject.getString("TempEncryKey");
JSONObject data=new JSONObject();
data.put("uniquekey","获取商品资料列表");
data.put("timestamp", getTimestamp());
data.put("begintime",sta);
data.put("endTime",end);
byte[] encrypt = Aes.encrypt(JSON.toJSONString(data), tempEncryptKey, tempEncryptKey);
byte[] bytes = HttpUtilPMP.postBy("http://pmpapi.szcbfx.com/api/pmp/ExchangePMPData", encrypt,token);
String s = new String(bytes);
JSONObject object = JSONObject.parseObject(s);
List<JSONObject> retMsg= (List<JSONObject>) object.get("ret_msg");
System.err.println(sta+"获取到"+retMsg.size()+"条商品");
if(retMsg.size()<=0){
redisTemplate.opsForValue().set("temp_item_fom_pmp",end);
System.err.println(sta+"同步了"+retMsg.size()+"条商品");
sta = end;
continue;
}
List<TempItemFomPmp> tempItemFomPmpList=new ArrayList<>();
for (JSONObject item:retMsg){
String plucode = tempItemFomPmpMapper.getPlucodeByPlucode(item.getString("PLUCODE"));
if(!StringUtil.isEmpty(plucode)){
continue;
}
TempItemFomPmp invItemPmp=new TempItemFomPmp();
//pmp商品缓存表
invItemPmp.setId(UuidUtil.get32UUIDString());
invItemPmp.setPlucode(item.getString("PLUCODE"));
invItemPmp.setPystype(item.getInteger("PYSTYPE"));
invItemPmp.setIsbn(item.getString("ISBN"));
invItemPmp.setScancode(item.getString("SCANCODE"));
invItemPmp.setTitle(item.getString("TITLE"));
invItemPmp.setJp(item.getString("JP"));
invItemPmp.setPrice(item.getBigDecimal("PRICE"));
invItemPmp.setClscode(item.getString("CLSCODE"));
invItemPmp.setClsname(item.getString("CLSNAME"));
invItemPmp.setPublisher(item.getString("PUBLISHER"));
invItemPmp.setPubname(item.getString("PUBNAME"));
if(!StringUtil.isEmpty(item.getDate("PUBDATE"))){
invItemPmp.setPubdate(item.getDate("PUBDATE").toInstant()
.atZone( ZoneId.systemDefault() )
.toLocalDateTime());
}
invItemPmp.setDptcode(item.getString("DPTCODE"));
invItemPmp.setDptname(item.getString("DPTNAME"));
invItemPmp.setSeries(item.getString("SERIES"));
invItemPmp.setAuthor(item.getString("AUTHOR"));
invItemPmp.setReader(item.getString("READER"));
if(!StringUtil.isEmpty(item.getDate("FSTDATE"))){
invItemPmp.setFstdate(item.getDate("FSTDATE").toInstant()
.atZone( ZoneId.systemDefault() )
.toLocalDateTime());
}
invItemPmp.setFstdisc(item.getBigDecimal("FSTDISC"));
invItemPmp.setLstdisc(item.getBigDecimal("LSTDISC"));
invItemPmp.setMaxdisc(item.getBigDecimal("MAXDISC"));
invItemPmp.setMindisc(item.getBigDecimal("MINDISC"));
invItemPmp.setVendor(item.getString("VENDOR"));
invItemPmp.setTranstitle(item.getString("TRANSTITLE"));
invItemPmp.setInctax(item.getInteger("INCTAX"));
invItemPmp.setOriginprice(item.getBigDecimal("ORIGINPRICE"));
invItemPmp.setCurrency(item.getString("CURRENCY"));
invItemPmp.setStatus(0);
tempItemFomPmpList.add(invItemPmp);
// if(i % 10000 == 0){
// tempItemFomPmpMapper.insertBatch(tempItemFomPmpList);
// System.err.println("同步了"+i+"条商品");
// tempItemFomPmpList.clear();
// }
// invItemPmp.setDptcode(item.getString("DPTCODE"));
// invItemPmp.setDptname(item.getString("DPTNAME"));
// invItemPmp.setSeries(item.getString("SERIES"));
// invItemPmp.setAuthor(item.getString("AUTHOR"));
// invItemPmp.setReader(item.getString("READER"));
// if(!StringUtil.isEmpty(item.getDate("FSTDATE"))){
// invItemPmp.setFstdate(item.getDate("FSTDATE").toInstant()
// .atZone( ZoneId.systemDefault() )
// .toLocalDateTime());
// }
// invItemPmp.setFstdisc(item.getBigDecimal("FSTDISC"));
// invItemPmp.setLstdisc(item.getBigDecimal("LSTDISC"));
// invItemPmp.setMaxdisc(item.getBigDecimal("MAXDISC"));
// invItemPmp.setMindisc(item.getBigDecimal("MINDISC"));
// invItemPmp.setVendor(item.getString("VENDOR"));
// invItemPmp.setTranstitle(item.getString("TRANSTITLE"));
// invItemPmp.setInctax(item.getInteger("INCTAX"));
// invItemPmp.setOriginprice(item.getBigDecimal("ORIGINPRICE"));
// invItemPmp.setCurrency(item.getString("CURRENCY"));
// invItemPmp.setStatus(1);
// tempItemFomPmpList.add(invItemPmp);
//// if(i % 10000 == 0){
//// tempItemFomPmpMapper.insertBatch(tempItemFomPmpList);
//// System.err.println("同步了"+i+"条商品");
//// tempItemFomPmpList.clear();
//// }
// }
// tempItemFomPmpMapper.insertBatch(tempItemFomPmpList);
//// getPMPInvItemTest(access_token,sta,end);
//
// redisTemplate.opsForValue().set("getPMPInvItem",end);
// System.err.println(sta+"同步了"+retMsg.size()+"条商品");
// sta = end;
//
}
if(tempItemFomPmpList.size()>0){
tempItemFomPmpMapper.insertBatch(tempItemFomPmpList);
}
// getPMPInvItemTest(access_token,sta,end);
redisTemplate.opsForValue().set("getPMPInvItem",end);
System.err.println(sta+"同步了"+retMsg.size()+"条商品");
sta = end;
}
}catch (Exception e){
//logger.error("pmp同步失败时间段"+sta+"---"+end);
System.err.println(e.getMessage());
System.err.println("pmp同步失败时间段"+sta+"---"+end);
}
}
@Autowired
private TempInventoryFomPmpMapper tempInventoryFomPmpMapper;
/**
* 获取pmp仓号同步到临时表
*/
@Test
public void tempInventoryFomPmp(){
String gettoken = HttpUtilRSA.getToken();
System.err.println(gettoken);
String token = (String) JSONObject.parseObject(gettoken).get("Token");
String tempEncryptKey = (String) JSONObject.parseObject(gettoken).get("TempEncryKey");
JSONObject data=new JSONObject();
data.put("uniquekey","获取仓号列表");
data.put("timestamp", getTimestamp());
System.err.println(new Date());
//data.put("begintime","1995-12-23 00:00:00");
// data.put("begintime","2015-01-11 18:00:00");
// data.put("endTime","2020-06-12 18:00:00");
Map headers=new HashMap();
headers.put("Content-Type","application/json");
headers.put("token",token);
byte[] encrypt = Aes.encrypt(JSON.toJSONString(data), tempEncryptKey, tempEncryptKey);
byte[] bytes = new byte[0];
try {
bytes = HttpUtilPMP.postBy("http://pmpapi.szcbfx.com/api/pmp/ExchangePMPData", encrypt,token);
} catch (Exception e) {
e.printStackTrace();
}
//String post = HttpUtilPMP.post("http://pmpapi.szcbfx.com/api/pmp/ExchangePMPData", data, headers, 6000, 6000, "utf-8",tempEncryptKey);
String s = new String(bytes);
JSONObject object = JSONObject.parseObject(s);
List<JSONObject> retMsg= (List<JSONObject>) object.get("ret_msg");
System.err.println(retMsg);
System.err.println(retMsg.size());
List<TempInventoryFomPmp> tempInventoryFomPmpList=new ArrayList<>();
for(JSONObject jsonObject:retMsg){
TempInventoryFomPmp tempInventoryFomPmp=new TempInventoryFomPmp();
String code = jsonObject.getString("code");
String descript = jsonObject.getString("descript");
tempInventoryFomPmp.setId(UuidUtil.get32UUIDString());
tempInventoryFomPmp.setCode(code);
tempInventoryFomPmp.setDescript(descript);
tempInventoryFomPmpList.add(tempInventoryFomPmp);
}
tempInventoryFomPmpMapper.insertBatch(tempInventoryFomPmpList);
}
@Autowired
private TempLocatorFomPmpMapper tempLocatorFomPmpMapper;
/**
* 获取pmp货架号同步到临时表
*/
@Test
public void tempLocatorFomPmp(){
String gettoken = HttpUtilRSA.getToken();
System.err.println(gettoken);
String token = (String) JSONObject.parseObject(gettoken).get("Token");
String tempEncryptKey = (String) JSONObject.parseObject(gettoken).get("TempEncryKey");
JSONObject data=new JSONObject();
data.put("uniquekey","获取架号列表");
data.put("timestamp", getTimestamp());
System.err.println(new Date());
//data.put("begintime","1995-12-23 00:00:00");
// data.put("begintime","2015-01-11 18:00:00");
// data.put("endTime","2020-06-12 18:00:00");
Map headers=new HashMap();
headers.put("Content-Type","application/json");
headers.put("token",token);
byte[] encrypt = Aes.encrypt(JSON.toJSONString(data), tempEncryptKey, tempEncryptKey);
byte[] bytes = new byte[0];
try {
bytes = HttpUtilPMP.postBy("http://pmpapi.szcbfx.com/api/pmp/ExchangePMPData", encrypt,token);
} catch (Exception e) {
e.printStackTrace();
}
//String post = HttpUtilPMP.post("http://pmpapi.szcbfx.com/api/pmp/ExchangePMPData", data, headers, 6000, 6000, "utf-8",tempEncryptKey);
String s = new String(bytes);
JSONObject object = JSONObject.parseObject(s);
List<JSONObject> retMsg= (List<JSONObject>) object.get("ret_msg");
System.err.println(retMsg);
System.err.println(retMsg.size());
List<TempLocatorFomPmp> tempInventoryFomPmpList=new ArrayList<>();
for(JSONObject jsonObject:retMsg){
TempLocatorFomPmp tempLocatorFomPmp=new TempLocatorFomPmp();
String code = jsonObject.getString("code");
String wh = jsonObject.getString("wh");
tempLocatorFomPmp.setId(UuidUtil.get32UUIDString());
tempLocatorFomPmp.setCode(code);
tempLocatorFomPmp.setWh(wh);
tempInventoryFomPmpList.add(tempLocatorFomPmp);
}
tempLocatorFomPmpMapper.insertBatch(tempInventoryFomPmpList);
}
@Autowired
private TempAreaFomPmpMapper tempAreaFomPmpMapper;
/**
* 获取pmp区域同步到临时表
*/
@Test
public void tempAreaFomPmp(){
String gettoken = HttpUtilRSA.getToken();
System.err.println(gettoken);
String token = (String) JSONObject.parseObject(gettoken).get("Token");
String tempEncryptKey = (String) JSONObject.parseObject(gettoken).get("TempEncryKey");
JSONObject data=new JSONObject();
data.put("uniquekey","获取区域列表");
data.put("timestamp", getTimestamp());
System.err.println(new Date());
//data.put("begintime","1995-12-23 00:00:00");
// data.put("begintime","2015-01-11 18:00:00");
// data.put("endTime","2020-06-12 18:00:00");
Map headers=new HashMap();
headers.put("Content-Type","application/json");
headers.put("token",token);
byte[] encrypt = Aes.encrypt(JSON.toJSONString(data), tempEncryptKey, tempEncryptKey);
byte[] bytes = new byte[0];
try {
bytes = HttpUtilPMP.postBy("http://pmpapi.szcbfx.com/api/pmp/ExchangePMPData", encrypt,token);
} catch (Exception e) {
e.printStackTrace();
}
//String post = HttpUtilPMP.post("http://pmpapi.szcbfx.com/api/pmp/ExchangePMPData", data, headers, 6000, 6000, "utf-8",tempEncryptKey);
String s = new String(bytes);
JSONObject object = JSONObject.parseObject(s);
List<JSONObject> retMsg= (List<JSONObject>) object.get("ret_msg");
System.err.println(retMsg);
System.err.println(retMsg.size());
List<TempAreaFomPmp> tempInventoryFomPmpList=new ArrayList<>();
for(JSONObject jsonObject:retMsg){
TempAreaFomPmp tempAreaFomPmp=new TempAreaFomPmp();
String subwh = jsonObject.getString("subwh");
String wh = jsonObject.getString("wh");
String descript = jsonObject.getString("descript");
tempAreaFomPmp.setId(UuidUtil.get32UUIDString());
tempAreaFomPmp.setSubwh(subwh);
tempAreaFomPmp.setWh(wh);
tempAreaFomPmp.setDescript(descript);
tempInventoryFomPmpList.add(tempAreaFomPmp);
}
tempAreaFomPmpMapper.insertBatch(tempInventoryFomPmpList);
}
/**
* 将ERP创建的商品同步到POS
*/
@Test
public void invItemsToPos(){
List<InvItem> invItems = invItemMapper.findByAttribute2();
if(invItems!=null && invItems.size()>0){
Connection ct=null;
PreparedStatement ps=null;
ResultSet rs=null;
try {
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
ct= DriverManager.getConnection("jdbc:sqlserver://130.1.0.32:1433;DatabaseName=shoptxns","wjkj","wjkj123456");
for (InvItem invItem:invItems) {
ps=ct.prepareStatement("insert into plu values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
ps.setString(1,invItem.getItemCode());
ps.setString(2,invItem.getItemName());
//ps.setString(3,invItem.getAttribute1());
ps.setString(3,"");
ps.setString(4,"");
ps.setString(5,"");
ps.setString(6,"");
ps.setInt(7,(int)(Float.parseFloat("12.56")*100));
ps.setInt(8,0);
ps.setInt(9,(int)(Float.parseFloat("12.56")*100));
ps.setInt(10,(int)(Float.parseFloat("12.56")*100));
ps.setInt(11,(int)(Float.parseFloat("12.56")*100));
ps.setString(12,"-");
java.sql.Date date = new java.sql.Date(new java.util.Date().getTime()); //构建一个
ps.setDate(13,date);
ps.setInt(14,0);
ps.setString(15,"由erp同步");
ps.setInt(16,Integer.parseInt(invItem.getTax()));
int i = ps.executeUpdate();
if(i==1){
System.err.println("将ERP创建的商品同步到POS成功");
}else{
System.err.println("将ERP创建的商品同步到POS失败");
}
}
} catch (Exception e) {
System.err.println(e.getMessage());
}finally {
try {
if(rs!=null){
rs.close();
}
if(ps!=null){
ps.close();
}
if(ct!=null){
ct.close();
}
} catch (SQLException e) {
System.err.println("将ERP创建的商品同步到POS流关闭异常");
}
}
}
}
@Autowired
private TempItemSkuFomPmpMapper tempItemSkuFomPmpMapper;
/**
* 获取pmp商品库存信息同步到临时表
*/
@Test
public void tempItemSkuFomPmp(){
int i=0;
while (true){
List<String> plucodes = tempItemFomPmpMapper.findLimitByStaEnd(i,100000);
if(plucodes==null || plucodes.size()<=0){
return;
}
System.err.println("查询到"+plucodes.size()+"条数据");
String gettoken = HttpUtilRSA.getToken();
String token = (String) JSONObject.parseObject(gettoken).get("Token");
String tempEncryptKey = (String) JSONObject.parseObject(gettoken).get("TempEncryKey");
JSONObject data=new JSONObject();
List<JSONObject> plulist=new ArrayList<>();
for (String plucode:plucodes) {
if(StringUtil.isEmpty(plucode)){
continue;
}
JSONObject jsonObject=new JSONObject();
jsonObject.put("plucode",plucode);
plulist.add(jsonObject);
}
data.put("uniquekey","可配库存查询");
data.put("timestamp", getTimestamp());
data.put("shop", "2");
data.put("plulist",plulist);
Map headers=new HashMap();
headers.put("Content-Type","application/json");
headers.put("token",token);
byte[] encrypt = Aes.encrypt(JSON.toJSONString(data), tempEncryptKey, tempEncryptKey);
byte[] bytes = new byte[0];
try {
bytes = HttpUtilPMP.postBy("http://pmpapi.szcbfx.com/api/pmp/ExchangePMPData", encrypt,token);
} catch (Exception e) {
e.printStackTrace();
}
//String post = HttpUtilPMP.post("http://pmpapi.szcbfx.com/api/pmp/ExchangePMPData", data, headers, 6000, 6000, "utf-8",tempEncryptKey);
String s = new String(bytes);
JSONObject object = JSONObject.parseObject(s);
List<JSONObject> retMsg= (List<JSONObject>) object.get("ret_msg");
System.err.println(retMsg.size());
List<TempItemSkuFomPmp> tempItemSkuFomPmps=new ArrayList<>();
for (JSONObject jsonObject:retMsg) {
TempItemSkuFomPmp tempItemSkuFomPmp=new TempItemSkuFomPmp();
tempItemSkuFomPmp.setId(UuidUtil.get32UUIDString());
tempItemSkuFomPmp.setRack(jsonObject.getString("rack"));
tempItemSkuFomPmp.setPlucode(jsonObject.getString("plucode"));
tempItemSkuFomPmp.setTitle(jsonObject.getString("title"));
tempItemSkuFomPmp.setPrice(jsonObject.getBigDecimal("price"));
tempItemSkuFomPmp.setQty(jsonObject.getInteger("qty"));
tempItemSkuFomPmps.add(tempItemSkuFomPmp);
}
tempItemSkuFomPmpMapper.insertBatch(tempItemSkuFomPmps);
i=i+99999;
System.err.println("前"+i+"条数据同步完成");
}
}
@Autowired
private TempSupplierFomPmpMapper tempSupplierFomPmpMapper;
/**
* 获取pmp供应商列表
*/
@Test
public void tempSupplierFomPmp(){
String gettoken = HttpUtilRSA.getToken();
System.err.println(gettoken);
String token = (String) JSONObject.parseObject(gettoken).get("Token");
String tempEncryptKey = (String) JSONObject.parseObject(gettoken).get("TempEncryKey");
JSONObject data=new JSONObject();
data.put("uniquekey","获取供商列表");
data.put("timestamp", getTimestamp());
System.err.println(new Date());
//data.put("begintime","1995-12-23 00:00:00");
data.put("begintime","1995-01-11 18:00:00");
data.put("endTime","2019-12-12 18:00:00");
Map headers=new HashMap();
headers.put("Content-Type","application/json");
headers.put("token",token);
byte[] encrypt = Aes.encrypt(JSON.toJSONString(data), tempEncryptKey, tempEncryptKey);
byte[] bytes = new byte[0];
try {
bytes = HttpUtilPMP.postBy("http://pmpapi.szcbfx.com/api/pmp/ExchangePMPData", encrypt,token);
} catch (Exception e) {
e.printStackTrace();
}
//String post = HttpUtilPMP.post("http://pmpapi.szcbfx.com/api/pmp/ExchangePMPData", data, headers, 6000, 6000, "utf-8",tempEncryptKey);
String s = new String(bytes);
JSONObject object = JSONObject.parseObject(s);
List<JSONObject> retMsg= (List<JSONObject>) object.get("ret_msg");
System.err.println(retMsg);
System.err.println(retMsg.size());
List<TempSupplierFomPmp> tempSupplierFomPmps=new ArrayList<>();
for (JSONObject jsonObject:retMsg) {
TempSupplierFomPmp tempSupplierFomPmp=new TempSupplierFomPmp();
tempSupplierFomPmp.setCode(jsonObject.getString("code"));
tempSupplierFomPmp.setFullname(jsonObject.getString("fullname"));
tempSupplierFomPmp.setShortname(jsonObject.getString("shortname"));
tempSupplierFomPmp.setContact(jsonObject.getString("contact"));
tempSupplierFomPmp.setPhone(jsonObject.getString("phone"));
tempSupplierFomPmp.setAddress(jsonObject.getString("address"));
tempSupplierFomPmps.add(tempSupplierFomPmp);
}
tempSupplierFomPmpMapper.insertBatch(tempSupplierFomPmps);
}
@Autowired
private InvInventoryMapper invInventoryMapper;
@Autowired
private TempPurOrderFomPmpMapper tempPurOrderFomPmpMapper;
/**
* 获取pmp采购订单
*/
@Test
public void tempPurOrderFomPmp(){
List<String> sortidAll = invInventoryMapper.getSortidAll();
System.err.println(sortidAll.size());
String gettoken = HttpUtilRSA.getToken();
System.err.println(gettoken);
String token = (String) JSONObject.parseObject(gettoken).get("Token");
String tempEncryptKey = (String) JSONObject.parseObject(gettoken).get("TempEncryKey");
for (String shop:sortidAll) {
int shop1 = Integer.parseInt(shop);
//1062
if(shop1<=1062){
continue;
}
try {
JSONObject data=new JSONObject();
data.put("uniquekey","请配查询");
data.put("timestamp", getTimestamp());
//data.put("begintime","1995-12-23 00:00:00");
data.put("begintime","1995-01-11 18:00:00");
data.put("endTime","2019-12-12 18:00:00");
data.put("shop",shop);
Map headers=new HashMap();
headers.put("Content-Type","application/json");
headers.put("token",token);
byte[] encrypt = Aes.encrypt(JSON.toJSONString(data), tempEncryptKey, tempEncryptKey);
byte[] bytes = new byte[0];
bytes = HttpUtilPMP.postBy("http://pmpapi.szcbfx.com/api/pmp/ExchangePMPData", encrypt,token);
//String post = HttpUtilPMP.post("http://pmpapi.szcbfx.com/api/pmp/ExchangePMPData", data, headers, 6000, 6000, "utf-8",tempEncryptKey);
String s = new String(bytes);
JSONObject object = JSONObject.parseObject(s);
List<JSONObject> retMsg= (List<JSONObject>) object.get("ret_msg");
//System.err.println(retMsg);
System.err.println(shop+"号仓数据量:"+retMsg.size());
List<String> shs=new ArrayList<>();
shs.add("1003");
shs.add("1006");
shs.add("1010");
shs.add("1011");
shs.add("1018");
shs.add("1020");
shs.add("1021");
if(retMsg.size()<=10000 && retMsg.size()>0){
List<TempPurOrderFomPmp> tempPurOrderFomPmps=new ArrayList<>();
for (JSONObject jsonObject:retMsg) {
TempPurOrderFomPmp tempPurOrderFomPmp=new TempPurOrderFomPmp();
tempPurOrderFomPmp.setNumber(jsonObject.getString("number"));
tempPurOrderFomPmp.setShop(jsonObject.getString("shop"));
tempPurOrderFomPmp.setPlucode(jsonObject.getString("plucode"));
tempPurOrderFomPmp.setTitle(jsonObject.getString("title"));
tempPurOrderFomPmp.setPrice(jsonObject.getBigDecimal("price"));
tempPurOrderFomPmp.setQty(jsonObject.getInteger("qty"));
tempPurOrderFomPmp.setHdltime(jsonObject.getString("hdltime"));
tempPurOrderFomPmps.add(tempPurOrderFomPmp);
}
if(tempPurOrderFomPmps.size()>0){
tempPurOrderFomPmpMapper.insertBatch(tempPurOrderFomPmps);
}
}else if(retMsg.size()>10000){
List<TempPurOrderFomPmp> tempPurOrderFomPmps=new ArrayList<>();
for (int i=0;i<retMsg.size();i++) {
JSONObject jsonObject = retMsg.get(i);
TempPurOrderFomPmp tempPurOrderFomPmp=new TempPurOrderFomPmp();
tempPurOrderFomPmp.setNumber(jsonObject.getString("number"));
tempPurOrderFomPmp.setShop(jsonObject.getString("shop"));
tempPurOrderFomPmp.setPlucode(jsonObject.getString("plucode"));
tempPurOrderFomPmp.setTitle(jsonObject.getString("title"));
tempPurOrderFomPmp.setPrice(jsonObject.getBigDecimal("price"));
tempPurOrderFomPmp.setQty(jsonObject.getInteger("qty"));
tempPurOrderFomPmp.setHdltime(jsonObject.getString("hdltime"));
tempPurOrderFomPmps.add(tempPurOrderFomPmp);
if(i%10000==0 || retMsg.size()-i<=10000){
if(tempPurOrderFomPmps.size()>0){
tempPurOrderFomPmpMapper.insertBatch(tempPurOrderFomPmps);
}
tempPurOrderFomPmps.clear();
}
}
}
System.err.println(shop+"号仓数据量:"+retMsg.size()+"同步完成");
}catch (Exception e){
System.err.println(shop+"号仓同步失败");
logger.error(shop+"号仓同步失败");
logger.error(e.getMessage());
}
}
}
@Autowired
private TempRcvReceiptFomPmpMapper tempRcvReceiptFomPmpMapper;
/**
* 获取pmp接收单(集团分发)
*/
@Test
public void tempRcvReceiptFomPmp(){
List<String> sortidAll = invInventoryMapper.getSortidAll();
System.err.println(sortidAll.size());
String gettoken = HttpUtilRSA.getToken();
System.err.println(gettoken);
String token = (String) JSONObject.parseObject(gettoken).get("Token");
String tempEncryptKey = (String) JSONObject.parseObject(gettoken).get("TempEncryKey");
for (String shop:sortidAll) {
// int shop1 = Integer.parseInt(shop);
//1062
// if(shop1<=1062){
// continue;
// }
// }catch (Exception e){
// //logger.error("pmp同步失败时间段"+sta+"---"+end);
// System.err.println(e.getMessage());
// System.err.println("pmp同步失败时间段"+sta+"---"+end);
// }
//
// }
//
//
//
// @Autowired
// private TempInventoryFomPmpMapper tempInventoryFomPmpMapper;
//
// /**
// * 获取pmp仓号同步到临时表
// */
// @Test
// public void tempInventoryFomPmp(){
// String gettoken = HttpUtilRSA.getToken();
// System.err.println(gettoken);
// String token = (String) JSONObject.parseObject(gettoken).get("Token");
// String tempEncryptKey = (String) JSONObject.parseObject(gettoken).get("TempEncryKey");
// JSONObject data=new JSONObject();
// data.put("uniquekey","获取仓号列表");
// data.put("timestamp", getTimestamp());
// System.err.println(new Date());
// //data.put("begintime","1995-12-23 00:00:00");
//// data.put("begintime","2015-01-11 18:00:00");
//// data.put("endTime","2020-06-12 18:00:00");
// Map headers=new HashMap();
// headers.put("Content-Type","application/json");
// headers.put("token",token);
// byte[] encrypt = Aes.encrypt(JSON.toJSONString(data), tempEncryptKey, tempEncryptKey);
// byte[] bytes = new byte[0];
// try {
// bytes = HttpUtilPMP.postBy("http://pmpapi.szcbfx.com/api/pmp/ExchangePMPData", encrypt,token);
// } catch (Exception e) {
// e.printStackTrace();
// }
// //String post = HttpUtilPMP.post("http://pmpapi.szcbfx.com/api/pmp/ExchangePMPData", data, headers, 6000, 6000, "utf-8",tempEncryptKey);
// String s = new String(bytes);
// JSONObject object = JSONObject.parseObject(s);
// List<JSONObject> retMsg= (List<JSONObject>) object.get("ret_msg");
//
// System.err.println(retMsg);
// System.err.println(retMsg.size());
// List<TempInventoryFomPmp> tempInventoryFomPmpList=new ArrayList<>();
// for(JSONObject jsonObject:retMsg){
// TempInventoryFomPmp tempInventoryFomPmp=new TempInventoryFomPmp();
// String code = jsonObject.getString("code");
// String descript = jsonObject.getString("descript");
// tempInventoryFomPmp.setId(UuidUtil.get32UUIDString());
// tempInventoryFomPmp.setCode(code);
// tempInventoryFomPmp.setDescript(descript);
// tempInventoryFomPmpList.add(tempInventoryFomPmp);
// }
//
// tempInventoryFomPmpMapper.insertBatch(tempInventoryFomPmpList);
// }
//
//
// @Autowired
// private TempLocatorFomPmpMapper tempLocatorFomPmpMapper;
// /**
// * 获取pmp货架号同步到临时表
// */
// @Test
// public void tempLocatorFomPmp(){
// String gettoken = HttpUtilRSA.getToken();
// System.err.println(gettoken);
// String token = (String) JSONObject.parseObject(gettoken).get("Token");
// String tempEncryptKey = (String) JSONObject.parseObject(gettoken).get("TempEncryKey");
// JSONObject data=new JSONObject();
// data.put("uniquekey","获取架号列表");
// data.put("timestamp", getTimestamp());
// System.err.println(new Date());
// //data.put("begintime","1995-12-23 00:00:00");
//// data.put("begintime","2015-01-11 18:00:00");
//// data.put("endTime","2020-06-12 18:00:00");
// Map headers=new HashMap();
// headers.put("Content-Type","application/json");
// headers.put("token",token);
// byte[] encrypt = Aes.encrypt(JSON.toJSONString(data), tempEncryptKey, tempEncryptKey);
// byte[] bytes = new byte[0];
// try {
// bytes = HttpUtilPMP.postBy("http://pmpapi.szcbfx.com/api/pmp/ExchangePMPData", encrypt,token);
// } catch (Exception e) {
// e.printStackTrace();
// }
// //String post = HttpUtilPMP.post("http://pmpapi.szcbfx.com/api/pmp/ExchangePMPData", data, headers, 6000, 6000, "utf-8",tempEncryptKey);
// String s = new String(bytes);
// JSONObject object = JSONObject.parseObject(s);
// List<JSONObject> retMsg= (List<JSONObject>) object.get("ret_msg");
//
// System.err.println(retMsg);
// System.err.println(retMsg.size());
// List<TempLocatorFomPmp> tempInventoryFomPmpList=new ArrayList<>();
// for(JSONObject jsonObject:retMsg){
// TempLocatorFomPmp tempLocatorFomPmp=new TempLocatorFomPmp();
// String code = jsonObject.getString("code");
// String wh = jsonObject.getString("wh");
// tempLocatorFomPmp.setId(UuidUtil.get32UUIDString());
// tempLocatorFomPmp.setCode(code);
// tempLocatorFomPmp.setWh(wh);
// tempInventoryFomPmpList.add(tempLocatorFomPmp);
// }
//
// tempLocatorFomPmpMapper.insertBatch(tempInventoryFomPmpList);
// }
//
// @Autowired
// private TempAreaFomPmpMapper tempAreaFomPmpMapper;
// /**
// * 获取pmp区域同步到临时表
// */
// @Test
// public void tempAreaFomPmp(){
// String gettoken = HttpUtilRSA.getToken();
// System.err.println(gettoken);
// String token = (String) JSONObject.parseObject(gettoken).get("Token");
// String tempEncryptKey = (String) JSONObject.parseObject(gettoken).get("TempEncryKey");
// JSONObject data=new JSONObject();
// data.put("uniquekey","获取区域列表");
// data.put("timestamp", getTimestamp());
// System.err.println(new Date());
// //data.put("begintime","1995-12-23 00:00:00");
//// data.put("begintime","2015-01-11 18:00:00");
//// data.put("endTime","2020-06-12 18:00:00");
// Map headers=new HashMap();
// headers.put("Content-Type","application/json");
// headers.put("token",token);
// byte[] encrypt = Aes.encrypt(JSON.toJSONString(data), tempEncryptKey, tempEncryptKey);
// byte[] bytes = new byte[0];
// try {
// bytes = HttpUtilPMP.postBy("http://pmpapi.szcbfx.com/api/pmp/ExchangePMPData", encrypt,token);
// } catch (Exception e) {
// e.printStackTrace();
// }
// //String post = HttpUtilPMP.post("http://pmpapi.szcbfx.com/api/pmp/ExchangePMPData", data, headers, 6000, 6000, "utf-8",tempEncryptKey);
// String s = new String(bytes);
// JSONObject object = JSONObject.parseObject(s);
// List<JSONObject> retMsg= (List<JSONObject>) object.get("ret_msg");
//
// System.err.println(retMsg);
// System.err.println(retMsg.size());
// List<TempAreaFomPmp> tempInventoryFomPmpList=new ArrayList<>();
// for(JSONObject jsonObject:retMsg){
// TempAreaFomPmp tempAreaFomPmp=new TempAreaFomPmp();
// String subwh = jsonObject.getString("subwh");
// String wh = jsonObject.getString("wh");
// String descript = jsonObject.getString("descript");
// tempAreaFomPmp.setId(UuidUtil.get32UUIDString());
// tempAreaFomPmp.setSubwh(subwh);
// tempAreaFomPmp.setWh(wh);
// tempAreaFomPmp.setDescript(descript);
// tempInventoryFomPmpList.add(tempAreaFomPmp);
// }
//
// tempAreaFomPmpMapper.insertBatch(tempInventoryFomPmpList);
// }
//
// /**
// * 将ERP创建的商品同步到POS
// */
// @Test
// public void invItemsToPos(){
// List<InvItem> invItems = invItemMapper.findByAttribute2();
// if(invItems!=null && invItems.size()>0){
// Connection ct=null;
// PreparedStatement ps=null;
// ResultSet rs=null;
// try {
// Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
// ct= DriverManager.getConnection("jdbc:sqlserver://130.1.0.32:1433;DatabaseName=shoptxns","wjkj","wjkj123456");
// for (InvItem invItem:invItems) {
// ps=ct.prepareStatement("insert into plu values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
// ps.setString(1,invItem.getItemCode());
// ps.setString(2,invItem.getItemName());
// //ps.setString(3,invItem.getAttribute1());
// ps.setString(3,"");
// ps.setString(4,"");
// ps.setString(5,"");
// ps.setString(6,"");
// ps.setInt(7,(int)(Float.parseFloat("12.56")*100));
// ps.setInt(8,0);
// ps.setInt(9,(int)(Float.parseFloat("12.56")*100));
// ps.setInt(10,(int)(Float.parseFloat("12.56")*100));
// ps.setInt(11,(int)(Float.parseFloat("12.56")*100));
// ps.setString(12,"-");
// java.sql.Date date = new java.sql.Date(new java.util.Date().getTime()); //构建一个
// ps.setDate(13,date);
// ps.setInt(14,0);
// ps.setString(15,"由erp同步");
// ps.setInt(16,Integer.parseInt(invItem.getTax()));
// int i = ps.executeUpdate();
// if(i==1){
// System.err.println("将ERP创建的商品同步到POS成功");
// }else{
// System.err.println("将ERP创建的商品同步到POS失败");
// }
// }
// } catch (Exception e) {
// System.err.println(e.getMessage());
// }finally {
// try {
// if(rs!=null){
// rs.close();
// }
// if(ps!=null){
// ps.close();
// }
// if(ct!=null){
// ct.close();
// }
// } catch (SQLException e) {
// System.err.println("将ERP创建的商品同步到POS流关闭异常");
// }
try {
JSONObject data=new JSONObject();
data.put("uniquekey","获取待收分发单据列表");
data.put("timestamp", getTimestamp());
//data.put("begintime","1995-12-23 00:00:00");
data.put("begintime","1995-01-11 18:00:00");
data.put("endTime","2019-12-12 18:00:00");
data.put("shop",shop);
Map headers=new HashMap();
headers.put("Content-Type","application/json");
headers.put("token",token);
byte[] encrypt = Aes.encrypt(JSON.toJSONString(data), tempEncryptKey, tempEncryptKey);
byte[] bytes = new byte[0];
bytes = HttpUtilPMP.postBy("http://pmpapi.szcbfx.com/api/pmp/ExchangePMPData", encrypt,token);
String s = new String(bytes);
JSONObject object = JSONObject.parseObject(s);
List<JSONObject> retMsg= (List<JSONObject>) object.get("ret_msg");
//System.err.println(retMsg);
System.err.println(shop+"号仓数据量:"+retMsg.size());
if(retMsg.size()<=10000 && retMsg.size()>0){
List<TempRcvReceiptFomPmp> tempRcvReceiptFomPmps=new ArrayList<>();
for (JSONObject jsonObject:retMsg) {
TempRcvReceiptFomPmp tempRcvReceiptFomPmp=new TempRcvReceiptFomPmp();
tempRcvReceiptFomPmp.setNumber(jsonObject.getString("number"));
tempRcvReceiptFomPmp.setShop(jsonObject.getString("shop"));
tempRcvReceiptFomPmp.setDescript(jsonObject.getString("descript"));
tempRcvReceiptFomPmp.setRcvby(jsonObject.getString("rcvby"));
tempRcvReceiptFomPmp.setRcvtime(jsonObject.getString("rcvtime"));
tempRcvReceiptFomPmp.setPlucode(jsonObject.getString("plucode"));
tempRcvReceiptFomPmp.setTitle(jsonObject.getString("title"));
tempRcvReceiptFomPmp.setQty(jsonObject.getInteger("qty"));
tempRcvReceiptFomPmp.setMoney(jsonObject.getBigDecimal("money"));
tempRcvReceiptFomPmp.setRealmoney(jsonObject.getBigDecimal("realmoney"));
tempRcvReceiptFomPmp.setStatus(1);
tempRcvReceiptFomPmps.add(tempRcvReceiptFomPmp);
}
if(tempRcvReceiptFomPmps.size()>0){
tempRcvReceiptFomPmpMapper.insertBatch(tempRcvReceiptFomPmps);
}
}else if(retMsg.size()>10000){
List<TempRcvReceiptFomPmp> tempRcvReceiptFomPmps=new ArrayList<>();
for (int i=0;i<retMsg.size();i++) {
JSONObject jsonObject = retMsg.get(i);
TempRcvReceiptFomPmp tempRcvReceiptFomPmp=new TempRcvReceiptFomPmp();
tempRcvReceiptFomPmp.setNumber(jsonObject.getString("number"));
tempRcvReceiptFomPmp.setShop(jsonObject.getString("shop"));
tempRcvReceiptFomPmp.setDescript(jsonObject.getString("descript"));
tempRcvReceiptFomPmp.setRcvby(jsonObject.getString("rcvby"));
tempRcvReceiptFomPmp.setRcvtime(jsonObject.getString("rcvtime"));
tempRcvReceiptFomPmp.setPlucode(jsonObject.getString("plucode"));
tempRcvReceiptFomPmp.setTitle(jsonObject.getString("title"));
tempRcvReceiptFomPmp.setQty(jsonObject.getInteger("qty"));
tempRcvReceiptFomPmp.setMoney(jsonObject.getBigDecimal("money"));
tempRcvReceiptFomPmp.setRealmoney(jsonObject.getBigDecimal("realmoney"));
tempRcvReceiptFomPmp.setStatus(1);
tempRcvReceiptFomPmps.add(tempRcvReceiptFomPmp);
if(i%10000==0 || retMsg.size()-i<=10000){
if(tempRcvReceiptFomPmps.size()>0){
tempRcvReceiptFomPmpMapper.insertBatch(tempRcvReceiptFomPmps);
}
tempRcvReceiptFomPmps.clear();
}
}
}
System.err.println(shop+"号仓数据量:"+retMsg.size()+"同步完成");
}catch (Exception e){
System.err.println(shop+"号仓同步失败");
logger.error(shop+"号仓同步失败");
logger.error(e.getMessage());
}
}
}
/**
* 获取pmp接收单
*/
@Test
public void tempRcvReceiptFomPmp1(){
List<String> sortidAll = invInventoryMapper.getSortidAll();
System.err.println(sortidAll.size());
String gettoken = HttpUtilRSA.getToken();
System.err.println(gettoken);
String token = (String) JSONObject.parseObject(gettoken).get("Token");
String tempEncryptKey = (String) JSONObject.parseObject(gettoken).get("TempEncryKey");
for (String shop:sortidAll) {
// int shop1 = Integer.parseInt(shop);
//1062
// if(shop1<=1062){
// continue;
// }
// }
// }
//
//
// @Autowired
// private TempItemSkuFomPmpMapper tempItemSkuFomPmpMapper;
//
//
// /**
// * 获取pmp商品库存信息同步到临时表
// */
// @Test
// public void tempItemSkuFomPmp(){
// int i=0;
// while (true){
// List<String> plucodes = tempItemFomPmpMapper.findLimitByStaEnd(i,100000);
// if(plucodes==null || plucodes.size()<=0){
// return;
try {
JSONObject data=new JSONObject();
data.put("uniquekey","获取待收发货单据列表");
data.put("timestamp", getTimestamp());
//data.put("begintime","1995-12-23 00:00:00");
data.put("begintime","1995-01-11 18:00:00");
data.put("endTime","2019-12-12 18:00:00");
data.put("shop",shop);
Map headers=new HashMap();
headers.put("Content-Type","application/json");
headers.put("token",token);
byte[] encrypt = Aes.encrypt(JSON.toJSONString(data), tempEncryptKey, tempEncryptKey);
byte[] bytes = new byte[0];
bytes = HttpUtilPMP.postBy("http://pmpapi.szcbfx.com/api/pmp/ExchangePMPData", encrypt,token);
String s = new String(bytes);
JSONObject object = JSONObject.parseObject(s);
List<JSONObject> retMsg= (List<JSONObject>) object.get("ret_msg");
//System.err.println(retMsg);
System.err.println(shop+"号仓数据量:"+retMsg.size());
if(retMsg.size()<=10000 && retMsg.size()>0){
List<TempRcvReceiptFomPmp> tempRcvReceiptFomPmps=new ArrayList<>();
for (JSONObject jsonObject:retMsg) {
TempRcvReceiptFomPmp tempRcvReceiptFomPmp=new TempRcvReceiptFomPmp();
tempRcvReceiptFomPmp.setNumber(jsonObject.getString("number"));
tempRcvReceiptFomPmp.setShop(jsonObject.getString("shop"));
tempRcvReceiptFomPmp.setDescript(jsonObject.getString("descript"));
tempRcvReceiptFomPmp.setRcvby(jsonObject.getString("rcvby"));
tempRcvReceiptFomPmp.setRcvtime(jsonObject.getString("rcvtime"));
tempRcvReceiptFomPmp.setPlucode(jsonObject.getString("plucode"));
tempRcvReceiptFomPmp.setTitle(jsonObject.getString("title"));
tempRcvReceiptFomPmp.setQty(jsonObject.getInteger("qty"));
tempRcvReceiptFomPmp.setMoney(jsonObject.getBigDecimal("money"));
tempRcvReceiptFomPmp.setRealmoney(jsonObject.getBigDecimal("realmoney"));
tempRcvReceiptFomPmp.setStatus(0);
tempRcvReceiptFomPmps.add(tempRcvReceiptFomPmp);
}
if(tempRcvReceiptFomPmps.size()>0){
tempRcvReceiptFomPmpMapper.insertBatch(tempRcvReceiptFomPmps);
}
}else if(retMsg.size()>10000){
List<TempRcvReceiptFomPmp> tempRcvReceiptFomPmps=new ArrayList<>();
for (int i=0;i<retMsg.size();i++) {
JSONObject jsonObject = retMsg.get(i);
TempRcvReceiptFomPmp tempRcvReceiptFomPmp=new TempRcvReceiptFomPmp();
tempRcvReceiptFomPmp.setNumber(jsonObject.getString("number"));
tempRcvReceiptFomPmp.setShop(jsonObject.getString("shop"));
tempRcvReceiptFomPmp.setDescript(jsonObject.getString("descript"));
tempRcvReceiptFomPmp.setRcvby(jsonObject.getString("rcvby"));
tempRcvReceiptFomPmp.setRcvtime(jsonObject.getString("rcvtime"));
tempRcvReceiptFomPmp.setPlucode(jsonObject.getString("plucode"));
tempRcvReceiptFomPmp.setTitle(jsonObject.getString("title"));
tempRcvReceiptFomPmp.setQty(jsonObject.getInteger("qty"));
tempRcvReceiptFomPmp.setMoney(jsonObject.getBigDecimal("money"));
tempRcvReceiptFomPmp.setRealmoney(jsonObject.getBigDecimal("realmoney"));
tempRcvReceiptFomPmp.setStatus(0);
tempRcvReceiptFomPmps.add(tempRcvReceiptFomPmp);
if(i%10000==0 || retMsg.size()-i<=10000){
if(tempRcvReceiptFomPmps.size()>0){
tempRcvReceiptFomPmpMapper.insertBatch(tempRcvReceiptFomPmps);
}
tempRcvReceiptFomPmps.clear();
}
}
}
System.err.println(shop+"号仓数据量:"+retMsg.size()+"同步完成");
}catch (Exception e){
System.err.println(shop+"号仓同步失败");
logger.error(shop+"号仓同步失败");
logger.error(e.getMessage());
}
}
}
@Autowired
private TempWshShipmentFomPmpMapper tempWshShipmentFomPmpMapper;
/**
* 获取pmp发运单
*/
@Test
public void tempWshShipmentFomPmp(){
List<String> sortidAll = invInventoryMapper.getSortidAll();
System.err.println(sortidAll.size());
String gettoken = HttpUtilRSA.getToken();
System.err.println(gettoken);
String token = (String) JSONObject.parseObject(gettoken).get("Token");
String tempEncryptKey = (String) JSONObject.parseObject(gettoken).get("TempEncryKey");
for (String shop:sortidAll) {
int shop1 = Integer.parseInt(shop);
//1078
// if(shop1<=1078){
// continue;
// }
// System.err.println("查询到"+plucodes.size()+"条数据");
// String gettoken = HttpUtilRSA.getToken();
// String token = (String) JSONObject.parseObject(gettoken).get("Token");
// String tempEncryptKey = (String) JSONObject.parseObject(gettoken).get("TempEncryKey");
// JSONObject data=new JSONObject();
// List<JSONObject> plulist=new ArrayList<>();
// for (String plucode:plucodes) {
// if(StringUtil.isEmpty(plucode)){
// continue;
try {
JSONObject data=new JSONObject();
data.put("uniquekey","获取退仓单实际收货数");
data.put("timestamp", getTimestamp());
//data.put("begintime","1995-12-23 00:00:00");
data.put("begintime","1995-01-11 18:00:00");
data.put("endTime","2019-12-12 18:00:00");
data.put("shop",shop);
Map headers=new HashMap();
headers.put("Content-Type","application/json");
headers.put("token",token);
byte[] encrypt = Aes.encrypt(JSON.toJSONString(data), tempEncryptKey, tempEncryptKey);
byte[] bytes = new byte[0];
bytes = HttpUtilPMP.postBy("http://pmpapi.szcbfx.com/api/pmp/ExchangePMPData", encrypt,token);
String s = new String(bytes);
JSONObject object = JSONObject.parseObject(s);
List<JSONObject> retMsg= (List<JSONObject>) object.get("ret_msg");
//System.err.println(retMsg);
System.err.println(shop+"号仓数据量:"+retMsg.size());
if(retMsg.size()<=10000 && retMsg.size()>0){
List<TempWshShipmentFomPmp> tempWshShipmentFomPmps=new ArrayList<>();
for (JSONObject jsonObject:retMsg) {
TempWshShipmentFomPmp tempWshShipmentFomPmp=new TempWshShipmentFomPmp();
tempWshShipmentFomPmp.setNumber(jsonObject.getString("number"));
tempWshShipmentFomPmp.setSeq(jsonObject.getInteger("seq"));
tempWshShipmentFomPmp.setPlucode(jsonObject.getString("plucode"));
tempWshShipmentFomPmp.setFromrack(jsonObject.getString("fromrack"));
tempWshShipmentFomPmp.setTorack(jsonObject.getString("torack"));
tempWshShipmentFomPmp.setTxndate(jsonObject.getString("txndate"));
tempWshShipmentFomPmp.setPrice(jsonObject.getBigDecimal("price"));
tempWshShipmentFomPmp.setDisc(jsonObject.getBigDecimal("disc"));
tempWshShipmentFomPmp.setQty(jsonObject.getInteger("qty"));
tempWshShipmentFomPmp.setRcvqty(jsonObject.getInteger("rcvqty"));
tempWshShipmentFomPmp.setCasenum(jsonObject.getString("casenum"));
tempWshShipmentFomPmps.add(tempWshShipmentFomPmp);
}
if(tempWshShipmentFomPmps.size()>0){
tempWshShipmentFomPmpMapper.insertBatch(tempWshShipmentFomPmps);
}
}else if(retMsg.size()>10000){
List<TempWshShipmentFomPmp> tempWshShipmentFomPmps=new ArrayList<>();
for (int i=0;i<retMsg.size();i++) {
JSONObject jsonObject = retMsg.get(i);
TempWshShipmentFomPmp tempWshShipmentFomPmp=new TempWshShipmentFomPmp();
tempWshShipmentFomPmp.setNumber(jsonObject.getString("number"));
tempWshShipmentFomPmp.setSeq(jsonObject.getInteger("seq"));
tempWshShipmentFomPmp.setPlucode(jsonObject.getString("plucode"));
tempWshShipmentFomPmp.setFromrack(jsonObject.getString("fromrack"));
tempWshShipmentFomPmp.setTorack(jsonObject.getString("torack"));
tempWshShipmentFomPmp.setTxndate(jsonObject.getString("txndate"));
tempWshShipmentFomPmp.setPrice(jsonObject.getBigDecimal("price"));
tempWshShipmentFomPmp.setDisc(jsonObject.getBigDecimal("disc"));
tempWshShipmentFomPmp.setQty(jsonObject.getInteger("qty"));
tempWshShipmentFomPmp.setRcvqty(jsonObject.getInteger("rcvqty"));
tempWshShipmentFomPmp.setCasenum(jsonObject.getString("casenum"));
tempWshShipmentFomPmps.add(tempWshShipmentFomPmp);
if(i%10000==0 || retMsg.size()-i<=10000){
if(tempWshShipmentFomPmps.size()>0){
tempWshShipmentFomPmpMapper.insertBatch(tempWshShipmentFomPmps);
}
tempWshShipmentFomPmps.clear();
}
}
}
System.err.println(shop+"号仓数据量:"+retMsg.size()+"同步完成");
}catch (Exception e){
System.err.println(shop+"号仓同步失败");
logger.error(shop+"号仓同步失败");
logger.error(e.getMessage());
}
}
}
@Autowired
private TempWarTransferFomPmpMapper tempWarTransferFomPmpMapper;
/**
* 获取pmp调拨单(待收)
*/
@Test
public void tempWarTransferFomPmp(){
List<String> sortidAll = invInventoryMapper.getSortidAll();
System.err.println(sortidAll.size());
String gettoken = HttpUtilRSA.getToken();
System.err.println(gettoken);
String token = (String) JSONObject.parseObject(gettoken).get("Token");
String tempEncryptKey = (String) JSONObject.parseObject(gettoken).get("TempEncryKey");
for (String shop:sortidAll) {
try {
JSONObject data=new JSONObject();
//data.put("uniquekey","获取已收门市调剂单列表");
data.put("uniquekey","获取待收门市调剂单列表");
data.put("timestamp", getTimestamp());
//data.put("begintime","1995-12-23 00:00:00");
data.put("begintime","1995-01-11 18:00:00");
data.put("endTime","2019-12-12 18:00:00");
//data.put("shop","1917");
data.put("rcvshop",shop);
Map headers=new HashMap();
headers.put("Content-Type","application/json");
headers.put("token",token);
byte[] encrypt = Aes.encrypt(JSON.toJSONString(data), tempEncryptKey, tempEncryptKey);
byte[] bytes = new byte[0];
bytes = HttpUtilPMP.postBy("http://pmpapi.szcbfx.com/api/pmp/ExchangePMPData", encrypt,token);
String s = new String(bytes);
JSONObject object = JSONObject.parseObject(s);
List<JSONObject> retMsg= (List<JSONObject>) object.get("ret_msg");
//System.err.println(retMsg);
System.err.println(shop+"号仓数据量:"+retMsg.size());
if(retMsg.size()<=10000 && retMsg.size()>0){
List<TempWarTransferFomPmp> tempWarTransferFomPmps=new ArrayList<>();
for (JSONObject jsonObject:retMsg) {
TempWarTransferFomPmp tempWarTransferFomPmp=new TempWarTransferFomPmp();
tempWarTransferFomPmp.setNumber(jsonObject.getString("number"));
tempWarTransferFomPmp.setShop(jsonObject.getString("shop"));
tempWarTransferFomPmp.setRcvshop(jsonObject.getString("rcvshop"));
tempWarTransferFomPmp.setPlucode(jsonObject.getString("plucode"));
tempWarTransferFomPmp.setTitle(jsonObject.getString("title"));
tempWarTransferFomPmp.setQty(jsonObject.getInteger("qty"));
tempWarTransferFomPmp.setMoney(jsonObject.getBigDecimal("money"));
tempWarTransferFomPmp.setRealmoney(jsonObject.getBigDecimal("realmoney"));
tempWarTransferFomPmp.setStatus(0);
tempWarTransferFomPmps.add(tempWarTransferFomPmp);
}
if(tempWarTransferFomPmps.size()>0){
tempWarTransferFomPmpMapper.insertBatch(tempWarTransferFomPmps);
}
}else if(retMsg.size()>10000){
List<TempWarTransferFomPmp> tempWarTransferFomPmps=new ArrayList<>();
for (int i=0;i<retMsg.size();i++) {
JSONObject jsonObject = retMsg.get(i);
TempWarTransferFomPmp tempWarTransferFomPmp=new TempWarTransferFomPmp();
tempWarTransferFomPmp.setNumber(jsonObject.getString("number"));
tempWarTransferFomPmp.setShop(jsonObject.getString("shop"));
tempWarTransferFomPmp.setRcvshop(jsonObject.getString("rcvshop"));
tempWarTransferFomPmp.setPlucode(jsonObject.getString("plucode"));
tempWarTransferFomPmp.setTitle(jsonObject.getString("title"));
tempWarTransferFomPmp.setQty(jsonObject.getInteger("qty"));
tempWarTransferFomPmp.setMoney(jsonObject.getBigDecimal("money"));
tempWarTransferFomPmp.setRealmoney(jsonObject.getBigDecimal("realmoney"));
tempWarTransferFomPmp.setStatus(0);
tempWarTransferFomPmps.add(tempWarTransferFomPmp);
if(i%10000==0 || retMsg.size()-i<=10000){
if(tempWarTransferFomPmps.size()>0){
tempWarTransferFomPmpMapper.insertBatch(tempWarTransferFomPmps);
}
tempWarTransferFomPmps.clear();
}
}
}
System.err.println(shop+"号仓数据量:"+retMsg.size()+"同步完成");
}catch (Exception e){
System.err.println(shop+"号仓同步失败");
logger.error(shop+"号仓同步失败");
logger.error(e.getMessage());
}
}
}
@Autowired
private TempWarTransferFomPmp1Mapper tempWarTransferFomPmp1Mapper;
/**
* 获取pmp调拨单(已收)
*/
@Test
public void tempWarTransferFomPmp1(){
List<String> sortidAll = invInventoryMapper.getSortidAll();
System.err.println(sortidAll.size());
String gettoken = HttpUtilRSA.getToken();
System.err.println(gettoken);
String token = (String) JSONObject.parseObject(gettoken).get("Token");
String tempEncryptKey = (String) JSONObject.parseObject(gettoken).get("TempEncryKey");
for (String shop:sortidAll) {
try {
JSONObject data=new JSONObject();
data.put("uniquekey","获取已收门市调剂单列表");
data.put("timestamp", getTimestamp());
//data.put("begintime","1995-12-23 00:00:00");
data.put("begintime","1995-01-11 18:00:00");
data.put("endTime","2019-12-12 18:00:00");
data.put("shop",shop);
Map headers=new HashMap();
headers.put("Content-Type","application/json");
headers.put("token",token);
byte[] encrypt = Aes.encrypt(JSON.toJSONString(data), tempEncryptKey, tempEncryptKey);
byte[] bytes = new byte[0];
bytes = HttpUtilPMP.postBy("http://pmpapi.szcbfx.com/api/pmp/ExchangePMPData", encrypt,token);
String s = new String(bytes);
JSONObject object = JSONObject.parseObject(s);
List<JSONObject> retMsg= (List<JSONObject>) object.get("ret_msg");
//System.err.println(retMsg);
System.err.println(shop+"号仓数据量:"+retMsg.size());
if(retMsg.size()<=10000 && retMsg.size()>0){
List<TempWarTransferFomPmp1> tempWarTransferFomPmp1s=new ArrayList<>();
for (JSONObject jsonObject:retMsg) {
TempWarTransferFomPmp1 tempWarTransferFomPmp1=new TempWarTransferFomPmp1();
tempWarTransferFomPmp1.setNumber(jsonObject.getString("number"));
tempWarTransferFomPmp1.setShop(jsonObject.getString("shop"));
tempWarTransferFomPmp1.setRcvshop(jsonObject.getString("rcvshop"));
tempWarTransferFomPmp1.setFinishtime(jsonObject.getString("finishtime"));
tempWarTransferFomPmp1.setRemarks(jsonObject.getString("remarks"));
tempWarTransferFomPmp1.setPlucnt(jsonObject.getString("plucnt"));
tempWarTransferFomPmp1.setQty(jsonObject.getString("qty"));
tempWarTransferFomPmp1.setRqty(jsonObject.getBigDecimal("rqty"));
tempWarTransferFomPmp1.setMoney(jsonObject.getBigDecimal("money"));
tempWarTransferFomPmp1.setStatus(0);
tempWarTransferFomPmp1s.add(tempWarTransferFomPmp1);
}
if(tempWarTransferFomPmp1s.size()>0){
tempWarTransferFomPmp1Mapper.insertBatch(tempWarTransferFomPmp1s);
}
}else if(retMsg.size()>10000){
List<TempWarTransferFomPmp1> tempWarTransferFomPmp1s=new ArrayList<>();
for (int i=0;i<retMsg.size();i++) {
JSONObject jsonObject = retMsg.get(i);
TempWarTransferFomPmp1 tempWarTransferFomPmp1=new TempWarTransferFomPmp1();
tempWarTransferFomPmp1.setNumber(jsonObject.getString("number"));
tempWarTransferFomPmp1.setShop(jsonObject.getString("shop"));
tempWarTransferFomPmp1.setRcvshop(jsonObject.getString("rcvshop"));
tempWarTransferFomPmp1.setFinishtime(jsonObject.getString("finishtime"));
tempWarTransferFomPmp1.setRemarks(jsonObject.getString("remarks"));
tempWarTransferFomPmp1.setPlucnt(jsonObject.getString("plucnt"));
tempWarTransferFomPmp1.setQty(jsonObject.getString("qty"));
tempWarTransferFomPmp1.setRqty(jsonObject.getBigDecimal("rqty"));
tempWarTransferFomPmp1.setMoney(jsonObject.getBigDecimal("money"));
tempWarTransferFomPmp1.setStatus(0);
tempWarTransferFomPmp1s.add(tempWarTransferFomPmp1);
if(i%10000==0 && retMsg.size()-i>10000){
if(tempWarTransferFomPmp1s.size()>0){
tempWarTransferFomPmp1Mapper.insertBatch(tempWarTransferFomPmp1s);
}
tempWarTransferFomPmp1s.clear();
}
if(retMsg.size()==(i+1)){
if(tempWarTransferFomPmp1s.size()>0){
tempWarTransferFomPmp1Mapper.insertBatch(tempWarTransferFomPmp1s);
}
tempWarTransferFomPmp1s.clear();
}
}
}
System.err.println(shop+"号仓数据量:"+retMsg.size()+"同步完成");
}catch (Exception e){
System.err.println(shop+"号仓同步失败");
logger.error(shop+"号仓同步失败");
logger.error(e.getMessage());
}
}
}
@Autowired
private TempSalOrderFomPmpMapper tempSalOrderFomPmpMapper;
/**
* 获取pos零售的销售订单
*/
@Test
public void tempSalOrderFomPmp() {
Connection ct=null;
PreparedStatement ps=null;
ResultSet rs=null;
// Connection ct1=null;
// PreparedStatement ps1=null;
// ResultSet rs1=null;
try {
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
ct= DriverManager.getConnection("jdbc:sqlserver://130.1.0.32:1433;DatabaseName=shoptxns;sendStringParametersAsUnicode=false","wjkj","wjkj123456");
ps=ct.prepareStatement("select s1.OPERATOR, s1.TXNTIME,s1.VOUCHNUM,s1.SEQUENCE,s2.DPTCODE,s1.CLSCODE, s1.DISPLAY,s1.CODE, s1.QTY, s1.PRICE, s1.DISC, \n" +
"s1.ORGAMT, s1.ITEMDISC,s2.PRICE PRICE2\n" +
"from SHOPTXNS s1\n" +
"left join SHOPTXNS s2 on Convert(varchar,s1.txntime,23)= Convert(varchar,s2.txntime,23) AND s1.operator=s2.operator AND s1.vouchnum=s2.vouchnum AND s1.TERMINAL=s2.TERMINAL and s2.SALESTYPE = 8\n" +
"where s1.SALESTYPE = 2 and s1.CODE IS NOT NULL");
rs = ps.executeQuery();
List<TempSalOrderFomPmp> tempSalOrderFomPmps=new ArrayList<>();
int i=0;
while (rs.next()){
String operator = rs.getString(1);//收银员账号
Timestamp timestamp = rs.getTimestamp(2);//订单时间
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String dateStr = sdf.format(timestamp);
int vouchnum = rs.getInt(3);//小票单号
int sequence = rs.getInt(4);//单据序号
String dptcode = rs.getString(5);//支付方式
String clscode = rs.getString(6);//分类代码(小类)
String display = rs.getString(7);//分类代码
String code = rs.getString(8);//商品条码
int qty = rs.getInt(9);//数量
int price = rs.getInt(10);//单价
int disc = rs.getInt(11);//折扣
int orgamt = rs.getInt(12);//订单总价
int itemdisc = rs.getInt(13);//扣款金额
int price2 = rs.getInt(14);//每笔支付方式支付的金额
TempSalOrderFomPmp tempSalOrderFomPmp=new TempSalOrderFomPmp();
tempSalOrderFomPmp.setTxntime(sdf.parse(dateStr).toInstant()
.atZone( ZoneId.systemDefault() )
.toLocalDateTime());
tempSalOrderFomPmp.setOperator(operator);
tempSalOrderFomPmp.setVouchnum(vouchnum);
tempSalOrderFomPmp.setDptcode(dptcode);
tempSalOrderFomPmp.setCode(code);
tempSalOrderFomPmp.setQty(qty);
tempSalOrderFomPmp.setPrice(price);
tempSalOrderFomPmp.setDisc(disc);
tempSalOrderFomPmp.setOrgamt(orgamt);
tempSalOrderFomPmp.setSequence(sequence);
tempSalOrderFomPmp.setClscode(clscode);
tempSalOrderFomPmp.setDisplay(display);
tempSalOrderFomPmp.setItemdisc(itemdisc);
tempSalOrderFomPmp.setPrice2(price2);
tempSalOrderFomPmp.setStatus(0);
tempSalOrderFomPmps.add(tempSalOrderFomPmp);
//查询支付方式
// ct1= DriverManager.getConnection("jdbc:sqlserver://130.1.0.32:1433;DatabaseName=shoptxns;sendStringParametersAsUnicode=false","wjkj","wjkj123456");
// ps1=ct1.prepareStatement("SELECT DPTCODE FROM shoptxns WHERE Convert(varchar,txntime,120) like ''+?+'%' and vouchnum=? and operator=? and salestype=8");
// ps1.setString(1,dateStr);
// ps1.setLong(2,vouchnum);
// ps1.setString(3,operator);
// String paymentMethod =null;//支付方式
// rs1 = ps1.executeQuery();
// while (rs1.next()){
// paymentMethod = rs1.getString(1);
// break;
// }
// JSONObject jsonObject=new JSONObject();
// jsonObject.put("plucode",plucode);
// plulist.add(jsonObject);
//
// }
// data.put("uniquekey","可配库存查询");
// data.put("timestamp", getTimestamp());
// data.put("shop", "2");
// data.put("plulist",plulist);
// Map headers=new HashMap();
// headers.put("Content-Type","application/json");
// headers.put("token",token);
// byte[] encrypt = Aes.encrypt(JSON.toJSONString(data), tempEncryptKey, tempEncryptKey);
// byte[] bytes = new byte[0];
// try {
// bytes = HttpUtilPMP.postBy("http://pmpapi.szcbfx.com/api/pmp/ExchangePMPData", encrypt,token);
// } catch (Exception e) {
// e.printStackTrace();
// }
// //String post = HttpUtilPMP.post("http://pmpapi.szcbfx.com/api/pmp/ExchangePMPData", data, headers, 6000, 6000, "utf-8",tempEncryptKey);
// String s = new String(bytes);
// JSONObject object = JSONObject.parseObject(s);
// List<JSONObject> retMsg= (List<JSONObject>) object.get("ret_msg");
//
// System.err.println(retMsg.size());
// List<TempItemSkuFomPmp> tempItemSkuFomPmps=new ArrayList<>();
// for (JSONObject jsonObject:retMsg) {
// TempItemSkuFomPmp tempItemSkuFomPmp=new TempItemSkuFomPmp();
// tempItemSkuFomPmp.setId(UuidUtil.get32UUIDString());
// tempItemSkuFomPmp.setRack(jsonObject.getString("rack"));
// tempItemSkuFomPmp.setPlucode(jsonObject.getString("plucode"));
// tempItemSkuFomPmp.setTitle(jsonObject.getString("title"));
// tempItemSkuFomPmp.setPrice(jsonObject.getBigDecimal("price"));
// tempItemSkuFomPmp.setQty(jsonObject.getInteger("qty"));
// tempItemSkuFomPmps.add(tempItemSkuFomPmp);
// }
// tempItemSkuFomPmpMapper.insertBatch(tempItemSkuFomPmps);
// i=i+99999;
// System.err.println("前"+i+"条数据同步完成");
// }
//
// }
//
//}
// rs1.close();
// ps1.close();
// ct1.close();
// int quantity = rs.getInt(13);//数量
// int attribute1 = rs.getInt(14);//单价
// int attribute3 = rs.getInt(15);//折扣
// int attribute2 = rs.getInt(16);//订单总价
i++;
if(i%10000==0 || i==1658185 ){
if(tempSalOrderFomPmps.size()>0){
tempSalOrderFomPmpMapper.insertBatch(tempSalOrderFomPmps);
System.err.println(tempSalOrderFomPmps.size()+"条数据添加成功"+i);
}
tempSalOrderFomPmps.clear();
}
}
}catch (Exception e){
System.err.println(e.getMessage());
}finally {
try {
if(rs!=null){
rs.close();
}
if(ps!=null){
ps.close();
}
if(ct!=null){
ct.close();
}
} catch (SQLException e) {
logger.error("将POS的销售订单同步到ERP流关闭异常");
}
}
}
}
//package orthopedics.test;
//
//import com.alibaba.fastjson.JSON;
//import com.alibaba.fastjson.JSONObject;
//import org.junit.Test;
//import org.junit.runner.RunWith;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.boot.test.context.SpringBootTest;
//import org.springframework.data.redis.core.RedisTemplate;
//import org.springframework.test.context.junit4.SpringRunner;
//import org.springframework.transaction.annotation.Transactional;
//import orthopedics.controller.v1.TransactionController;
//import orthopedics.dao.*;
//import orthopedics.model.*;
//import orthopedics.service.PropertiesServer;
//import orthopedics.service.UserServer;
//import orthopedics.util.*;
//
//import java.sql.*;
//import java.text.ParseException;
//import java.text.SimpleDateFormat;
//import java.time.LocalDateTime;
//import java.time.ZoneId;
//import java.util.Date;
//import java.util.*;
//
///**
// * 将临时表数据同步到正式表
// */
//@RunWith(SpringRunner.class)
//@SpringBootTest
//public class TempToOfficial {
//
// @Autowired
// private TempInventoryFomPmpMapper tempInventoryFomPmpMapper;
//
// @Autowired
// private InvInventoryMapper invInventoryMapper;
//
// /**
// * temp_inventory_fom_pmp临时表创建库存信息inv_inventory
// */
// @Test
// public void addInventory(){
// List<TempInventoryFomPmp> select = tempInventoryFomPmpMapper.select();
// List<InvInventory> invInventories=new ArrayList<>();
// int i=0;
// for (TempInventoryFomPmp tempInventoryFomPmp:select) {
// InvInventory byInvCode = invInventoryMapper.findByInvCode("WH" + tempInventoryFomPmp.getCode());
// if(byInvCode!=null){
// continue;
// }
// InvInventory invInventory=new InvInventory();
// invInventory.setId(UuidUtil.get32UUIDString());
// invInventory.setOrg_id("2c9007626dde3f4f016deda2151f1a42");
// invInventory.setInv_code("WH"+tempInventoryFomPmp.getCode());
// invInventory.setInv_name(tempInventoryFomPmp.getDescript());
// invInventory.setInv_desc("-1");
// invInventory.setSortid(tempInventoryFomPmp.getCode());
// invInventory.setStatus("A");
// invInventory.setCreate_by("0f98872af64711e9a1b10242ac110002");
// invInventory.setCreate_time(LocalDateTime.now());
// invInventories.add(invInventory);
// i++;
// invInventoryMapper.insert(invInventory);
// }
// //invInventoryMapper.insertBatch(invInventories);
// System.err.println(i);
// }
//
// @Autowired
// private TempAreaFomPmpMapper tempAreaFomPmpMapper;
//
// @Autowired
// private InvSubinventoryMapper invSubinventoryMapper;
//
// /**
// * temp_area_fom_pmp临时表创建库区信息inv_subinventory
// */
// @Test
// public void addSubinventory(){
// List<TempAreaFomPmp> select = tempAreaFomPmpMapper.select();
// int i=0;
// System.err.println("查询到"+select.size()+"条数据");
// for (TempAreaFomPmp tempAreaFomPmp:select) {
// InvSubinventory bySubinvCode = invSubinventoryMapper.findBySubinvCode("KQ" + tempAreaFomPmp.getSubwh());
// if(bySubinvCode!=null){
// continue;
// }
// InvSubinventory invSubinventory=new InvSubinventory();
// invSubinventory.setId(UuidUtil.get32UUIDString());
// invSubinventory.setCreateDate(LocalDateTime.now());
// invSubinventory.setCreateBy("0f98872af64711e9a1b10242ac110002");
// InvInventory bySortid = invInventoryMapper.findBySortid(tempAreaFomPmp.getWh());
// if(bySortid==null){
// continue;
// }
// invSubinventory.setInvId(bySortid.getId());
// invSubinventory.setSubinvType("STORAGE");
// invSubinventory.setSubinvCode("KQ"+tempAreaFomPmp.getSubwh());
// invSubinventory.setSubinvName("存储区");
// invSubinventory.setSubinvDesc("-1");
// invSubinventory.setLocatorControl("Y");
// invSubinventory.setStatus("A");
// i++;
// invSubinventoryMapper.insert(invSubinventory);
// }
// System.err.println("处理了"+i+"条数据");
// }
//
//
// @Autowired
// private TempLocatorFomPmpMapper tempLocatorFomPmpMapper;
//
// @Autowired
// private InvLocatorMapper invLocatorMapper;
// /**
// * temp_locator_fom_pmp临时表创建h货架信息inv_locator
// */
// @Test
// public void addLocator(){
// List<TempLocatorFomPmp> select = tempLocatorFomPmpMapper.select();
// int i=0;
// System.err.println("查询到"+select.size()+"条数据");
//// List<InvLocator> invLocators=new ArrayList<>();
// for (TempLocatorFomPmp tempLocatorFomPmp:select) {
// InvLocator invLocatorList = invLocatorMapper.findLocatorByCode("HJ" + tempLocatorFomPmp.getCode());
// if(invLocatorList!=null){
// continue;
// }
// InvLocator invLocator=new InvLocator();
// invLocator.setId(UuidUtil.get32UUIDString());
// invLocator.setCreateBy("0f98872af64711e9a1b10242ac110002");
// invLocator.setCreateTime(LocalDateTime.now());
// InvInventory bySortid = invInventoryMapper.findBySortid(tempLocatorFomPmp.getWh());
// if(bySortid==null){
// continue;
// }
// invLocator.setInvId(bySortid.getId());
// List<InvSubinventory> invSubinventories = invSubinventoryMapper.selectByInvIdAndSubinvName(bySortid.getId());
// if(invSubinventories==null || invSubinventories.size()<=0){
// continue;
// }
// invLocator.setSubinvId(invSubinventories.get(0).getId());
// invLocator.setLocatorCode("HJ"+tempLocatorFomPmp.getCode());
// invLocator.setLocatorName(tempLocatorFomPmp.getCode());
// invLocator.setLocatorDesc("-1");
// invLocator.setStatus("A");
//
//// invLocators.add(invLocator);
// invLocatorMapper.insert(invLocator);
// i++;
// System.err.println("第"+i+"条处理完毕");
// }
//// invLocatorMapper.insertBatch(invLocators);
// System.err.println("处理了"+i+"条数据");
// }
//
// @Autowired
// private TempItemFomPmpMapper tempItemFomPmpMapper;
//
// @Autowired
// private InvItemMapper invItemMapper;
//
// @Autowired
// private PropertiesServer propertiesServer;
//
// @Autowired
// private SysUserDepartMapper sysUserDepartMapper;
//
// @Autowired
// private InvItemSkuMapper invItemSkuMapper;
//
// @Autowired
// private InvItemAttributeMapper invItemAttributeMapper;
//
// @Autowired
// private IdWorker idWorker;
//
// /**
// * 将商品信息从临时表temp_item_fom_pmp同步到正式表inv_item 2683351
// */
// @Test
// public void addInvItem(){
// int j=208054;
// while (true){
// List<TempItemFomPmp> limit = tempItemFomPmpMapper.findLimit(j);
// System.err.println("查询到"+limit.size()+"条数据");
// if(limit.size()<=0){
// System.err.println("所有数据同步完成!!!");
// return;
// }
// List<InvItem> invItems=new ArrayList<>();
// List<InvItemAttribute> invItemAttributes=new ArrayList<>();
// List<InvItemSku> invItemSkus=new ArrayList<>();
// for (TempItemFomPmp tempItemFomPmp:limit) {
// String plucode = invItemMapper.getPlucode(tempItemFomPmp.getPlucode());
// if(plucode!=null){
// continue;
package orthopedics.test;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.transaction.annotation.Transactional;
import orthopedics.controller.v1.TransactionController;
import orthopedics.dao.*;
import orthopedics.model.*;
import orthopedics.service.PropertiesServer;
import orthopedics.service.UserServer;
import orthopedics.util.*;
import java.sql.*;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.Date;
import java.util.*;
/**
* 将临时表数据同步到正式表
*/
@RunWith(SpringRunner.class)
@SpringBootTest
public class TempToOfficial {
@Autowired
private TempInventoryFomPmpMapper tempInventoryFomPmpMapper;
@Autowired
private InvInventoryMapper invInventoryMapper;
/**
* temp_inventory_fom_pmp临时表创建库存信息inv_inventory
*/
@Test
public void addInventory(){
List<TempInventoryFomPmp> select = tempInventoryFomPmpMapper.select();
List<InvInventory> invInventories=new ArrayList<>();
int i=0;
for (TempInventoryFomPmp tempInventoryFomPmp:select) {
InvInventory byInvCode = invInventoryMapper.findByInvCode("WH" + tempInventoryFomPmp.getCode());
if(byInvCode!=null){
continue;
}
InvInventory invInventory=new InvInventory();
invInventory.setId(UuidUtil.get32UUIDString());
invInventory.setOrg_id("2c9007626dde3f4f016deda2151f1a42");
invInventory.setInv_code("WH"+tempInventoryFomPmp.getCode());
invInventory.setInv_name(tempInventoryFomPmp.getDescript());
invInventory.setInv_desc("-1");
invInventory.setSortid(tempInventoryFomPmp.getCode());
invInventory.setStatus("A");
invInventory.setCreate_by("0f98872af64711e9a1b10242ac110002");
invInventory.setCreate_time(LocalDateTime.now());
invInventories.add(invInventory);
i++;
invInventoryMapper.insert(invInventory);
}
//invInventoryMapper.insertBatch(invInventories);
System.err.println(i);
}
@Autowired
private TempAreaFomPmpMapper tempAreaFomPmpMapper;
@Autowired
private InvSubinventoryMapper invSubinventoryMapper;
/**
* temp_area_fom_pmp临时表创建库区信息inv_subinventory
*/
@Test
public void addSubinventory(){
List<TempAreaFomPmp> select = tempAreaFomPmpMapper.select();
int i=0;
System.err.println("查询到"+select.size()+"条数据");
for (TempAreaFomPmp tempAreaFomPmp:select) {
InvSubinventory bySubinvCode = invSubinventoryMapper.findBySubinvCode("KQ" + tempAreaFomPmp.getSubwh());
if(bySubinvCode!=null){
continue;
}
InvSubinventory invSubinventory=new InvSubinventory();
invSubinventory.setId(UuidUtil.get32UUIDString());
invSubinventory.setCreateDate(LocalDateTime.now());
invSubinventory.setCreateBy("0f98872af64711e9a1b10242ac110002");
InvInventory bySortid = invInventoryMapper.findBySortid(tempAreaFomPmp.getWh());
if(bySortid==null){
continue;
}
invSubinventory.setInvId(bySortid.getId());
invSubinventory.setSubinvType("STORAGE");
invSubinventory.setSubinvCode("KQ"+tempAreaFomPmp.getSubwh());
invSubinventory.setSubinvName("存储区");
invSubinventory.setSubinvDesc("-1");
invSubinventory.setLocatorControl("Y");
invSubinventory.setStatus("A");
i++;
invSubinventoryMapper.insert(invSubinventory);
}
System.err.println("处理了"+i+"条数据");
}
@Autowired
private TempLocatorFomPmpMapper tempLocatorFomPmpMapper;
@Autowired
private InvLocatorMapper invLocatorMapper;
/**
* temp_locator_fom_pmp临时表创建h货架信息inv_locator
*/
@Test
public void addLocator(){
List<TempLocatorFomPmp> select = tempLocatorFomPmpMapper.select();
int i=0;
System.err.println("查询到"+select.size()+"条数据");
// List<InvLocator> invLocators=new ArrayList<>();
for (TempLocatorFomPmp tempLocatorFomPmp:select) {
InvLocator invLocatorList = invLocatorMapper.findLocatorByCode("HJ" + tempLocatorFomPmp.getCode());
if(invLocatorList!=null){
continue;
}
InvLocator invLocator=new InvLocator();
invLocator.setId(UuidUtil.get32UUIDString());
invLocator.setCreateBy("0f98872af64711e9a1b10242ac110002");
invLocator.setCreateTime(LocalDateTime.now());
InvInventory bySortid = invInventoryMapper.findBySortid(tempLocatorFomPmp.getWh());
if(bySortid==null){
continue;
}
invLocator.setInvId(bySortid.getId());
List<InvSubinventory> invSubinventories = invSubinventoryMapper.selectByInvIdAndSubinvName(bySortid.getId());
if(invSubinventories==null || invSubinventories.size()<=0){
continue;
}
invLocator.setSubinvId(invSubinventories.get(0).getId());
invLocator.setLocatorCode("HJ"+tempLocatorFomPmp.getCode());
invLocator.setLocatorName(tempLocatorFomPmp.getCode());
invLocator.setLocatorDesc("-1");
invLocator.setStatus("A");
// invLocators.add(invLocator);
invLocatorMapper.insert(invLocator);
i++;
System.err.println("第"+i+"条处理完毕");
}
// invLocatorMapper.insertBatch(invLocators);
System.err.println("处理了"+i+"条数据");
}
@Autowired
private TempItemFomPmpMapper tempItemFomPmpMapper;
@Autowired
private InvItemMapper invItemMapper;
@Autowired
private PropertiesServer propertiesServer;
@Autowired
private SysUserDepartMapper sysUserDepartMapper;
@Autowired
private InvItemSkuMapper invItemSkuMapper;
@Autowired
private InvItemAttributeMapper invItemAttributeMapper;
@Autowired
private IdWorker idWorker;
/**
* 将商品信息从临时表temp_item_fom_pmp同步到正式表inv_item 2683351
*/
@Test
public void addInvItem(){
int j=0;
while (true){
//List<TempItemFomPmp> limit = tempItemFomPmpMapper.findLimit(j);
List<TempItemFomPmp> limit = tempItemFomPmpMapper.getDifference();
System.err.println("查询到"+limit.size()+"条数据");
if(limit.size()<=0){
System.err.println("所有数据同步完成!!!");
return;
}
List<InvItem> invItems=new ArrayList<>();
List<InvItemAttribute> invItemAttributes=new ArrayList<>();
List<InvItemSku> invItemSkus=new ArrayList<>();
for (TempItemFomPmp tempItemFomPmp:limit) {
InvItem invItem=new InvItem();
InvItemAttribute invItemAttribute=new InvItemAttribute();
InvItemSku invItemSku=new InvItemSku();
//商品表
invItem.setId(UuidUtil.get32UUIDString());
invItem.setOrgId("2c9007626dde3f4f016deda2151f1a42");
invItem.setStatus("SALE");
if(StringUtil.isEmpty(tempItemFomPmp.getClscode())){
invItem.setProType("14");
}else{
invItem.setProType(tempItemFomPmp.getClscode());
}
invItem.setItemCode(idWorker.nextId()+"");
invItem.setItemName(tempItemFomPmp.getTitle());
invItem.setItemDesc(tempItemFomPmp.getJp());
invItem.setPystype(tempItemFomPmp.getPystype()+"");
invItem.setIsbn(tempItemFomPmp.getIsbn());
invItem.setPlucode(tempItemFomPmp.getPlucode());
invItem.setScancode(tempItemFomPmp.getScancode());
invItem.setExtcode("0");
invItem.setPurchasePrice(tempItemFomPmp.getPrice()+"");
invItem.setGeneralName(tempItemFomPmp.getClscode());
invItem.setManufacturerId(tempItemFomPmp.getPublisher());
invItem.setSpecification(tempItemFomPmp.getPubdate());
invItem.setPrimaryUnit("BEN");
if(tempItemFomPmp.getPystype()==0||tempItemFomPmp.getPystype()==4){
invItem.setAttribute1("Book");
invItem.setIsBorrow("Y");
}else{
invItem.setAttribute1("Goods");
invItem.setIsBorrow("N");
}
invItem.setAttribute2("A");
invItem.setTax(tempItemFomPmp.getInctax()+"");
invItem.setDefaultVendorId("000000006c60dba1016c60f839270004");
invItem.setCreateBy("PMP同步");
invItem.setCreateTime(LocalDateTime.now());
//查询当前用户部门
//SysUserDepart sysUserDepart = sysUserDepartMapper.selectByUserId("b7b819e3a7fb25699ff5e10332f089f7");
//图书信息
invItemAttribute.setId(UuidUtil.get32UUIDString());
invItemAttribute.setCreateBy("PMP同步");
invItemAttribute.setCreateTime(LocalDateTime.now());
// if(sysUserDepart!=null){
// invItemAttribute.setSysOrgCode(sysUserDepart.getDepId());
// }
// InvItem invItem=new InvItem();
// InvItemAttribute invItemAttribute=new InvItemAttribute();
// InvItemSku invItemSku=new InvItemSku();
//
// //商品表
// invItem.setId(UuidUtil.get32UUIDString());
// invItem.setOrgId("2c9007626dde3f4f016deda2151f1a42");
// invItem.setStatus("SALE");
// invItem.setProType(tempItemFomPmp.getClscode());
// invItem.setItemCode(idWorker.nextId()+"");
// invItem.setItemName(tempItemFomPmp.getTitle());
// invItem.setItemDesc(tempItemFomPmp.getJp());
// invItem.setPystype(tempItemFomPmp.getPystype()+"");
// invItem.setIsbn(tempItemFomPmp.getIsbn());
// invItem.setPlucode(tempItemFomPmp.getPlucode());
// invItem.setScancode(tempItemFomPmp.getScancode());
// invItem.setExtcode("0");
// invItem.setPurchasePrice(tempItemFomPmp.getPrice()+"");
// invItem.setGeneralName(tempItemFomPmp.getClscode());
// invItem.setManufacturerId(tempItemFomPmp.getPublisher());
// invItem.setSpecification(tempItemFomPmp.getPubdate());
// invItem.setPrimaryUnit("BEN");
// if(tempItemFomPmp.getPystype()==0||tempItemFomPmp.getPystype()==4){
// invItem.setAttribute1("Book");
// invItem.setIsBorrow("Y");
// }else{
// invItem.setAttribute1("Goods");
// invItem.setIsBorrow("N");
invItemAttribute.setItemId(invItem.getId());
invItemAttribute.setItemCode(invItem.getItemCode());
invItemAttribute.setAuthor(tempItemFomPmp.getAuthor());
invItemAttribute.setReader(tempItemFomPmp.getReader());
//商品SKU映射
invItemSku.setId(UuidUtil.get32UUIDString());
// if(sysUserDepart!=null){
// invItemSku.setSysOrgCode(sysUserDepart.getDepId());
// }
// invItem.setAttribute2("A");
// invItem.setTax(tempItemFomPmp.getInctax()+"");
// invItem.setDefaultVendorId("000000006c60dba1016c60f839270004");
// invItem.setCreateBy("PMP同步");
// invItem.setCreateTime(LocalDateTime.now());
// //查询当前用户部门
// //SysUserDepart sysUserDepart = sysUserDepartMapper.selectByUserId("b7b819e3a7fb25699ff5e10332f089f7");
//
// //图书信息
// invItemAttribute.setId(UuidUtil.get32UUIDString());
// invItemAttribute.setCreateBy("PMP同步");
// invItemAttribute.setCreateTime(LocalDateTime.now());
//// if(sysUserDepart!=null){
//// invItemAttribute.setSysOrgCode(sysUserDepart.getDepId());
//// }
// invItemAttribute.setItemId(invItem.getId());
// invItemAttribute.setItemCode(invItem.getItemCode());
// invItemAttribute.setAuthor(tempItemFomPmp.getAuthor());
// invItemAttribute.setReader(tempItemFomPmp.getReader());
//
//
// //商品SKU映射
// invItemSku.setId(UuidUtil.get32UUIDString());
//// if(sysUserDepart!=null){
//// invItemSku.setSysOrgCode(sysUserDepart.getDepId());
//// }
// invItemSku.setOrgId("2c9007626dde3f4f016deda2151f1a42");
// invItemSku.setExternal("PMP");
// invItemSku.setItemSku(tempItemFomPmp.getPlucode());
// invItemSku.setItemName(invItem.getItemName());
// invItemSku.setItemCode(invItem.getItemCode());
// invItemSku.setItemDesc(invItem.getItemDesc());
// invItemSku.setStatus("A");
// invItemSku.setCreateBy("PMP同步");
// invItemSku.setCreateTime(LocalDateTime.now());
// invItems.add(invItem);
// invItemAttributes.add(invItemAttribute);
// invItemSkus.add(invItemSku);
// }
// System.err.println("数据封装完成");
// invItemMapper.insertBatch(invItems);
// invItemSkuMapper.insertBatch(invItemSkus);
// invItemAttributeMapper.insertBatch(invItemAttributes);
// j=j+999;
// System.err.println("前"+j+"条同步完成");
//
// }
// }
//
// /**
// * 将商品信息从临时表temp_item_fom_pmp同步到正式表inv_item 2683351
// */
// @Test
// public void addInvItems(){
// int i=0;
// int j=0;
// while (true){
// List<TempItemFomPmp> limit = tempItemFomPmpMapper.findLimit(j);
// System.err.println("查询到"+limit.size()+"条数据");
// if(limit.size()<=0){
// System.err.println("所有数据同步完成!!!");
// return;
// }
// for (TempItemFomPmp tempItemFomPmp:limit) {
// InvItem plucode = invItemMapper.findByPlucode(tempItemFomPmp.getPlucode());
// if(plucode!=null){
// i++;
// System.err.println("第"+i+"条同步完成");
// continue;
// }
// InvItem invItem=new InvItem();
// InvItemAttribute invItemAttribute=new InvItemAttribute();
// InvItemSku invItemSku=new InvItemSku();
//
// //商品表
// invItem.setId(UuidUtil.get32UUIDString());
// invItem.setOrgId("2c9007626dde3f4f016deda2151f1a42");
// invItem.setStatus("SALE");
// invItem.setProType(tempItemFomPmp.getClscode());
// invItem.setItemCode(idWorker.nextId()+"");
// invItem.setItemName(tempItemFomPmp.getTitle());
// invItem.setItemDesc(tempItemFomPmp.getJp());
// invItem.setPystype(tempItemFomPmp.getPystype()+"");
// invItem.setIsbn(tempItemFomPmp.getIsbn());
// invItem.setPlucode(tempItemFomPmp.getPlucode());
// invItem.setScancode(tempItemFomPmp.getScancode());
// invItem.setExtcode("0");
// invItem.setPurchasePrice(tempItemFomPmp.getPrice()+"");
// invItem.setGeneralName(tempItemFomPmp.getClscode());
// invItem.setManufacturerId(tempItemFomPmp.getPublisher());
// invItem.setSpecification(tempItemFomPmp.getPubdate());
// invItem.setPrimaryUnit("BEN");
// if(tempItemFomPmp.getPystype()==0||tempItemFomPmp.getPystype()==4){
// invItem.setAttribute1("Book");
// invItem.setIsBorrow("Y");
// }else{
// invItem.setAttribute1("Goods");
// invItem.setIsBorrow("N");
// }
// invItem.setAttribute2("A");
// invItem.setTax(tempItemFomPmp.getInctax()+"");
// invItem.setDefaultVendorId("000000006c60dba1016c60f839270004");
// invItem.setCreateBy("PMP同步");
// invItem.setCreateTime(LocalDateTime.now());
// //查询当前用户部门
// //SysUserDepart sysUserDepart = sysUserDepartMapper.selectByUserId("b7b819e3a7fb25699ff5e10332f089f7");
//
// //图书信息
// invItemAttribute.setId(UuidUtil.get32UUIDString());
// invItemAttribute.setCreateBy("PMP同步");
// invItemAttribute.setCreateTime(LocalDateTime.now());
//// if(sysUserDepart!=null){
//// invItemAttribute.setSysOrgCode(sysUserDepart.getDepId());
//// }
// invItemAttribute.setItemId(invItem.getId());
// invItemAttribute.setItemCode(invItem.getItemCode());
// invItemAttribute.setAuthor(tempItemFomPmp.getAuthor());
// invItemAttribute.setReader(tempItemFomPmp.getReader());
//
//
// //商品SKU映射
// invItemSku.setId(UuidUtil.get32UUIDString());
//// if(sysUserDepart!=null){
//// invItemSku.setSysOrgCode(sysUserDepart.getDepId());
//// }
// invItemSku.setOrgId("2c9007626dde3f4f016deda2151f1a42");
// invItemSku.setExternal("PMP");
// invItemSku.setItemSku(tempItemFomPmp.getPlucode());
// invItemSku.setItemName(invItem.getItemName());
// invItemSku.setItemCode(invItem.getItemCode());
// invItemSku.setItemDesc(invItem.getItemDesc());
// invItemSku.setStatus("A");
// invItemSku.setCreateBy("PMP同步");
// invItemSku.setCreateTime(LocalDateTime.now());
// invItemMapper.insert(invItem);
// invItemSkuMapper.insert(invItemSku);
// invItemAttributeMapper.insert(invItemAttribute);
// i++;
// System.err.println("第"+i+"条同步完成");
// }
// j=j+99999;
// }
//
// }
//
//
// @Autowired
// private TempItemSkuFomPmpMapper tempItemSkuFomPmpMapper;
//
// @Autowired
// private TransactionController transactionController;
// /**
// * 将商品库存信息从临时表temp_item_sku_fom_pmp同步到正式库存
// */
// @Test
// public void addInvItemSku(){
// List<TempItemSkuFomPmp> select = tempItemSkuFomPmpMapper.select();
// System.err.println(select.size());
// int i=0;
// for (TempItemSkuFomPmp tempItemSkuFomPmp:select) {
// JSONObject jsonObject=new JSONObject();
// JSONObject data=new JSONObject();
// data.put("inv_code","WH2");
// data.put("subinv_code","KQ22");
// data.put("locator_code","HJ"+tempItemSkuFomPmp.getRack());
// String itemcode = invItemMapper.getPlucode(tempItemSkuFomPmp.getPlucode());
// if(itemcode==null){
// continue;
// }
// data.put("item_code",itemcode);
// data.put("tx_type_code","PMP_SYN");
// data.put("tx_date",new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
// data.put("tx_quantity",tempItemSkuFomPmp.getQty());
// data.put("tx_price",tempItemSkuFomPmp.getPrice());
// jsonObject.put("data",data);
// String s = transactionController.invItemInOut("201910271129039497a78b526d9a246eca0abb1025986f25cG7BHIxhVaDO6MYm", jsonObject);
// i++;
// System.err.println(i+"--"+select.size());
// }
// }
//}
invItemSku.setOrgId("2c9007626dde3f4f016deda2151f1a42");
invItemSku.setExternal("PMP");
invItemSku.setItemSku(tempItemFomPmp.getPlucode());
invItemSku.setItemName(invItem.getItemName());
invItemSku.setItemCode(invItem.getItemCode());
invItemSku.setItemDesc(invItem.getItemDesc());
invItemSku.setStatus("A");
invItemSku.setCreateBy("PMP同步");
invItemSku.setCreateTime(LocalDateTime.now());
invItems.add(invItem);
invItemAttributes.add(invItemAttribute);
invItemSkus.add(invItemSku);
}
System.err.println("数据封装完成");
invItemMapper.insertBatch(invItems);
invItemSkuMapper.insertBatch(invItemSkus);
invItemAttributeMapper.insertBatch(invItemAttributes);
j=j+49999;
System.err.println("前"+j+"条同步完成");
}
}
@Autowired
private TempItemSkuFomPmpMapper tempItemSkuFomPmpMapper;
@Autowired
private TransactionController transactionController;
@Autowired
private InvTransactionMapper invTransactionMapper;
/**
* 将商品库存信息从临时表temp_item_sku_fom_pmp同步到正式库存
*/
@Test
public void addInvItemSku(){
List<TempItemSkuFomPmp> select = tempItemSkuFomPmpMapper.select();
System.err.println(select.size());
int i=0;
for (TempItemSkuFomPmp tempItemSkuFomPmp:select) {
JSONObject jsonObject=new JSONObject();
JSONObject data=new JSONObject();
data.put("inv_code","WH2");
data.put("subinv_code","KQ22");
data.put("locator_code","HJ"+tempItemSkuFomPmp.getRack());
InvItem invItem = invItemMapper.findAllByPlucode(tempItemSkuFomPmp.getPlucode());
if(invItem==null){
System.err.println("查询不到商品信息");
continue;
}
String id = invTransactionMapper.findIdByItemId(invItem.getId());
if(!StringUtil.isEmpty(id)){
System.err.println(tempItemSkuFomPmp.getPlucode()+"已经同步");
continue;
}
data.put("item_code",invItem.getItemCode());
data.put("tx_type_code","PMP_SYN");
data.put("tx_date",new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
data.put("tx_quantity",tempItemSkuFomPmp.getQty());
data.put("tx_price",tempItemSkuFomPmp.getPrice());
jsonObject.put("data",data);
String s = transactionController.invItemInOut("201910271129039497a78b526d9a246eca0abb1025986f25cG7BHIxhVaDO6MYm", jsonObject);
i++;
System.err.println(i+"--"+select.size());
}
}
@Autowired
private TempSupplierFomPmpMapper tempSupplierFomPmpMapper;
@Autowired
private PurSupplierMapper purSupplierMapper;
@Autowired
private PurSupplierSiteMapper purSupplierSiteMapper;
@Autowired
private PurSupplierContactMapper purSupplierContactMapper;
/**
* 将供应商信息从临时表temp_supplier_fom_pmp同步到正式表
*/
@Test
public void tempSupplierFomPmp(){
List<TempSupplierFomPmp> select = tempSupplierFomPmpMapper.select();
List<PurSupplier> purSuppliers=new ArrayList<>();
List<PurSupplierSite> purSupplierSites=new ArrayList<>();
List<PurSupplierContact> purSupplierContacts=new ArrayList<>();
for (TempSupplierFomPmp tempSupplierFomPmp:select) {
PurSupplier purSupplier=new PurSupplier();
PurSupplierSite purSupplierSite=new PurSupplierSite();
PurSupplierContact purSupplierContact=new PurSupplierContact();
String uuid = UuidUtil.get32UUIDString();
purSupplier.setId(uuid);
purSupplier.setCreateBy("PMP同步");
purSupplier.setCreateTime(LocalDateTime.now());
purSupplier.setSupplierCode(tempSupplierFomPmp.getCode());
purSupplier.setSupplierName(tempSupplierFomPmp.getFullname());
purSupplier.setSupplierShortName(tempSupplierFomPmp.getShortname());
purSupplier.setStatus("A");
String uuidSite = UuidUtil.get32UUIDString();
purSupplierSite.setId(uuidSite);
purSupplierSite.setCreateBy("PMP同步");
purSupplierSite.setCreateTime(LocalDateTime.now());
purSupplierSite.setSupplierId(uuid);
purSupplierSite.setSupplierSiteName(tempSupplierFomPmp.getAddress());
purSupplierSite.setTelephone(tempSupplierFomPmp.getPhone());
purSupplierSite.setStatus("A");
purSupplierContact.setId(UuidUtil.get32UUIDString());
purSupplierContact.setCreateBy("PMP同步");
purSupplierContact.setCreateTime(LocalDateTime.now());
purSupplierContact.setSupplierId(uuid);
purSupplierContact.setSupplierSiteId(uuidSite);
purSupplierContact.setContactName(tempSupplierFomPmp.getContact());
purSupplierContact.setTelephone(tempSupplierFomPmp.getPhone());
purSupplierContact.setStatus("A");
purSuppliers.add(purSupplier);
purSupplierSites.add(purSupplierSite);
purSupplierContacts.add(purSupplierContact);
}
purSupplierMapper.insertBatch(purSuppliers);
purSupplierSiteMapper.insertBatch(purSupplierSites);
purSupplierContactMapper.insertBatch(purSupplierContacts);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment