Commit 8dab0a00 by 肖洋洋

外部接口对接代码2

parent c99ed9f9
Showing with 998 additions and 143 deletions
...@@ -3,7 +3,9 @@ package orthopedics; ...@@ -3,7 +3,9 @@ package orthopedics;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.EnableScheduling;
import orthopedics.util.IdWorker;
@SpringBootApplication @SpringBootApplication
//@EnableScheduling //@EnableScheduling
...@@ -13,5 +15,8 @@ public class Application { ...@@ -13,5 +15,8 @@ public class Application {
SpringApplication.run(Application.class, args); SpringApplication.run(Application.class, args);
} }
@Bean
public IdWorker idWorker(){
return new IdWorker();
}
} }
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.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import orthopedics.controller.v1.TransactionController;
import orthopedics.dao.*;
import orthopedics.model.*;
import orthopedics.service.PropertiesServer;
import orthopedics.util.IdWorker;
import orthopedics.util.UuidUtil;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@RestController
@RequestMapping("/Sync")
public class Sync {
private final static Logger logger = LoggerFactory.getLogger(Sync.class);
@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;
@GetMapping("/item")
public void sync1(){
int j=210295;
while (true){
try {
List<TempItemFomPmp> limit = tempItemFomPmpMapper.findLimit(j);
if(limit.size()<=0){
logger.info("所有数据同步完成!!!");
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;
}
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());
invItems.add(invItem);
invItemAttributes.add(invItemAttribute);
invItemSkus.add(invItemSku);
}
if(invItems.size()<=0){
continue;
}
invItemMapper.insertBatch(invItems);
invItemSkuMapper.insertBatch(invItemSkus);
invItemAttributeMapper.insertBatch(invItemAttributes);
j=j+4999;
logger.info("前"+j+"条同步完成");
}catch (Exception e){
logger.error("同步失败的下标段"+j+"-"+(j+4999));
logger.error(e.getMessage());
j=j+4999;
}
}
}
@Autowired
private TempItemSkuFomPmpMapper tempItemSkuFomPmpMapper;
@Autowired
private TransactionController transactionController;
@GetMapping("/sku")
public void addInvItemSku(){
List<TempItemSkuFomPmp> select = tempItemSkuFomPmpMapper.select();
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++;
logger.info("同步到"+i+"条"+",一共"+select.size()+"条");
}
}
}
...@@ -10,8 +10,10 @@ import org.springframework.scheduling.annotation.Scheduled; ...@@ -10,8 +10,10 @@ import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import orthopedics.dao.InvItemBalanceSummaryVMapper; import orthopedics.dao.InvItemBalanceSummaryVMapper;
import orthopedics.dao.InvLocatorMapper;
import orthopedics.dao.SalOrderHeaderMapper; import orthopedics.dao.SalOrderHeaderMapper;
import orthopedics.model.InvItemBalanceSummaryV; import orthopedics.model.InvItemBalanceSummaryV;
import orthopedics.model.InvLocator;
import orthopedics.model.SalOrderHeader; import orthopedics.model.SalOrderHeader;
import orthopedics.util.*; import orthopedics.util.*;
...@@ -24,6 +26,9 @@ public class SyncItemSku { ...@@ -24,6 +26,9 @@ public class SyncItemSku {
@Autowired @Autowired
private InvItemBalanceSummaryVMapper invItemBalanceSummaryVMapper; private InvItemBalanceSummaryVMapper invItemBalanceSummaryVMapper;
@Autowired
private InvLocatorMapper invLocatorMapper;
/** /**
* 将商品库存同步到PMP * 将商品库存同步到PMP
*/ */
...@@ -41,7 +46,8 @@ public class SyncItemSku { ...@@ -41,7 +46,8 @@ public class SyncItemSku {
JSONObject jsonObject=new JSONObject(); JSONObject jsonObject=new JSONObject();
if(invItemBalanceSummaryV.getLocator_id()!=null && invItemBalanceSummaryV.getBalance()!=null){ if(invItemBalanceSummaryV.getLocator_id()!=null && invItemBalanceSummaryV.getBalance()!=null){
jsonObject.put("wh",invItemBalanceSummaryV.getInv_id()); jsonObject.put("wh",invItemBalanceSummaryV.getInv_id());
jsonObject.put("rack",invItemBalanceSummaryV.getLocator_id()); InvLocator byId = invLocatorMapper.findById(invItemBalanceSummaryV.getLocator_id());
jsonObject.put("rack",byId.getLocatorName());
jsonObject.put("plucode",invItemBalanceSummaryV.getPlucode()); jsonObject.put("plucode",invItemBalanceSummaryV.getPlucode());
jsonObject.put("qty",invItemBalanceSummaryV.getBalance()); jsonObject.put("qty",invItemBalanceSummaryV.getBalance());
plulist.add(jsonObject); plulist.add(jsonObject);
......
...@@ -60,10 +60,24 @@ public class SyncSalFromPos { ...@@ -60,10 +60,24 @@ public class SyncSalFromPos {
ps.setString(1,invItem.getItemCode()); ps.setString(1,invItem.getItemCode());
rs = ps.executeQuery(); rs = ps.executeQuery();
while (rs.next()){ while (rs.next()){
String operator = rs.getString(2);//收银员账号
Timestamp timestamp = rs.getTimestamp(3);//订单时间 Timestamp timestamp = rs.getTimestamp(3);//订单时间
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); long vouchnum = rs.getLong(4);//小票单号
// String dateStr = sdf.format(date); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String paymentMethod = rs.getString(8);//支付方式 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");
ps1.setString(1,dateStr);
ps1.setLong(2,vouchnum);
ps1.setString(3,operator);
String paymentMethod =null;//支付方式
ResultSet rs1 = ps1.executeQuery();
while (rs1.next()){
paymentMethod = rs1.getString(8);
}
rs1.close();
ps1.close();
int quantity = rs.getInt(13);//数量 int quantity = rs.getInt(13);//数量
int attribute1 = rs.getInt(14);//单价 int attribute1 = rs.getInt(14);//单价
int attribute3 = rs.getInt(15);//折扣 int attribute3 = rs.getInt(15);//折扣
......
...@@ -9,10 +9,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -9,10 +9,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import orthopedics.dao.InvItemMapper; import orthopedics.dao.*;
import orthopedics.dao.InvLocatorMapper;
import orthopedics.dao.InvSubinventoryMapper;
import orthopedics.dao.SalOrderLineVMapper;
import orthopedics.model.*; import orthopedics.model.*;
import orthopedics.util.Aes; import orthopedics.util.Aes;
import orthopedics.util.HttpUtilPMP; import orthopedics.util.HttpUtilPMP;
...@@ -37,6 +34,9 @@ public class SyncSalOrderHeader { ...@@ -37,6 +34,9 @@ public class SyncSalOrderHeader {
@Autowired @Autowired
private InvLocatorMapper invLocatorMapper; private InvLocatorMapper invLocatorMapper;
@Autowired
private SalOrderLineDetailVMapper salOrderLineDetailVMapper;
/** /**
* 将销售订单同步到PMP * 将销售订单同步到PMP
*/ */
...@@ -53,35 +53,26 @@ public class SyncSalOrderHeader { ...@@ -53,35 +53,26 @@ public class SyncSalOrderHeader {
for (SalOrderLineV salOrderLineV:byPMP) { for (SalOrderLineV salOrderLineV:byPMP) {
JSONObject jsonObject=new JSONObject(); JSONObject jsonObject=new JSONObject();
jsonObject.put("number",salOrderLineV.getOrderNumber()); jsonObject.put("number",salOrderLineV.getOrderNumber());
jsonObject.put("seq",salOrderLineV.getLineNumber()); jsonObject.put("seq",salOrderLineV.getLineNumber());
jsonObject.put("plucode",salOrderLineV.getPlucode()); jsonObject.put("plucode",salOrderLineV.getPlucode());
// jsonObject.put("fwh",salOrderLineV); // jsonObject.put("fwh",salOrderLineV);
InvItem invItem = invItemMapper.selectInvItemById(salOrderLineV.getItemId()); SalOrderLineDetailV byOrderNumber = salOrderLineDetailVMapper.findByOrderNumber(salOrderLineV.getOrderNumber());
if(invItem==null){ if(byOrderNumber==null){
logger.error("销售订单商品id【"+salOrderLineV.getItemId()+"】查询不到商品信息"); logger.error(salOrderLineV.getOrderNumber()+"查询不到销售订单执行报表");
return; continue;
} }
if(StringUtil.isEmpty(invItem.getInvId())){ InvLocator byId = invLocatorMapper.findById(byOrderNumber.getLocatorId());
logger.error("销售订单商品id【"+salOrderLineV.getItemId()+"】查询商品信息库存id为空"); if(byId==null){
return; logger.error(salOrderLineV.getOrderNumber()+"查询不到货架号");
} continue;
List<InvSubinventory> invSubinventories = invSubinventoryMapper.selectByInvIdAndSubinvName(invItem.getInvId()); }
if(invSubinventories==null||invSubinventories.size()<=0){ jsonObject.put("frack",byId.getLocatorName());
logger.error("商品code:"+invItem.getItemCode()+"库存id查询不到库区"); jsonObject.put("qty",salOrderLineV.getQuantity());
return; jsonObject.put("disc",salOrderLineV.getAttribute3());
} jsonObject.put("apvby",salOrderLineV.getOrderDate());
List<InvLocator> byInvIdAndSubinvId = invLocatorMapper.findByInvIdAndSubinvId(invItem.getInvId(), invSubinventories.get(0).getId()); jsonObject.put("apvtime",salOrderLineV.getOrderDate());
if(invSubinventories==null||invSubinventories.size()<=0){ billlist.add(jsonObject);
logger.error("商品code:"+invItem.getItemCode()+"库存id和存储库区id查询不到货架");
return;
}
jsonObject.put("frack",byInvIdAndSubinvId.get(0).getLocatorCode());
jsonObject.put("qty",salOrderLineV.getQuantity());
jsonObject.put("disc",salOrderLineV.getAttribute3());
jsonObject.put("apvby",salOrderLineV.getOrderDate());
jsonObject.put("apvtime",salOrderLineV.getOrderDate());
billlist.add(jsonObject);
} }
......
...@@ -170,6 +170,28 @@ public class InvCountHeaderController { ...@@ -170,6 +170,28 @@ public class InvCountHeaderController {
return new Result(true,StatusCode.OK,"盘点单查询成功",invCountHeaderPage); return new Result(true,StatusCode.OK,"盘点单查询成功",invCountHeaderPage);
} }
@GetMapping("/findByHeaderStatus")
public Result findByHeaderStatus(@RequestParam(value = "access_token",required = true)String token){
SysAccessToken sysAccessToken = userServer.checkToken(token);
List<InvCountHeaderPage> ichp=new ArrayList<>();
List<InvCountHeader> invCountHeaders = invCountHeaderMapper.fingByHeaderStatus("new");
if(invCountHeaders==null ||invCountHeaders.size()<=0){
return new Result(false, StatusCode.ERROR,"没有状态为【新增】数据");
}
for (InvCountHeader invCountHeader:invCountHeaders) {
InvCountHeaderPage invCountHeaderPage=new InvCountHeaderPage();
BeanUtils.copyProperties(invCountHeader,invCountHeaderPage);
List<InvCountLine> invCountLines = invCountLineMapper.selectByInvCountHeaderId(invCountHeader.getId());
if(invCountLines==null || invCountLines.size()<=0){
continue;
}
invCountHeaderPage.setInvCountLineList(invCountLines);
ichp.add(invCountHeaderPage);
}
return new Result(true,StatusCode.OK,"盘点单查询成功",ichp);
}
@GetMapping("/findByCountNumberToSku") @GetMapping("/findByCountNumberToSku")
public Result findByCountNumberToSku(@RequestParam(value = "access_token",required = true)String token,@RequestParam(value = "countNumber",required = true) String countNumber){ public Result findByCountNumberToSku(@RequestParam(value = "access_token",required = true)String token,@RequestParam(value = "countNumber",required = true) String countNumber){
SysAccessToken sysAccessToken = userServer.checkToken(token); SysAccessToken sysAccessToken = userServer.checkToken(token);
......
...@@ -40,10 +40,10 @@ public class InvCountPrintController { ...@@ -40,10 +40,10 @@ public class InvCountPrintController {
private InvItemBalanceSummaryVMapper invItemBalanceSummaryVMapper; private InvItemBalanceSummaryVMapper invItemBalanceSummaryVMapper;
@GetMapping("/findByPrintNumber") @GetMapping("/findByPrintNumber")
public Result findByPrintNumber(@RequestParam(value = "access_token",required = true)String token, @RequestParam(value = "printNumber",required = true) String printNumber){ public Result findByPrintNumber(@RequestParam(value = "access_token",required = true)String token, @RequestParam(value = "printInvId",required = true) String printInvId){
SysAccessToken sysAccessToken = userServer.checkToken(token); SysAccessToken sysAccessToken = userServer.checkToken(token);
List<InvCountPrintPage> ichp=new ArrayList<>(); List<InvCountPrintPage> ichp=new ArrayList<>();
if(StringUtil.isEmpty(printNumber)){ if(StringUtil.isEmpty(printInvId)){
List<SysOrgAccess> sysOrgAccesses = userServer.selectSysOrgAccessByUserId(sysAccessToken.getUserId()); List<SysOrgAccess> sysOrgAccesses = userServer.selectSysOrgAccessByUserId(sysAccessToken.getUserId());
if(sysOrgAccesses==null || sysOrgAccesses.size()<=0){ if(sysOrgAccesses==null || sysOrgAccesses.size()<=0){
return new Result(false, StatusCode.ERROR,"当前用户不属于任何组织"); return new Result(false, StatusCode.ERROR,"当前用户不属于任何组织");
...@@ -63,23 +63,32 @@ public class InvCountPrintController { ...@@ -63,23 +63,32 @@ public class InvCountPrintController {
} }
return new Result(true,StatusCode.OK,"盘点计划查询成功",ichp); return new Result(true,StatusCode.OK,"盘点计划查询成功",ichp);
} }
InvCountPrintPage invCountPrintPage=new InvCountPrintPage(); List<InvCountPrint> invCountPrints = invCountPrintMapper.findByPrintInvId(printInvId);
InvCountPrint byPrintNumber = invCountPrintMapper.findByPrintNumber(printNumber); if(invCountPrints==null || invCountPrints.size()<=0){
if(byPrintNumber==null){ return new Result(false, StatusCode.ERROR,"库存id查询不到数据");
return new Result(false, StatusCode.ERROR,"判断顺序号查询不到数据");
} }
List<InvCountPrintLine> byPrintId = invCountPrintLineMapper.findByPrintId(byPrintNumber.getId()); for (InvCountPrint invCountPrint:invCountPrints) {
BeanUtils.copyProperties(byPrintNumber,invCountPrintPage); InvCountPrintPage invCountPrintPage=new InvCountPrintPage();
invCountPrintPage.setInvCountPrintLines(byPrintId); BeanUtils.copyProperties(invCountPrint,invCountPrintPage);
return new Result(true,StatusCode.OK,"盘点计划查询成功",invCountPrintPage); List<InvCountPrintLine> invCountPrintLines = invCountPrintLineMapper.findByPrintId(invCountPrint.getId());
if(invCountPrintLines==null || invCountPrintLines.size()<=0){
continue;
}
invCountPrintPage.setInvCountPrintLines(invCountPrintLines);
ichp.add(invCountPrintPage);
}
return new Result(true,StatusCode.OK,"盘点计划查询成功",ichp);
} }
@GetMapping("/findByPrintNumberToSku") @GetMapping("/findByPrintNumberToSku")
public Result findByPrintNumberToSku(@RequestParam(value = "access_token",required = true)String token, @RequestParam(value = "printNumber",required = true) String printNumber){ public Result findByPrintNumberToSku(@RequestParam(value = "access_token",required = true)String token, @RequestParam(value = "printNumber",required = true) String printNumber,@RequestParam(value = "invId",required = true) String invId){
SysAccessToken sysAccessToken = userServer.checkToken(token); SysAccessToken sysAccessToken = userServer.checkToken(token);
if(StringUtil.isEmpty(printNumber)){ if(StringUtil.isEmpty(printNumber)){
return new Result(false, StatusCode.ERROR,"顺序号为空"); return new Result(false, StatusCode.ERROR,"顺序号为空");
} }
if(StringUtil.isEmpty(invId)){
return new Result(false, StatusCode.ERROR,"库存为空");
}
InvCountPrint byPrintNumber = invCountPrintMapper.findByPrintNumber(printNumber); InvCountPrint byPrintNumber = invCountPrintMapper.findByPrintNumber(printNumber);
if(byPrintNumber==null){ if(byPrintNumber==null){
return new Result(false, StatusCode.ERROR,"判断顺序号查询不到数据"); return new Result(false, StatusCode.ERROR,"判断顺序号查询不到数据");
...@@ -88,8 +97,8 @@ public class InvCountPrintController { ...@@ -88,8 +97,8 @@ public class InvCountPrintController {
if(byPrintId==null || byPrintId.size()<=0){ if(byPrintId==null || byPrintId.size()<=0){
return new Result(false, StatusCode.ERROR,"顺序号为【"+printNumber+"】没有子表数据"); return new Result(false, StatusCode.ERROR,"顺序号为【"+printNumber+"】没有子表数据");
} }
String sql = "";
String sqld="'"; String sqld="'";
String sql = " inv_id="+sqld+invId+sqld;
for (InvCountPrintLine invCountPrintLine:byPrintId) { for (InvCountPrintLine invCountPrintLine:byPrintId) {
SysDictItem sysDictItem = sysDictItemMapper.findByItemValue(invCountPrintLine.getCompare()); SysDictItem sysDictItem = sysDictItemMapper.findByItemValue(invCountPrintLine.getCompare());
if(sysDictItem==null){ if(sysDictItem==null){
......
...@@ -227,12 +227,13 @@ public class SalOrderHeaderController { ...@@ -227,12 +227,13 @@ public class SalOrderHeaderController {
if(warehouseCode==null||warehouseCode.equals("")){ if(warehouseCode==null||warehouseCode.equals("")){
return new Result(false, StatusCode.ERROR,"缺少库存code信息"); return new Result(false, StatusCode.ERROR,"缺少库存code信息");
} }
//装重复商品id
List skulist=new ArrayList<>();
if(type.equals("1")){ if(type.equals("1")){
//入库 //入库
List<SalOrderHeader> salOrderHeaders = salOrderHeaderMapper.selectSalOrderByattribute1(orderId); List<SalOrderHeader> salOrderHeaders = salOrderHeaderMapper.selectSalOrderByattribute1(orderId);
if(salOrderHeaders==null||salOrderHeaders.size()<=0){ if(salOrderHeaders==null||salOrderHeaders.size()<=0){
return new Result(false, StatusCode.ERROR,"查询不到借阅信息"); return new Result(false, StatusCode.ERROR,"销售订单未同步");
} }
salOrderHeaderMapper.updateStatus(salOrderHeaders.get(0).getId(),"refund"); salOrderHeaderMapper.updateStatus(salOrderHeaders.get(0).getId(),"refund");
for (JSONObject jsonObject:items) { for (JSONObject jsonObject:items) {
...@@ -249,6 +250,7 @@ public class SalOrderHeaderController { ...@@ -249,6 +250,7 @@ public class SalOrderHeaderController {
if(StringUtil.isEmpty(skuid)){ if(StringUtil.isEmpty(skuid)){
return new Result(false, StatusCode.ERROR,"缺少商品skuid"); return new Result(false, StatusCode.ERROR,"缺少商品skuid");
} }
int quantity=0; int quantity=0;
for (JSONObject jsonObject1:items) { for (JSONObject jsonObject1:items) {
JSONObject sku1 = (JSONObject) jsonObject1.get("sku"); JSONObject sku1 = (JSONObject) jsonObject1.get("sku");
...@@ -329,10 +331,14 @@ public class SalOrderHeaderController { ...@@ -329,10 +331,14 @@ public class SalOrderHeaderController {
if(StringUtil.isEmpty(skuid)){ if(StringUtil.isEmpty(skuid)){
return new Result(false, StatusCode.ERROR,"缺少商品skuid"); return new Result(false, StatusCode.ERROR,"缺少商品skuid");
} }
if(skulist.contains(skuid)){
continue;
}
skulist.add(skuid);
int quantity=0; int quantity=0;
for (JSONObject jsonObject1:items) { for (JSONObject jsonObject1:items) {
JSONObject sku1 = (JSONObject) jsonObject1.get("sku"); JSONObject sku1 = (JSONObject) jsonObject1.get("sku");
String id = (String) sku.get("_id"); String id = (String) sku1.get("_id");
if(id.equals(skuid)){ if(id.equals(skuid)){
quantity=quantity+1; quantity=quantity+1;
} }
...@@ -468,12 +474,13 @@ public class SalOrderHeaderController { ...@@ -468,12 +474,13 @@ public class SalOrderHeaderController {
if(warehouseCode==null||warehouseCode.equals("")){ if(warehouseCode==null||warehouseCode.equals("")){
return new Result(false, StatusCode.ERROR,"缺少库存code信息"); return new Result(false, StatusCode.ERROR,"缺少库存code信息");
} }
//装重复商品id
List skulist=new ArrayList<>();
if(status.equals("Return")){ if(status.equals("Return")){
//入库 //入库
List<SalOrderHeader> salOrderHeaders = salOrderHeaderMapper.selectSalOrderByattribute1(borrowId); List<SalOrderHeader> salOrderHeaders = salOrderHeaderMapper.selectSalOrderByattribute1(borrowId);
if(salOrderHeaders==null||salOrderHeaders.size()<=0){ if(salOrderHeaders==null||salOrderHeaders.size()<=0){
return new Result(false, StatusCode.ERROR,"查询不到借阅信息"); return new Result(false, StatusCode.ERROR,"借阅信息未同步");
} }
salOrderHeaderMapper.updateStatus(salOrderHeaders.get(0).getId(),"return"); salOrderHeaderMapper.updateStatus(salOrderHeaders.get(0).getId(),"return");
for (JSONObject jsonObject:items) { for (JSONObject jsonObject:items) {
...@@ -570,10 +577,14 @@ public class SalOrderHeaderController { ...@@ -570,10 +577,14 @@ public class SalOrderHeaderController {
if(StringUtil.isEmpty(skuid)){ if(StringUtil.isEmpty(skuid)){
return new Result(false, StatusCode.ERROR,"缺少商品skuid"); return new Result(false, StatusCode.ERROR,"缺少商品skuid");
} }
if(skulist.contains(skuid)){
continue;
}
skulist.add(skuid);
int quantity=0; int quantity=0;
for (JSONObject jsonObject1:items) { for (JSONObject jsonObject1:items) {
JSONObject sku1 = (JSONObject) jsonObject1.get("sku"); JSONObject sku1 = (JSONObject) jsonObject1.get("sku");
String id = (String) sku.get("_id"); String id = (String) sku1.get("_id");
if(id.equals(skuid)){ if(id.equals(skuid)){
quantity=quantity+1; quantity=quantity+1;
} }
...@@ -729,4 +740,5 @@ public class SalOrderHeaderController { ...@@ -729,4 +740,5 @@ public class SalOrderHeaderController {
data.put("data",jsonObject); data.put("data",jsonObject);
return new Result(true, StatusCode.ERROR,"数据封装完毕",data); return new Result(true, StatusCode.ERROR,"数据封装完毕",data);
} }
} }
...@@ -51,7 +51,7 @@ public class TakeStockController { ...@@ -51,7 +51,7 @@ public class TakeStockController {
*/ */
@PostMapping("/invInventory/search") @PostMapping("/invInventory/search")
public Result invInventorySearch(@RequestParam("access_token")String token, @RequestBody JSONObject requestJson) throws Exception { public Result invInventorySearch(@RequestParam("access_token")String token, @RequestBody JSONObject requestJson) {
SysAccessToken sysAccessToken = userServer.checkToken(token); SysAccessToken sysAccessToken = userServer.checkToken(token);
if(requestJson==null||requestJson.size()<=0){ if(requestJson==null||requestJson.size()<=0){
List<InvInventory> select = invInventoryMapper.select(); List<InvInventory> select = invInventoryMapper.select();
...@@ -77,7 +77,7 @@ public class TakeStockController { ...@@ -77,7 +77,7 @@ public class TakeStockController {
*/ */
@PostMapping("/invSubinventory/search") @PostMapping("/invSubinventory/search")
public Result invSubinventorySearch(@RequestParam("access_token")String token, @RequestBody JSONObject requestJson) throws Exception { public Result invSubinventorySearch(@RequestParam("access_token")String token, @RequestBody JSONObject requestJson) {
SysAccessToken sysAccessToken = userServer.checkToken(token); SysAccessToken sysAccessToken = userServer.checkToken(token);
if(requestJson==null||requestJson.size()<=0){ if(requestJson==null||requestJson.size()<=0){
List<InvSubinventory> select = invSubinventoryMapper.select(); List<InvSubinventory> select = invSubinventoryMapper.select();
...@@ -104,7 +104,7 @@ public class TakeStockController { ...@@ -104,7 +104,7 @@ public class TakeStockController {
*/ */
@PostMapping("/invLocator/search") @PostMapping("/invLocator/search")
public Result invLocatorSearch(@RequestParam("access_token")String token, @RequestBody JSONObject requestJson) throws Exception { public Result invLocatorSearch(@RequestParam("access_token")String token, @RequestBody JSONObject requestJson) {
SysAccessToken sysAccessToken = userServer.checkToken(token); SysAccessToken sysAccessToken = userServer.checkToken(token);
if(requestJson==null||requestJson.size()<=0){ if(requestJson==null||requestJson.size()<=0){
List<InvLocator> select = invLocatorMapper.select(); List<InvLocator> select = invLocatorMapper.select();
...@@ -129,7 +129,7 @@ public class TakeStockController { ...@@ -129,7 +129,7 @@ public class TakeStockController {
* @throws Exception * @throws Exception
*/ */
@PostMapping("/sku/search") @PostMapping("/sku/search")
public Result skuSearch(@RequestParam("access_token")String token, @RequestBody JSONObject requestJson) throws Exception { public Result skuSearch(@RequestParam("access_token")String token, @RequestBody JSONObject requestJson) {
SysAccessToken sysAccessToken = userServer.checkToken(token); SysAccessToken sysAccessToken = userServer.checkToken(token);
if(requestJson==null||requestJson.size()<=0){ if(requestJson==null||requestJson.size()<=0){
List<InvItemBalanceSummaryV> select = invItemBalanceSummaryVMapper.select(); List<InvItemBalanceSummaryV> select = invItemBalanceSummaryVMapper.select();
...@@ -173,7 +173,7 @@ public class TakeStockController { ...@@ -173,7 +173,7 @@ public class TakeStockController {
* @throws Exception * @throws Exception
*/ */
@GetMapping("/sku/findLikeSku") @GetMapping("/sku/findLikeSku")
public Result findLikeSku(@RequestParam("access_token")String token, @RequestParam String request) throws Exception { public Result findLikeSku(@RequestParam("access_token")String token, @RequestParam String request){
SysAccessToken sysAccessToken = userServer.checkToken(token); SysAccessToken sysAccessToken = userServer.checkToken(token);
if(StringUtil.isEmpty(request)){ if(StringUtil.isEmpty(request)){
return new Result(false,StatusCode.ERROR,"参数为空"); return new Result(false,StatusCode.ERROR,"参数为空");
...@@ -183,6 +183,27 @@ public class TakeStockController { ...@@ -183,6 +183,27 @@ public class TakeStockController {
} }
/**
* 根据库存查询库存现有量
* @param token
* @param invId
* @return
* @throws Exception
*/
@GetMapping("/sku/findInvId")
public Result findInvId(@RequestParam("access_token")String token, @RequestParam String invId,@RequestParam String request) {
SysAccessToken sysAccessToken = userServer.checkToken(token);
if(StringUtil.isEmpty(invId)){
return new Result(false,StatusCode.ERROR,"参数为空");
}
if(StringUtil.isEmpty(request)){
return new Result(false,StatusCode.ERROR,"参数为空");
}
List<InvItemBalanceSummaryV> byLikeAll = invItemBalanceSummaryVMapper.findByInvIdAndLikeAll(invId,request);
return new Result(true,StatusCode.OK,"库存现有量查询成功",byLikeAll);
}
@Autowired @Autowired
private RedisTemplate redisTemplate; private RedisTemplate redisTemplate;
......
...@@ -2015,11 +2015,7 @@ public class PurchaseController { ...@@ -2015,11 +2015,7 @@ public class PurchaseController {
//status和headerId为筛选条件 //status和headerId为筛选条件
private List<RcvReceiptLineV> getUniqueRcvReceiptLine(String userName, String userId, String status, String headerId) { private List<RcvReceiptLineV> getUniqueRcvReceiptLine(String userName, String userId, String status, String headerId) {
List<RcvReceiptLineV> rcvReceiptLineVList = new ArrayList<>(); List<RcvReceiptLineV> rcvReceiptLineVList = new ArrayList<>();
rcvReceiptLineVList.addAll(purchaseServer.selectRcvReceiptLineVByUserNameAndStatusAndHeaderId(userName, status, headerId)); rcvReceiptLineVList.addAll(purchaseServer.selectRcvReceiptLineVByInvIdAndStatusAndHeaderIdG(status, headerId));
List<String> invList = getValidInvIdByUserId(userId);
if (invList.size() > 0) {
rcvReceiptLineVList.addAll(purchaseServer.selectRcvReceiptLineVByInvIdAndStatusAndHeaderId(invList,status, headerId));
}
//去重 //去重
return rcvReceiptLineVList.stream().collect( return rcvReceiptLineVList.stream().collect(
Collectors.collectingAndThen(Collectors.toCollection( Collectors.collectingAndThen(Collectors.toCollection(
......
...@@ -19,23 +19,8 @@ import org.slf4j.Logger; ...@@ -19,23 +19,8 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import orthopedics.controller.error.ErrorEnum; import orthopedics.controller.error.ErrorEnum;
import orthopedics.controller.operation.SaleOrderProcessEnum; import orthopedics.controller.operation.SaleOrderProcessEnum;
import orthopedics.model.HrOrganization; import orthopedics.dao.WshParameterMapper;
import orthopedics.model.InvItem; import orthopedics.model.*;
import orthopedics.model.InvUnit;
import orthopedics.model.SalCustomer;
import orthopedics.model.SalOrderHeader;
import orthopedics.model.SalOrderHeaderV;
import orthopedics.model.SalOrderLine;
import orthopedics.model.SalOrderLineV;
import orthopedics.model.SalOrderType;
import orthopedics.model.SysAccessToken;
import orthopedics.model.SysOrgAccess;
import orthopedics.model.SysValueSetV;
import orthopedics.model.SalCustomerSite;
import orthopedics.model.SalParameter;
import orthopedics.model.SalSellerV;
import orthopedics.model.SysDocumentProcessLog;
import orthopedics.model.WshShipmentHeader;
import orthopedics.service.InventoryServer; import orthopedics.service.InventoryServer;
import orthopedics.service.OrganzitionServer; import orthopedics.service.OrganzitionServer;
import orthopedics.service.ProcessLogServer; import orthopedics.service.ProcessLogServer;
...@@ -406,7 +391,8 @@ public class SaleController { ...@@ -406,7 +391,8 @@ public class SaleController {
return responseResult.toJSONString(); return responseResult.toJSONString();
} }
@Autowired
private WshParameterMapper wshParameterMapper;
public String saleOrderHeaderCreateG(JSONObject requestJson) { public String saleOrderHeaderCreateG(JSONObject requestJson) {
logger.info(String.format("----销售订单信息创建接口----- requestJson %s", requestJson.toJSONString())); logger.info(String.format("----销售订单信息创建接口----- requestJson %s", requestJson.toJSONString()));
...@@ -511,7 +497,7 @@ public class SaleController { ...@@ -511,7 +497,7 @@ public class SaleController {
if (saleOrderLineArray != null) { if (saleOrderLineArray != null) {
//line_number 不能重复 //line_number 不能重复
List<String> lineNumberList = new ArrayList<>(); //List<String> lineNumberList = new ArrayList<>();
for (int i = 0; i < saleOrderLineArray.size(); i++) { for (int i = 0; i < saleOrderLineArray.size(); i++) {
JSONObject line = saleOrderLineArray.getJSONObject(i); JSONObject line = saleOrderLineArray.getJSONObject(i);
...@@ -523,14 +509,14 @@ public class SaleController { ...@@ -523,14 +509,14 @@ public class SaleController {
}); });
Double taxRate = line.getDouble("tax_rate"); Double taxRate = line.getDouble("tax_rate");
String lineNumber = line.getString("line_number"); // String lineNumber = line.getString("line_number");
if (lineNumberList.contains(lineNumber)) { // if (lineNumberList.contains(lineNumber) ) {
logger.info(String.format("line_number%s重复了", lineNumber)); // logger.info(String.format("line_number%s重复了", lineNumber));
return "line_number不能为"+lineNumber; // return "line_number不能为"+lineNumber;
} // }
else { // else {
lineNumberList.add(lineNumber); // lineNumberList.add(lineNumber);
} // }
String salePrice = StringUtil.valueOf(line.get("sale_price")); String salePrice = StringUtil.valueOf(line.get("sale_price"));
if (!StringUtil.isPrice(salePrice)) { if (!StringUtil.isPrice(salePrice)) {
logger.info(String.format("sale_price非价格形式", salePrice)); logger.info(String.format("sale_price非价格形式", salePrice));
...@@ -556,15 +542,16 @@ public class SaleController { ...@@ -556,15 +542,16 @@ public class SaleController {
if (StringUtil.notEmpty(unitCode)) { if (StringUtil.notEmpty(unitCode)) {
checkUnitCode(unitCode); checkUnitCode(unitCode);
} }
SalParameter salParameter = saleServer.selectParameterByOrgId(orgId); //SalParameter salParameter = saleServer.selectParameterByOrgId(orgId);
if (salParameter == null) { // List<WshParameter> wshParameters = wshParameterMapper.selectWshParamByOrg(orgId);
logger.info(String.format("orgCode%s找不到相应的parameter", data.getString("org_code"))); // if (wshParameters == null || wshParameters.size()<=0) {
return "org_code不能为"+data.getString("org_code"); // logger.info(String.format("orgCode%s找不到相应的parameter", data.getString("org_code")));
} // return "org_code不能为"+data.getString("org_code");
// }
String itemCode = line.getString("item_code"); String itemCode = line.getString("item_code");
InvItem invItem = inventoryServer.selectInvItemByItemCodeWithInvIdG(itemCode); InvItem invItem = inventoryServer.selectInvItemByItemCodeWithInvIdG(itemCode);
if (invItem == null) { if (invItem == null) {
logger.info(String.format("itemCode:%s和inv_id:%s找不到相应的inv_item", itemCode, salParameter.getSaleMasterInvId())); logger.info(String.format("itemCode:%s找不到相应的inv_item", itemCode));
return "itemCode不能为"+itemCode; return "itemCode不能为"+itemCode;
} }
String lineId = line.getString("lineId"); String lineId = line.getString("lineId");
...@@ -598,7 +585,7 @@ public class SaleController { ...@@ -598,7 +585,7 @@ public class SaleController {
salOrderLine.setItemCode(itemCode); salOrderLine.setItemCode(itemCode);
salOrderLine.setSalOrderHeaderId(headId); salOrderLine.setSalOrderHeaderId(headId);
salOrderLine.setOrderHeaderId(headId); salOrderLine.setOrderHeaderId(headId);
salOrderLine.setLineNumber(StringUtil.notEmpty(lineNumber) ? lineNumber : String.valueOf(i+1)); salOrderLine.setLineNumber(String.valueOf(i+1));
salOrderLine.setItemId(invItem.getId()); salOrderLine.setItemId(invItem.getId());
String itemName = line.getString("item_name"); String itemName = line.getString("item_name");
salOrderLine.setItemName(StringUtil.notEmpty(itemName) ? itemName : invItem.getItemName()); salOrderLine.setItemName(StringUtil.notEmpty(itemName) ? itemName : invItem.getItemName());
......
...@@ -79,8 +79,13 @@ int updateInvCountHeaderStatus(@Param("status") String status, @Param("id") Stri ...@@ -79,8 +79,13 @@ int updateInvCountHeaderStatus(@Param("status") String status, @Param("id") Stri
@ResultMap("invcountheader") @ResultMap("invcountheader")
public List<InvCountHeader> fingBySysOrgCode(@Param("sysOrgCode") String sysOrgCode); public List<InvCountHeader> fingBySysOrgCode(@Param("sysOrgCode") String sysOrgCode);
//根据sysOrgCode查询 //根据countNumber查询
@Select("select * from inv_count_header where count_number = #{countNumber}") @Select("select * from inv_count_header where count_number = #{countNumber}")
@ResultMap("invcountheader") @ResultMap("invcountheader")
public InvCountHeader fingByCountNumber(@Param("countNumber") String countNumber); public InvCountHeader fingByCountNumber(@Param("countNumber") String countNumber);
//根据header_status查询
@Select("select * from inv_count_header where header_status = #{status}")
@ResultMap("invcountheader")
public List<InvCountHeader> fingByHeaderStatus(@Param("status") String status);
} }
\ No newline at end of file
...@@ -68,8 +68,13 @@ Integer insert(InvCountPrint InvCountPrint); ...@@ -68,8 +68,13 @@ Integer insert(InvCountPrint InvCountPrint);
@ResultMap("invcountprint") @ResultMap("invcountprint")
List<InvCountPrint> findByOrgId(@Param("orgId")String orgId); List<InvCountPrint> findByOrgId(@Param("orgId")String orgId);
//通过组织id查询 //通过顺序号查询
@Select("SELECT * FROM inv_count_print WHERE print_number = #{printNumber} ") @Select("SELECT * FROM inv_count_print WHERE print_number = #{printNumber} ")
@ResultMap("invcountprint") @ResultMap("invcountprint")
InvCountPrint findByPrintNumber(@Param("printNumber")String printNumber); InvCountPrint findByPrintNumber(@Param("printNumber")String printNumber);
//通过库存id查询
@Select("SELECT * FROM inv_count_print WHERE print_inv_id = #{printInvId} ")
@ResultMap("invcountprint")
List<InvCountPrint> findByPrintInvId(@Param("printInvId")String printInvId);
} }
\ No newline at end of file
...@@ -126,6 +126,8 @@ public interface InvItemBalanceSummaryVMapper{ ...@@ -126,6 +126,8 @@ public interface InvItemBalanceSummaryVMapper{
@ResultMap("invitembalancesummaryv") @ResultMap("invitembalancesummaryv")
List<InvItemBalanceSummaryV> findByInvIdAndSubinvIdAndLocatorIdAndItemId(@Param("inv_id") String inv_id,@Param("subinv_id") String subinv_id,@Param("locator_id") String locator_id,@Param("item_id") String item_id); List<InvItemBalanceSummaryV> findByInvIdAndSubinvIdAndLocatorIdAndItemId(@Param("inv_id") String inv_id,@Param("subinv_id") String subinv_id,@Param("locator_id") String locator_id,@Param("item_id") String item_id);
@Select("SELECT * FROM inv_item_balance_summary_v WHERE inv_id=#{invId} AND (inv_code LIKE '%${request}%' OR inv_name LIKE '%${request}%' OR subinv_code LIKE '%${request}%' OR subinv_name LIKE '%${request}%' OR locator_code LIKE '%${request}%' OR locator_name LIKE '%${request}%' OR plucode LIKE '%${request}%' OR scancode LIKE '%${request}%' OR rfid LIKE '%${request}%' OR item_code LIKE '%${request}%' OR item_name LIKE '%${request}%')")
@ResultMap("invitembalancesummaryv")
List<InvItemBalanceSummaryV> findByInvIdAndLikeAll(@Param("invId") String invId,@Param("request") String request);
} }
\ No newline at end of file
...@@ -61,6 +61,7 @@ public interface InvItemMapper{ ...@@ -61,6 +61,7 @@ public interface InvItemMapper{
@Result(property = "rfid", column = "rfid"), @Result(property = "rfid", column = "rfid"),
@Result(property = "language", column = "language"), @Result(property = "language", column = "language"),
@Result(property = "marketingStatus", column = "marketing_status"), @Result(property = "marketingStatus", column = "marketing_status"),
@Result(property = "maxInvQty", column = "max_inv_qty"),
}) })
public List<InvItem> select(); public List<InvItem> select();
...@@ -78,16 +79,16 @@ public interface InvItemMapper{ ...@@ -78,16 +79,16 @@ public interface InvItemMapper{
InvItem selectByItemId(@Param("itemId") String itemId); InvItem selectByItemId(@Param("itemId") String itemId);
@Insert("<script>" + @Insert("<script>" +
"INSERT INTO inv_item(id,attribute_category,attribute1,attribute2,attribute3,attribute4,attribute5,attribute6,attribute7,attribute8,attribute9,attribute10,inv_id,item_code,item_name,item_desc,pystype,media,isbn,plucode,scancode,extcode,purchase_price,general_name,cip,manufacturer_id,specification,image_url,pack_qty,pack_unit,tax,isset,status,default_vendor_id,primary_unit,lot_control,serial_control,min_inv_qty,org_id,create_by,create_time,update_by,update_time,pro_type,is_borrow,rfid,language,marketing_status) VALUES" + "INSERT INTO inv_item(id,attribute_category,attribute1,attribute2,attribute3,attribute4,attribute5,attribute6,attribute7,attribute8,attribute9,attribute10,inv_id,item_code,item_name,item_desc,pystype,media,isbn,plucode,scancode,extcode,purchase_price,general_name,cip,manufacturer_id,specification,image_url,pack_qty,pack_unit,tax,isset,status,default_vendor_id,primary_unit,lot_control,serial_control,min_inv_qty,org_id,create_by,create_time,update_by,update_time,pro_type,is_borrow,rfid,language,marketing_status,max_inv_qty) VALUES" +
"<foreach collection='invitems' item='item' index='index' separator=','>" + "<foreach collection='invitems' item='item' index='index' separator=','>" +
"(#{item.id},#{item.attributeCategory},#{item.attribute1},#{item.attribute2},#{item.attribute3},#{item.attribute4},#{item.attribute5},#{item.attribute6},#{item.attribute7},#{item.attribute8},#{item.attribute9},#{item.attribute10},#{item.invId},#{item.itemCode},#{item.itemName},#{item.itemDesc},#{item.pystype},#{item.media},#{item.isbn},#{item.plucode},#{item.scancode},#{item.extcode},#{item.purchasePrice},#{item.generalName},#{item.cip},#{item.manufacturerId},#{item.specification},#{item.imageUrl},#{item.packQty},#{item.packUnit},#{item.tax},#{item.isset},#{item.status},#{item.defaultVendorId},#{item.primaryUnit},#{item.lotControl},#{item.serialControl},#{item.minInvQty},#{item.orgId},#{item.createBy},#{item.createTime},#{item.updateBy},#{item.updateTime},#{item.proType},#{item.isBorrow},#{item.rfid},#{item.language},#{item.marketingStatus})" + "(#{item.id},#{item.attributeCategory},#{item.attribute1},#{item.attribute2},#{item.attribute3},#{item.attribute4},#{item.attribute5},#{item.attribute6},#{item.attribute7},#{item.attribute8},#{item.attribute9},#{item.attribute10},#{item.invId},#{item.itemCode},#{item.itemName},#{item.itemDesc},#{item.pystype},#{item.media},#{item.isbn},#{item.plucode},#{item.scancode},#{item.extcode},#{item.purchasePrice},#{item.generalName},#{item.cip},#{item.manufacturerId},#{item.specification},#{item.imageUrl},#{item.packQty},#{item.packUnit},#{item.tax},#{item.isset},#{item.status},#{item.defaultVendorId},#{item.primaryUnit},#{item.lotControl},#{item.serialControl},#{item.minInvQty},#{item.orgId},#{item.createBy},#{item.createTime},#{item.updateBy},#{item.updateTime},#{item.proType},#{item.isBorrow},#{item.rfid},#{item.language},#{item.marketingStatus},#{item.maxInvQty})" +
"</foreach>" + "</foreach>" +
"</script>") "</script>")
Integer insertBatch(@Param("invitems")List<InvItem> InvItemList); Integer insertBatch(@Param("invitems")List<InvItem> InvItemList);
@Insert( @Insert(
"INSERT INTO inv_item(id,attribute_category,attribute1,attribute2,attribute3,attribute4,attribute5,attribute6,attribute7,attribute8,attribute9,attribute10,inv_id,item_code,item_name,item_desc,pystype,media,isbn,plucode,scancode,extcode,purchase_price,general_name,cip,manufacturer_id,specification,image_url,pack_qty,pack_unit,tax,isset,status,default_vendor_id,primary_unit,lot_control,serial_control,min_inv_qty,org_id,create_by,create_time,update_by,update_time,pro_type,is_borrow,rfid,language,marketing_status) VALUES" + "INSERT INTO inv_item(id,attribute_category,attribute1,attribute2,attribute3,attribute4,attribute5,attribute6,attribute7,attribute8,attribute9,attribute10,inv_id,item_code,item_name,item_desc,pystype,media,isbn,plucode,scancode,extcode,purchase_price,general_name,cip,manufacturer_id,specification,image_url,pack_qty,pack_unit,tax,isset,status,default_vendor_id,primary_unit,lot_control,serial_control,min_inv_qty,org_id,create_by,create_time,update_by,update_time,pro_type,is_borrow,rfid,language,marketing_status,max_inv_qty) VALUES" +
"(#{id},#{attributeCategory},#{attribute1},#{attribute2},#{attribute3},#{attribute4},#{attribute5},#{attribute6},#{attribute7},#{attribute8},#{attribute9},#{attribute10},#{invId},#{itemCode},#{itemName},#{itemDesc},#{pystype},#{media},#{isbn},#{plucode},#{scancode},#{extcode},#{purchasePrice},#{generalName},#{cip},#{manufacturerId},#{specification},#{imageUrl},#{packQty},#{packUnit},#{tax},#{isset},#{status},#{defaultVendorId},#{primaryUnit},#{lotControl},#{serialControl},#{minInvQty},#{orgId},#{createBy},#{createTime},#{updateBy},#{updateTime},#{proType},#{isBorrow},#{rfid},#{language},#{marketingStatus})" "(#{id},#{attributeCategory},#{attribute1},#{attribute2},#{attribute3},#{attribute4},#{attribute5},#{attribute6},#{attribute7},#{attribute8},#{attribute9},#{attribute10},#{invId},#{itemCode},#{itemName},#{itemDesc},#{pystype},#{media},#{isbn},#{plucode},#{scancode},#{extcode},#{purchasePrice},#{generalName},#{cip},#{manufacturerId},#{specification},#{imageUrl},#{packQty},#{packUnit},#{tax},#{isset},#{status},#{defaultVendorId},#{primaryUnit},#{lotControl},#{serialControl},#{minInvQty},#{orgId},#{createBy},#{createTime},#{updateBy},#{updateTime},#{proType},#{isBorrow},#{rfid},#{language},#{marketingStatus},#{maxInvQty})"
) )
Integer insert(InvItem InvItem); Integer insert(InvItem InvItem);
...@@ -139,4 +140,7 @@ public interface InvItemMapper{ ...@@ -139,4 +140,7 @@ public interface InvItemMapper{
@Select("SELECT * FROM inv_item WHERE plucode = #{plucode}") @Select("SELECT * FROM inv_item WHERE plucode = #{plucode}")
@ResultMap("invitem") @ResultMap("invitem")
InvItem findByPlucode(@Param("plucode") String plucode); InvItem findByPlucode(@Param("plucode") String plucode);
@Select("SELECT item_code FROM inv_item WHERE plucode = #{plucode}")
String getPlucode(@Param("plucode") String plucode);
} }
\ No newline at end of file
...@@ -75,4 +75,8 @@ public interface InvLocatorMapper{ ...@@ -75,4 +75,8 @@ public interface InvLocatorMapper{
@ResultMap("invlocator") @ResultMap("invlocator")
InvLocator findById(@Param("id")String id); InvLocator findById(@Param("id")String id);
@Select("select * from inv_locator where locator_code = #{locatorCode}")
@ResultMap("invlocator")
InvLocator findLocatorByCode(@Param("locatorCode")String locatorCode);
} }
\ No newline at end of file
...@@ -104,6 +104,19 @@ public List<RcvReceiptLineV> select(); ...@@ -104,6 +104,19 @@ public List<RcvReceiptLineV> select();
public List<RcvReceiptLineV> selectByInvIdAndStatusAndHeaderId public List<RcvReceiptLineV> selectByInvIdAndStatusAndHeaderId
(@Param("invIds")List<String> invIds, @Param("rcvReceiptLineStatus")String rcvReceiptLineStatus,@Param("headerId")String headerId); (@Param("invIds")List<String> invIds, @Param("rcvReceiptLineStatus")String rcvReceiptLineStatus,@Param("headerId")String headerId);
@Select("<script>"
+ "SELECT * FROM rcv_receipt_line_v WHERE 1=1 "
+ "<if test = 'rcvReceiptLineStatus != null and rcvReceiptLineStatus != \"\"'>"
+ " AND line_status = #{rcvReceiptLineStatus}"
+ "</if>"
+ "<if test = 'headerId != null and headerId != \"\"'>"
+ " AND rcv_receipt_header_id = #{headerId}"
+ "</if>"
+ "</script>")
@ResultMap("rcvreceiptlinev")
public List<RcvReceiptLineV> selectByInvIdAndStatusAndHeaderIdG
(@Param("rcvReceiptLineStatus")String rcvReceiptLineStatus,@Param("headerId")String headerId);
@Select("<script>" + @Select("<script>" +
"SELECT * FROM rcv_receipt_line_v rl " + "SELECT * FROM rcv_receipt_line_v rl " +
"LEFT JOIN sys_value_set_v vs " + "LEFT JOIN sys_value_set_v vs " +
......
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.SalOrderLineDetailV;
/**
* @author author
*/
public interface SalOrderLineDetailVMapper{
@Select("SELECT * FROM sal_order_line_detail_v")
@Results(id = "salorderlinedetailv", value ={
@Result(property = "orderTypeId", column = "order_type_id"),
@Result(property = "orderDate", column = "order_date"),
@Result(property = "orderNumber", column = "order_number"),
@Result(property = "customerId", column = "customer_id"),
@Result(property = "sellerId", column = "seller_id"),
@Result(property = "salStatus", column = "sal_status"),
@Result(property = "orgId", column = "org_id"),
@Result(property = "itemName", column = "item_name"),
@Result(property = "itemDesc", column = "item_desc"),
@Result(property = "quantity", column = "quantity"),
@Result(property = "unitCode", column = "unit_code"),
@Result(property = "salePrice", column = "sale_price"),
@Result(property = "taxRate", column = "tax_rate"),
@Result(property = "attribute1", column = "attribute1"),
@Result(property = "attribute2", column = "attribute2"),
@Result(property = "attribute3", column = "attribute3"),
@Result(property = "requiredDate", column = "required_date"),
@Result(property = "sumPrice", column = "sum_price"),
@Result(property = "shipmentType", column = "shipment_type"),
@Result(property = "shipmentNumber", column = "shipment_number"),
@Result(property = "shipmentDate", column = "shipment_date"),
@Result(property = "invId", column = "inv_id"),
@Result(property = "subinvId", column = "subinv_id"),
@Result(property = "locatorId", column = "locator_id"),
@Result(property = "shipmentQuantity", column = "shipment_quantity"),
})
public List<SalOrderLineDetailV> select();
@Insert("<script>" +
"INSERT INTO sal_order_line_detail_v(order_type_id,order_date,order_number,customer_id,seller_id,sal_status,org_id,item_name,item_desc,quantity,unit_code,sale_price,tax_rate,attribute1,attribute2,attribute3,required_date,sum_price,shipment_type,shipment_number,shipment_date,inv_id,subinv_id,locator_id,shipment_quantity) VALUES" +
"<foreach collection='salorderlinedetailvs' item='item' index='index' separator=','>" +
"(#{item.orderTypeId},#{item.orderDate},#{item.orderNumber},#{item.customerId},#{item.sellerId},#{item.salStatus},#{item.orgId},#{item.itemName},#{item.itemDesc},#{item.quantity},#{item.unitCode},#{item.salePrice},#{item.taxRate},#{item.attribute1},#{item.attribute2},#{item.attribute3},#{item.requiredDate},#{item.sumPrice},#{item.shipmentType},#{item.shipmentNumber},#{item.shipmentDate},#{item.invId},#{item.subinvId},#{item.locatorId},#{item.shipmentQuantity})" +
"</foreach>" +
"</script>")
Integer insertBatch(@Param("salorderlinedetailvs") List<SalOrderLineDetailV> SalOrderLineDetailVList);
@Insert(
"INSERT INTO sal_order_line_detail_v(order_type_id,order_date,order_number,customer_id,seller_id,sal_status,org_id,item_name,item_desc,quantity,unit_code,sale_price,tax_rate,attribute1,attribute2,attribute3,required_date,sum_price,shipment_type,shipment_number,shipment_date,inv_id,subinv_id,locator_id,shipment_quantity) VALUES" +
"(#{orderTypeId},#{orderDate},#{orderNumber},#{customerId},#{sellerId},#{salStatus},#{orgId},#{itemName},#{itemDesc},#{quantity},#{unitCode},#{salePrice},#{taxRate},#{attribute1},#{attribute2},#{attribute3},#{requiredDate},#{sumPrice},#{shipmentType},#{shipmentNumber},#{shipmentDate},#{invId},#{subinvId},#{locatorId},#{shipmentQuantity})"
)
Integer insert(SalOrderLineDetailV SalOrderLineDetailV);
@Select("SELECT * FROM sal_order_line_detail_v WHERE order_number = #{orderNumber}")
@ResultMap("salorderlinedetailv")
SalOrderLineDetailV findByOrderNumber(@Param("orderNumber") String orderNumber);
}
\ No newline at end of file
...@@ -66,7 +66,10 @@ Integer insert(TempItemFomPmp TempItemFomPmp); ...@@ -66,7 +66,10 @@ Integer insert(TempItemFomPmp TempItemFomPmp);
@Select("select count(temp_item_fom_pmp.`id`) from temp_item_fom_pmp") @Select("select count(temp_item_fom_pmp.`id`) from temp_item_fom_pmp")
Integer findCount(); Integer findCount();
@Select("SELECT * FROM temp_item_fom_pmp LIMIT ${sta},10000") @Select("SELECT * FROM temp_item_fom_pmp LIMIT ${sta},5000")
@ResultMap("tempitemfompmp") @ResultMap("tempitemfompmp")
public List<TempItemFomPmp> findLimit(@Param("sta") int sta); 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);
} }
\ No newline at end of file
...@@ -5,16 +5,13 @@ import java.util.HashMap; ...@@ -5,16 +5,13 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.List; import java.util.List;
import com.alibaba.fastjson.annotation.JSONField; import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
/** /**
* *
* @author ice * @author author
*/ */
public class InvItem implements Serializable { public class InvItem implements Serializable {
private static final long serialVersionUID = 1566298641844L; private static final long serialVersionUID = 1572260837783L;
/** /**
...@@ -33,43 +30,43 @@ public class InvItem implements Serializable { ...@@ -33,43 +30,43 @@ public class InvItem implements Serializable {
private String attributeCategory; private String attributeCategory;
/** /**
* 备用字段1 * 商品类型
* isNullAble:1 * isNullAble:0
*/ */
@JSONField(name = "attribute1") @JSONField(name = "attribute1")
private String attribute1; private String attribute1;
/** /**
* 备用字段2 * 采购类型
* isNullAble:1 * isNullAble:0
*/ */
@JSONField(name = "attribute2") @JSONField(name = "attribute2")
private String attribute2; private String attribute2;
/** /**
* 备用子段3 * 寄售
* isNullAble:1 * isNullAble:1
*/ */
@JSONField(name = "attribute3") @JSONField(name = "attribute3")
private String attribute3; private String attribute3;
/** /**
* 备用字段4 * 扣点%
* isNullAble:1 * isNullAble:1
*/ */
@JSONField(name = "attribute4") @JSONField(name = "attribute4")
private String attribute4; private String attribute4;
/** /**
* 备用字段5 * 库存信息同步到pmp
* isNullAble:1 * isNullAble:1
*/ */
@JSONField(name = "attribute5") @JSONField(name = "attribute5")
private String attribute5; private String attribute5;
/** /**
* 备用字段6 * 商品信息同步到是否pos
* isNullAble:1 * isNullAble:1,defaultVal:0
*/ */
@JSONField(name = "attribute6") @JSONField(name = "attribute6")
private String attribute6; private String attribute6;
...@@ -111,14 +108,14 @@ public class InvItem implements Serializable { ...@@ -111,14 +108,14 @@ public class InvItem implements Serializable {
/** /**
* 商品代码 * 商品代码
* isNullAble:0 * isNullAble:1
*/ */
@JSONField(name = "item_code") @JSONField(name = "item_code")
private String itemCode; private String itemCode;
/** /**
* 商品名称 * 商品名称
* isNullAble:1 * isNullAble:0
*/ */
@JSONField(name = "item_name") @JSONField(name = "item_name")
private String itemName; private String itemName;
...@@ -153,28 +150,28 @@ public class InvItem implements Serializable { ...@@ -153,28 +150,28 @@ public class InvItem implements Serializable {
/** /**
* 货号 * 货号
* isNullAble:0 * isNullAble:1
*/ */
@JSONField(name = "plucode") @JSONField(name = "plucode")
private String plucode; private String plucode;
/** /**
* 扫描码 * 扫描码
* isNullAble:0 * isNullAble:1
*/ */
@JSONField(name = "scancode") @JSONField(name = "scancode")
private String scancode; private String scancode;
/** /**
* 延长码 * 延长码
* isNullAble:1,defaultVal:3 * isNullAble:1,defaultVal:0
*/ */
@JSONField(name = "extcode") @JSONField(name = "extcode")
private String extcode; private String extcode;
/** /**
* 价格 * 价格
* isNullAble:1 * isNullAble:0
*/ */
@JSONField(name = "purchase_price") @JSONField(name = "purchase_price")
private String purchasePrice; private String purchasePrice;
...@@ -188,7 +185,7 @@ public class InvItem implements Serializable { ...@@ -188,7 +185,7 @@ public class InvItem implements Serializable {
/** /**
* CIP分类 * CIP分类
* isNullAble:0 * isNullAble:1
*/ */
@JSONField(name = "cip") @JSONField(name = "cip")
private String cip; private String cip;
...@@ -205,8 +202,6 @@ public class InvItem implements Serializable { ...@@ -205,8 +202,6 @@ public class InvItem implements Serializable {
* isNullAble:1 * isNullAble:1
*/ */
@JSONField(name = "specification") @JSONField(name = "specification")
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private java.time.LocalDateTime specification; private java.time.LocalDateTime specification;
/** /**
...@@ -260,21 +255,21 @@ public class InvItem implements Serializable { ...@@ -260,21 +255,21 @@ public class InvItem implements Serializable {
/** /**
* 单位 * 单位
* isNullAble:1 * isNullAble:0
*/ */
@JSONField(name = "primary_unit") @JSONField(name = "primary_unit")
private String primaryUnit; private String primaryUnit;
/** /**
* 批次控制 * 批次控制
* isNullAble:1 * isNullAble:1,defaultVal:N
*/ */
@JSONField(name = "lot_control") @JSONField(name = "lot_control")
private String lotControl; private String lotControl;
/** /**
* 序列控制 * 序列控制
* isNullAble:1 * isNullAble:1,defaultVal:N
*/ */
@JSONField(name = "serial_control") @JSONField(name = "serial_control")
private String serialControl; private String serialControl;
...@@ -305,8 +300,6 @@ public class InvItem implements Serializable { ...@@ -305,8 +300,6 @@ public class InvItem implements Serializable {
* isNullAble:1 * isNullAble:1
*/ */
@JSONField(name = "create_time") @JSONField(name = "create_time")
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private java.time.LocalDateTime createTime; private java.time.LocalDateTime createTime;
/** /**
...@@ -321,20 +314,18 @@ public class InvItem implements Serializable { ...@@ -321,20 +314,18 @@ public class InvItem implements Serializable {
* isNullAble:1 * isNullAble:1
*/ */
@JSONField(name = "update_time") @JSONField(name = "update_time")
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private java.time.LocalDateTime updateTime; private java.time.LocalDateTime updateTime;
/** /**
* 商品类型 * 商品分类
* isNullAble:0 * isNullAble:1
*/ */
@JSONField(name = "pro_type") @JSONField(name = "pro_type")
private String proType; private String proType;
/** /**
* 可借阅 * 可借阅
* isNullAble:1 * isNullAble:0
*/ */
@JSONField(name = "is_borrow") @JSONField(name = "is_borrow")
private String isBorrow; private String isBorrow;
...@@ -360,6 +351,13 @@ public class InvItem implements Serializable { ...@@ -360,6 +351,13 @@ public class InvItem implements Serializable {
@JSONField(name = "marketing_status") @JSONField(name = "marketing_status")
private String marketingStatus; private String marketingStatus;
/**
* 库存上限
* isNullAble:1
*/
@JSONField(name = "max_inv_qty")
private String maxInvQty;
public void setId(String id){this.id = id;} public void setId(String id){this.id = id;}
...@@ -552,6 +550,10 @@ public class InvItem implements Serializable { ...@@ -552,6 +550,10 @@ public class InvItem implements Serializable {
public void setMarketingStatus(String marketingStatus){this.marketingStatus = marketingStatus;} public void setMarketingStatus(String marketingStatus){this.marketingStatus = marketingStatus;}
public String getMarketingStatus(){return this.marketingStatus;} public String getMarketingStatus(){return this.marketingStatus;}
public void setMaxInvQty(String maxInvQty){this.maxInvQty = maxInvQty;}
public String getMaxInvQty(){return this.maxInvQty;}
@Override @Override
public String toString() { public String toString() {
return "InvItem{" + return "InvItem{" +
...@@ -603,6 +605,7 @@ public class InvItem implements Serializable { ...@@ -603,6 +605,7 @@ public class InvItem implements Serializable {
"rfid='" + rfid + '\'' + "rfid='" + rfid + '\'' +
"language='" + language + '\'' + "language='" + language + '\'' +
"marketingStatus='" + marketingStatus + '\'' + "marketingStatus='" + marketingStatus + '\'' +
"maxInvQty='" + maxInvQty + '\'' +
'}'; '}';
} }
......
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 SalOrderLineDetailV implements Serializable {
private static final long serialVersionUID = 1572232529131L;
/**
*
* isNullAble:1
*/
@JSONField(name = "order_type_id")
private String orderTypeId;
/**
* 订单日期
* isNullAble:1
*/
@JSONField(name = "order_date")
private java.time.LocalDateTime orderDate;
/**
* 订单编号
* isNullAble:0
*/
@JSONField(name = "order_number")
private String orderNumber;
/**
*
* isNullAble:1
*/
@JSONField(name = "customer_id")
private String customerId;
/**
*
* isNullAble:1
*/
@JSONField(name = "seller_id")
private String sellerId;
/**
* 订单状态
* isNullAble:1,defaultVal:new
*/
@JSONField(name = "sal_status")
private String salStatus;
/**
*
* isNullAble:1
*/
@JSONField(name = "org_id")
private String orgId;
/**
* 商品名称
* isNullAble:1
*/
@JSONField(name = "item_name")
private String itemName;
/**
* 商品简称
* isNullAble:1
*/
@JSONField(name = "item_desc")
private String itemDesc;
/**
* 数量
* isNullAble:1
*/
@JSONField(name = "quantity")
private Integer quantity;
/**
*
* isNullAble:1
*/
@JSONField(name = "unit_code")
private String unitCode;
/**
* 价格
* isNullAble:1
*/
@JSONField(name = "sale_price")
private Double salePrice;
/**
* 税率
* isNullAble:1
*/
@JSONField(name = "tax_rate")
private String taxRate;
/**
* 码洋
* isNullAble:1
*/
@JSONField(name = "attribute1")
private Double attribute1;
/**
* 金额
* isNullAble:1
*/
@JSONField(name = "attribute2")
private Double attribute2;
/**
* 折扣%
* isNullAble:1
*/
@JSONField(name = "attribute3")
private String attribute3;
/**
* 需求日期
* isNullAble:1
*/
@JSONField(name = "required_date")
private java.time.LocalDateTime requiredDate;
/**
*
* isNullAble:1
*/
@JSONField(name = "sum_price")
private String sumPrice;
/**
* 发运类型
* isNullAble:1
*/
@JSONField(name = "shipment_type")
private String shipmentType;
/**
* 发运单号
* isNullAble:1
*/
@JSONField(name = "shipment_number")
private String shipmentNumber;
/**
* 发运日期
* isNullAble:1
*/
@JSONField(name = "shipment_date")
private java.time.LocalDateTime shipmentDate;
/**
*
* isNullAble:1
*/
@JSONField(name = "inv_id")
private String invId;
/**
*
* isNullAble:1
*/
@JSONField(name = "subinv_id")
private String subinvId;
/**
*
* isNullAble:1
*/
@JSONField(name = "locator_id")
private String locatorId;
/**
* 数量
* isNullAble:1
*/
@JSONField(name = "shipment_quantity")
private Integer shipmentQuantity;
public void setOrderTypeId(String orderTypeId){this.orderTypeId = orderTypeId;}
public String getOrderTypeId(){return this.orderTypeId;}
public void setOrderDate(java.time.LocalDateTime orderDate){this.orderDate = orderDate;}
public java.time.LocalDateTime getOrderDate(){return this.orderDate;}
public void setOrderNumber(String orderNumber){this.orderNumber = orderNumber;}
public String getOrderNumber(){return this.orderNumber;}
public void setCustomerId(String customerId){this.customerId = customerId;}
public String getCustomerId(){return this.customerId;}
public void setSellerId(String sellerId){this.sellerId = sellerId;}
public String getSellerId(){return this.sellerId;}
public void setSalStatus(String salStatus){this.salStatus = salStatus;}
public String getSalStatus(){return this.salStatus;}
public void setOrgId(String orgId){this.orgId = orgId;}
public String getOrgId(){return this.orgId;}
public void setItemName(String itemName){this.itemName = itemName;}
public String getItemName(){return this.itemName;}
public void setItemDesc(String itemDesc){this.itemDesc = itemDesc;}
public String getItemDesc(){return this.itemDesc;}
public void setQuantity(Integer quantity){this.quantity = quantity;}
public Integer getQuantity(){return this.quantity;}
public void setUnitCode(String unitCode){this.unitCode = unitCode;}
public String getUnitCode(){return this.unitCode;}
public void setSalePrice(Double salePrice){this.salePrice = salePrice;}
public Double getSalePrice(){return this.salePrice;}
public void setTaxRate(String taxRate){this.taxRate = taxRate;}
public String getTaxRate(){return this.taxRate;}
public void setAttribute1(Double attribute1){this.attribute1 = attribute1;}
public Double getAttribute1(){return this.attribute1;}
public void setAttribute2(Double attribute2){this.attribute2 = attribute2;}
public Double getAttribute2(){return this.attribute2;}
public void setAttribute3(String attribute3){this.attribute3 = attribute3;}
public String getAttribute3(){return this.attribute3;}
public void setRequiredDate(java.time.LocalDateTime requiredDate){this.requiredDate = requiredDate;}
public java.time.LocalDateTime getRequiredDate(){return this.requiredDate;}
public void setSumPrice(String sumPrice){this.sumPrice = sumPrice;}
public String getSumPrice(){return this.sumPrice;}
public void setShipmentType(String shipmentType){this.shipmentType = shipmentType;}
public String getShipmentType(){return this.shipmentType;}
public void setShipmentNumber(String shipmentNumber){this.shipmentNumber = shipmentNumber;}
public String getShipmentNumber(){return this.shipmentNumber;}
public void setShipmentDate(java.time.LocalDateTime shipmentDate){this.shipmentDate = shipmentDate;}
public java.time.LocalDateTime getShipmentDate(){return this.shipmentDate;}
public void setInvId(String invId){this.invId = invId;}
public String getInvId(){return this.invId;}
public void setSubinvId(String subinvId){this.subinvId = subinvId;}
public String getSubinvId(){return this.subinvId;}
public void setLocatorId(String locatorId){this.locatorId = locatorId;}
public String getLocatorId(){return this.locatorId;}
public void setShipmentQuantity(Integer shipmentQuantity){this.shipmentQuantity = shipmentQuantity;}
public Integer getShipmentQuantity(){return this.shipmentQuantity;}
@Override
public String toString() {
return "SalOrderLineDetailV{" +
"orderTypeId='" + orderTypeId + '\'' +
"orderDate='" + orderDate + '\'' +
"orderNumber='" + orderNumber + '\'' +
"customerId='" + customerId + '\'' +
"sellerId='" + sellerId + '\'' +
"salStatus='" + salStatus + '\'' +
"orgId='" + orgId + '\'' +
"itemName='" + itemName + '\'' +
"itemDesc='" + itemDesc + '\'' +
"quantity='" + quantity + '\'' +
"unitCode='" + unitCode + '\'' +
"salePrice='" + salePrice + '\'' +
"taxRate='" + taxRate + '\'' +
"attribute1='" + attribute1 + '\'' +
"attribute2='" + attribute2 + '\'' +
"attribute3='" + attribute3 + '\'' +
"requiredDate='" + requiredDate + '\'' +
"sumPrice='" + sumPrice + '\'' +
"shipmentType='" + shipmentType + '\'' +
"shipmentNumber='" + shipmentNumber + '\'' +
"shipmentDate='" + shipmentDate + '\'' +
"invId='" + invId + '\'' +
"subinvId='" + subinvId + '\'' +
"locatorId='" + locatorId + '\'' +
"shipmentQuantity='" + shipmentQuantity + '\'' +
'}';
}
}
...@@ -116,6 +116,9 @@ public class PurchaseServer { ...@@ -116,6 +116,9 @@ public class PurchaseServer {
public List<RcvReceiptLineV> selectRcvReceiptLineVByInvIdAndStatusAndHeaderId(List<String> invIds, String rcvReceiptLineStatus, String headerId) { public List<RcvReceiptLineV> selectRcvReceiptLineVByInvIdAndStatusAndHeaderId(List<String> invIds, String rcvReceiptLineStatus, String headerId) {
return rcvReceiptLineVMapper.selectByInvIdAndStatusAndHeaderId(invIds, rcvReceiptLineStatus, headerId); return rcvReceiptLineVMapper.selectByInvIdAndStatusAndHeaderId(invIds, rcvReceiptLineStatus, headerId);
} }
public List<RcvReceiptLineV> selectRcvReceiptLineVByInvIdAndStatusAndHeaderIdG(String rcvReceiptLineStatus, String headerId) {
return rcvReceiptLineVMapper.selectByInvIdAndStatusAndHeaderIdG(rcvReceiptLineStatus, headerId);
}
public List<RcvReceiptLineV> selectRcvReceiptLineVByUserNameAndHeaderIdInStatusRange(String userName, String statusFrom, String statusTo, String headerId) { public List<RcvReceiptLineV> selectRcvReceiptLineVByUserNameAndHeaderIdInStatusRange(String userName, String statusFrom, String statusTo, String headerId) {
return rcvReceiptLineVMapper.selectByUserAndHeaderIdInStatusRange(userName, statusFrom, statusTo, headerId); return rcvReceiptLineVMapper.selectByUserAndHeaderIdInStatusRange(userName, statusFrom, statusTo, headerId);
......
package orthopedics.util;
import java.lang.management.ManagementFactory;
import java.net.InetAddress;
import java.net.NetworkInterface;
/**
* <p>名称:IdWorker.java</p>
* <p>描述:分布式自增长ID</p>
* <pre>
* Twitter的 Snowflake JAVA实现方案
* </pre>
* 核心代码为其IdWorker这个类实现,其原理结构如下,我分别用一个0表示一位,用—分割开部分的作用:
* 1||0---0000000000 0000000000 0000000000 0000000000 0 --- 00000 ---00000 ---000000000000
* 在上面的字符串中,第一位为未使用(实际上也可作为long的符号位),接下来的41位为毫秒级时间,
* 然后5位datacenter标识位,5位机器ID(并不算标识符,实际是为线程标识),
* 然后12位该毫秒内的当前毫秒内的计数,加起来刚好64位,为一个Long型。
* 这样的好处是,整体上按照时间自增排序,并且整个分布式系统内不会产生ID碰撞(由datacenter和机器ID作区分),
* 并且效率较高,经测试,snowflake每秒能够产生26万ID左右,完全满足需要。
* <p>
* 64位ID (42(毫秒)+5(机器ID)+5(业务编码)+12(重复累加))
*
* @author Polim
*/
public class IdWorker {
// 时间起始标记点,作为基准,一般取系统的最近时间(一旦确定不能变动)
private final static long twepoch = 1288834974657L;
// 机器标识位数
private final static long workerIdBits = 5L;
// 数据中心标识位数
private final static long datacenterIdBits = 5L;
// 机器ID最大值
private final static long maxWorkerId = -1L ^ (-1L << workerIdBits);
// 数据中心ID最大值
private final static long maxDatacenterId = -1L ^ (-1L << datacenterIdBits);
// 毫秒内自增位
private final static long sequenceBits = 12L;
// 机器ID偏左移12位
private final static long workerIdShift = sequenceBits;
// 数据中心ID左移17位
private final static long datacenterIdShift = sequenceBits + workerIdBits;
// 时间毫秒左移22位
private final static long timestampLeftShift = sequenceBits + workerIdBits + datacenterIdBits;
private final static long sequenceMask = -1L ^ (-1L << sequenceBits);
/* 上次生产id时间戳 */
private static long lastTimestamp = -1L;
// 0,并发控制
private long sequence = 0L;
private final long workerId;
// 数据标识id部分
private final long datacenterId;
public IdWorker(){
this.datacenterId = getDatacenterId(maxDatacenterId);
this.workerId = getMaxWorkerId(datacenterId, maxWorkerId);
}
/**
* @param workerId
* 工作机器ID
* @param datacenterId
* 序列号
*/
public IdWorker(long workerId, long datacenterId) {
if (workerId > maxWorkerId || workerId < 0) {
throw new IllegalArgumentException(String.format("worker Id can't be greater than %d or less than 0", maxWorkerId));
}
if (datacenterId > maxDatacenterId || datacenterId < 0) {
throw new IllegalArgumentException(String.format("datacenter Id can't be greater than %d or less than 0", maxDatacenterId));
}
this.workerId = workerId;
this.datacenterId = datacenterId;
}
/**
* 获取下一个ID
*
* @return
*/
public synchronized long nextId() {
long timestamp = timeGen();
if (timestamp < lastTimestamp) {
throw new RuntimeException(String.format("Clock moved backwards. Refusing to generate id for %d milliseconds", lastTimestamp - timestamp));
}
if (lastTimestamp == timestamp) {
// 当前毫秒内,则+1
sequence = (sequence + 1) & sequenceMask;
if (sequence == 0) {
// 当前毫秒内计数满了,则等待下一秒
timestamp = tilNextMillis(lastTimestamp);
}
} else {
sequence = 0L;
}
lastTimestamp = timestamp;
// ID偏移组合生成最终的ID,并返回ID
long nextId = ((timestamp - twepoch) << timestampLeftShift)
| (datacenterId << datacenterIdShift)
| (workerId << workerIdShift) | sequence;
return nextId;
}
private long tilNextMillis(final long lastTimestamp) {
long timestamp = this.timeGen();
while (timestamp <= lastTimestamp) {
timestamp = this.timeGen();
}
return timestamp;
}
private long timeGen() {
return System.currentTimeMillis();
}
/**
* <p>
* 获取 maxWorkerId
* </p>
*/
protected static long getMaxWorkerId(long datacenterId, long maxWorkerId) {
StringBuffer mpid = new StringBuffer();
mpid.append(datacenterId);
String name = ManagementFactory.getRuntimeMXBean().getName();
if (!name.isEmpty()) {
/*
* GET jvmPid
*/
mpid.append(name.split("@")[0]);
}
/*
* MAC + PID 的 hashcode 获取16个低位
*/
return (mpid.toString().hashCode() & 0xffff) % (maxWorkerId + 1);
}
/**
* <p>
* 数据标识id部分
* </p>
*/
protected static long getDatacenterId(long maxDatacenterId) {
long id = 0L;
try {
InetAddress ip = InetAddress.getLocalHost();
NetworkInterface network = NetworkInterface.getByInetAddress(ip);
if (network == null) {
id = 1L;
} else {
byte[] mac = network.getHardwareAddress();
id = ((0x000000FF & (long) mac[mac.length - 1])
| (0x0000FF00 & (((long) mac[mac.length - 2]) << 8))) >> 6;
id = id % (maxDatacenterId + 1);
}
} catch (Exception e) {
System.out.println(" getDatacenterId: " + e.getMessage());
}
return id;
}
}
...@@ -11,7 +11,10 @@ spring.messages.encoding=UTF-8 ...@@ -11,7 +11,10 @@ spring.messages.encoding=UTF-8
spring.datasource.driverClassName = com.mysql.jdbc.Driver 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://116.62.111.56:3306/bookcity?useUnicode=true&characterEncoding=utf-8&useSSL=false&allowMultiQueries=true
#书城正式服务器
#spring.datasource.url = jdbc:mysql://10.200.5.45:3306/bookcity?useUnicode=true&characterEncoding=utf-8&useSSL=false&allowMultiQueries=true
spring.datasource.username = root spring.datasource.username = root
spring.datasource.password = 123456 spring.datasource.password = 123456
......
package orthopedics.test; package orthopedics.test;
import orthopedics.util.HttpUtil; import orthopedics.util.HttpUtil;
import orthopedics.util.IdWorker;
import orthopedics.util.MD5Util; import orthopedics.util.MD5Util;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet;
import java.util.Map; import java.util.Map;
import java.util.Set;
public class Demo { public class Demo {
public static void main(String[] args) { public static void main(String[] args) {
System.err.println("789"); Set s=new HashSet();
if(1 % 10000 == 0){ IdWorker id=new IdWorker();
System.err.println("123"); for (long i=0;i<10000000;i++){
s.add(id.nextId());
} }
System.err.println(s.size());
} }
......
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