Merge remote-tracking branch 'origin/lets' into lets

This commit is contained in:
liuy 2024-09-14 10:01:42 +08:00
commit faa88f0683
12 changed files with 608 additions and 115 deletions

View File

@ -11,9 +11,7 @@ import com.hzya.frame.plugin.lets.constant.OverallConstant;
import com.hzya.frame.plugin.lets.constant.ProfilesActiveConstant;
import com.hzya.frame.plugin.lets.dao.IBdRdclDao;
import com.hzya.frame.plugin.lets.dao.IBdSetpartDao;
import com.hzya.frame.plugin.lets.entity.BdInvbasdocEntity;
import com.hzya.frame.plugin.lets.entity.BdInvmandocEntity;
import com.hzya.frame.plugin.lets.entity.BdSetpartEntity;
import com.hzya.frame.plugin.lets.entity.*;
import com.hzya.frame.plugin.lets.ofsvo.QueryOfsAdjustOrderRequestVO;
import com.hzya.frame.plugin.lets.ofsvo.QueryOfsStockinOrderRequestVO;
import com.hzya.frame.plugin.lets.u8cdto.GeneralBillVO_4ADto;
@ -44,6 +42,7 @@ import java.util.concurrent.locks.ReentrantLock;
/**
* OFS调整入库(组装入库)--->U8C组装订单
* 使用code模式太麻烦了转n手使用pk模式
*
*/
@ -240,6 +239,7 @@ public class AdjustInZZPluginInitializer extends PluginBaseEntity {
/**
* 过滤成功日志,收发类别非0106 组装入库 的过滤
* //订单号+sku过滤
*
* @return
*/
@ -253,17 +253,26 @@ public class AdjustInZZPluginInitializer extends PluginBaseEntity {
if(!"0106".equals(ofsAdjustOrders.get(0).getHeader().getU8ReceiptType())){
continue;
}
String rootAppPk = header.getCode();
boolean isExis = true;
IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity();
integrationTaskLivingDetailsEntity.setRootAppPk(rootAppPk);
integrationTaskLivingDetailsEntity.setNewState(ProfilesActiveConstant.LOG_STATUS_Y);
integrationTaskLivingDetailsEntity.setPluginId(getPluginId());
List<IntegrationTaskLivingDetailsEntity> integrationTaskLivingDetailsEntities = iIntegrationTaskLivingDetailsDao.query(integrationTaskLivingDetailsEntity);
if (integrationTaskLivingDetailsEntities == null || integrationTaskLivingDetailsEntities.size() == 0) {
isExis = false;
List<StockinOrderSearchResponse.StockinOrder.StockinB> filterStockinB=new ArrayList<>();
for (StockinOrderSearchResponse.StockinOrder.StockinB detail : stockinOrder.getDetails()) {
String rootAppPk = header.getCode()+"_"+detail.getSkuCode();
boolean isExis = true;
IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity();
integrationTaskLivingDetailsEntity.setRootAppPk(rootAppPk);
integrationTaskLivingDetailsEntity.setNewState(ProfilesActiveConstant.LOG_STATUS_Y);
integrationTaskLivingDetailsEntity.setPluginId(getPluginId());
List<IntegrationTaskLivingDetailsEntity> integrationTaskLivingDetailsEntities = iIntegrationTaskLivingDetailsDao.query(integrationTaskLivingDetailsEntity);
if (integrationTaskLivingDetailsEntities == null || integrationTaskLivingDetailsEntities.size() == 0) {
isExis = false;
}if (!isExis) {
filterStockinB.add(detail);
}
}
if (!isExis) {
if (filterStockinB.size() == 0) {//该单全被过滤
continue;
}else if(filterStockinB.size() != 0){
stockinOrder.setDetails(filterStockinB);
filterStockinOrders.add(stockinOrder);
}
}
@ -292,88 +301,154 @@ public class AdjustInZZPluginInitializer extends PluginBaseEntity {
SpecialbillVO.Parentvo parentvo = new SpecialbillVO.Parentvo();
//pk_corp 公司
parentvo.setPk_corp(ofsHeader.getCompanyCode());
BdCorpEntity bdCorpEntity = queryU8CEntityUtil.queryBdCorpByUnitCode(ofsHeader.getCompanyCode());
Assert.notNull(bdCorpEntity,"根据公司编码:{}未查询到公司主键请检查U8C公司档案",ofsHeader.getCompanyCode());
parentvo.setPk_corp(bdCorpEntity.getPkCorp());
//dbilldate 单据日期
format = ofsHeader.getCreated();
parentvo.setDbilldate(StringUtils.substring(format, 0, 10));
//coperatorid 制单人
parentvo.setCoperatorid("tbadmin");
parentvo.setCoperatorid(OverallConstant.getOverAllValue("u8cApiZdrPK"));
//cinwarehouseid 入库仓库(审批3.6及上版本支持)
parentvo.setCinwarehouseid(ofsHeader.getFacilityCode());
BdStordocEntity bdStordocEntity = queryU8CEntityUtil.queryBdStordocByCode(ofsHeader.getFacilityCode());
Assert.notNull(bdStordocEntity,"根据仓库编码:{}未查询到公司主键请检查U8C公司档案",ofsHeader.getCompanyCode());
parentvo.setCinwarehouseid(bdStordocEntity.getPkStordoc());
//vnote 备注
parentvo.setVnote(ofsHeader.getNote());
//vuserdef15,,组装单标识
parentvo.setVuserdef15("ZZ");
//vuserdef17来源系统
parentvo.setVuserdef17(ProfilesActiveConstant.sourceSystem1);
//vuserdef19,ofs调整单单号
parentvo.setVuserdef19(ofsHeader.getCode());
//vuserdef20,ofs调整单id
parentvo.setVuserdef20(ofsHeader.getId());
queryBdSetPart(null,null);
//子表
List<SpecialbillVO.Childrenvo> childrenvo =new ArrayList<>();
SpecialbillVO.Childrenvo children = new SpecialbillVO.Childrenvo();
int indexNum=0;//主数量套件数量
int i=1;//行号
//////////套件每个成套件变成一张组装单
for (StockinOrderSearchResponse.StockinOrder.StockinB detail : stockinOrder.getDetails()) {
try {
BdInvmandocEntity bdInvmandocEntity = queryBdInvmandocBySkuCodeAndPkcorp(detail.getSkuCode(), bdCorpEntity.getPkCorp());
SpecialbillVO.Childrenvo children = new SpecialbillVO.Childrenvo();
//行号
children.setCrowno(i++ + "0");
//fbillrowflag 类型0成套件1配件
children.setFbillrowflag("0");
//cinventoryid 存货存货管理档案
children.setCinventoryid(bdInvmandocEntity.getPkInvmandoc());
//dshldtransnum 数量
children.setDshldtransnum(detail.getRequestQty());
//cwarehouseid 仓库
children.setCwarehouseid(bdStordocEntity.getPkStordoc());
/////////////////////////////////////////////////////////////////////////////////////////////
//套件数量
indexNum = Integer.parseInt(detail.getRequestQty());
childrenvo.add(children);
//配件
List<BdSetpartEntity> bdSetpartEntities = queryBdSetPart(bdInvmandocEntity.getPkInvmandoc());
for (BdSetpartEntity bdSetpartEntity : bdSetpartEntities) {
SpecialbillVO.Childrenvo children1 = new SpecialbillVO.Childrenvo();
//行号
children1.setCrowno(i++ + "0");
//fbillrowflag 类型0成套件1配件
children1.setFbillrowflag("1");
//cinventoryid 存货存货管理档案
children1.setCinventoryid(bdSetpartEntity.getPkInvmandocpart());
//dshldtransnum 数量 套件数*配料表数
children1.setDshldtransnum(String.valueOf(indexNum*Integer.parseInt(bdSetpartEntity.getChildsnum())));
//cwarehouseid 仓库
children1.setCwarehouseid(bdStordocEntity.getPkStordoc());
childrenvo.add(children1);
}
specialbillVO.setParentvo(parentvo);
specialbillVO.setChildrenvo(childrenvo);
System.out.println(specialbillVO);
mapStr="{\"specialbillvo\": ["+JSONUtil.toJsonStr(specialbillVO)+"]}";
System.out.println(mapStr);
String dataJson = JSONUtil.toJsonStr(specialbillVO);
mapStr = "{\"specialbillvo\":[" + dataJson + "]}";
//推送
ZTResult ztResult = pushU8CByApiCode.pushByPK(OverallConstant.getOverAllValue("special4lSaveCode"), mapStr);
//两层判断,一层中台转发,一层u8c返回
if ("false".equals(ztResult.getFlag())) {
//转发失败
response = JSONUtil.toJsonStr(ztResult.getAttribute());
Assert.state(false, "丽知OFS调整入库(组装入库)--->U8C组装订单中台转发失败,失败原因:{}", ztResult.getAttribute());
}
Attribute attribute = ztResult.getAttribute();
System.out.println(attribute);
boolean isSuccess = false;
String vbillcode = "";
String cSpecialHId = "";
if ("success".equals(attribute.getStatus())) {
isSuccess = true;
String data = attribute.getData();
SpecialbillVO resSpecialbillVO = resultDataHandle(data);
System.out.println(resSpecialbillVO);
vbillcode = resSpecialbillVO.getParentvo().getVbillcode();
cSpecialHId = resSpecialbillVO.getParentvo().getCspecialhid();
}
if (!isSuccess) {
Assert.state(false, "推送U8C--> 丽知OFS调整入库(组装入库)--->U8C组装订单 失败 接口返回结果:{} 接口入参:{}", response, mapStr);
}
//推送
// ZTResult ztResult = pushU8CByApiCode.pushByCode(OverallConstant.getOverAllValue("special4lSaveCode"), mapStr);
//
// //两层判断,一层中台转发,一层u8c返回
// if ("false".equals(ztResult.getFlag())) {
// //转发失败
// response = JSONUtil.toJsonStr(ztResult.getAttribute());
// Assert.state(false, "丽知OFS调整入库(组装入库)--->U8C组装订单.中台转发失败,失败原因:{}", ztResult.getAttribute());
// }
// Attribute attribute = ztResult.getAttribute();
// System.out.println(attribute);
//
// boolean isSuccess = false;
// String vbillcode = "";
// if ("success".equals(attribute.getStatus())) {
// isSuccess = true;
// String data = attribute.getData();
// GeneralBillVO_4ADto resGeneralBillVO = resultDataHandle(data);
// System.out.println(resGeneralBillVO);
// vbillcode = resGeneralBillVO.getParentvo().getVbillcode();
// }
// if (!isSuccess) {
// Assert.state(false, "推送U8C--> 丽知OFS调整入库(组装入库)--->U8C组装订单 失败 接口返回结果:{} 接口入参:{}", response, mapStr);
// }
//成功
IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity();
integrationTaskLivingDetailsEntity.setNewState(ProfilesActiveConstant.LOG_STATUS_Y);
integrationTaskLivingDetailsEntity.setRootAppNewData(mapStr);
integrationTaskLivingDetailsEntity.setNewTransmitInfo(response);
integrationTaskLivingDetailsEntity.setNewPushDate(new Date());
integrationTaskLivingDetailsEntity.setBusinessDate(format);
integrationTaskLivingDetailsEntity.setRootAppPk(ofsCode+"_"+detail.getSkuCode());
integrationTaskLivingDetailsEntity.setRootAppBill(ofsCode);
integrationTaskLivingDetailsEntity.setNewSystemNumber(vbillcode);
integrationTaskLivingDetailsEntity.setNewSystemPrimary(cSpecialHId);
integrationTaskLivingDetailsEntity.setPluginId(getPluginId());
saveOrUpdateBusinessLogUtil.saveOrUpdate(integrationTaskLivingDetailsEntity);
//成功
// IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity();
// integrationTaskLivingDetailsEntity.setNewState(ProfilesActiveConstant.LOG_STATUS_Y);
// integrationTaskLivingDetailsEntity.setRootAppNewData(mapStr);
// integrationTaskLivingDetailsEntity.setNewTransmitInfo(response);
// integrationTaskLivingDetailsEntity.setNewPushDate(new Date());
// integrationTaskLivingDetailsEntity.setBusinessDate(format);
// integrationTaskLivingDetailsEntity.setRootAppPk(ofsCode);
// integrationTaskLivingDetailsEntity.setRootAppBill(ofsCode);
// integrationTaskLivingDetailsEntity.setRootAppBill(vbillcode);
// integrationTaskLivingDetailsEntity.setDef1(vbillcode);
// integrationTaskLivingDetailsEntity.setPluginId(getPluginId());
// saveOrUpdateBusinessLogUtil.saveOrUpdate(integrationTaskLivingDetailsEntity);
}catch (Exception e){//内层catch
e.printStackTrace();
logger.error("推送U8C丽知OFS调整入库(组装入库)--->U8C组装订单失败失败原因" + e);
//失败
ReusltStrDto reusltStrDto = JSON.parseObject(response, ReusltStrDto.class);
String ErrMessage = "推送U8C丽知OFS调整入库(组装入库)--->U8C组装订单失败失败原因" + reusltStrDto.getErrormsg();
IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity();
integrationTaskLivingDetailsEntity.setNewState(ProfilesActiveConstant.LOG_STATUS_N);
integrationTaskLivingDetailsEntity.setRootAppNewData(mapStr);
integrationTaskLivingDetailsEntity.setNewTransmitInfo(ErrMessage);
integrationTaskLivingDetailsEntity.setNewPushDate(new Date());
integrationTaskLivingDetailsEntity.setBusinessDate(format);
integrationTaskLivingDetailsEntity.setRootAppPk(ofsCode+"_"+detail.getSkuCode());
integrationTaskLivingDetailsEntity.setRootAppBill(ofsCode);
integrationTaskLivingDetailsEntity.setPluginId(getPluginId());
saveOrUpdateBusinessLogUtil.saveOrUpdate(integrationTaskLivingDetailsEntity);
} catch (Exception e) {
}
}
} catch (Exception e) {//外层catch 多个物料多条记录
e.printStackTrace();
// logger.error("推送U8C丽知OFS调整入库(组装入库)--->U8C组装订单失败失败原因" + e);
//
// ReusltStrDto reusltStrDto = JSON.parseObject(response, ReusltStrDto.class);
//
// String ErrMessage = "推送U8C丽知OFS调整入库(组装入库)--->U8C组装订单失败失败原因" + reusltStrDto.getErrormsg();
// //失败
// IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity();
// integrationTaskLivingDetailsEntity.setNewState(ProfilesActiveConstant.LOG_STATUS_N);
// integrationTaskLivingDetailsEntity.setRootAppNewData(mapStr);
// integrationTaskLivingDetailsEntity.setNewTransmitInfo(ErrMessage);
// integrationTaskLivingDetailsEntity.setNewPushDate(new Date());
// integrationTaskLivingDetailsEntity.setBusinessDate(format);
// integrationTaskLivingDetailsEntity.setRootAppPk(ofsCode);
// integrationTaskLivingDetailsEntity.setRootAppBill(ofsCode);
// integrationTaskLivingDetailsEntity.setPluginId(getPluginId());
// saveOrUpdateBusinessLogUtil.saveOrUpdate(integrationTaskLivingDetailsEntity);
logger.error("推送U8C丽知OFS调整入库(组装入库)--->U8C组装订单失败失败原因" + e);
String ErrMessage = "推送U8C丽知OFS调整入库(组装入库)--->U8C组装订单失败失败原因" + e.getMessage();
//失败
for (StockinOrderSearchResponse.StockinOrder.StockinB detail : stockinOrder.getDetails()) {
IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity();
integrationTaskLivingDetailsEntity.setNewState(ProfilesActiveConstant.LOG_STATUS_N);
integrationTaskLivingDetailsEntity.setRootAppNewData(mapStr);
integrationTaskLivingDetailsEntity.setNewTransmitInfo(ErrMessage);
integrationTaskLivingDetailsEntity.setNewPushDate(new Date());
integrationTaskLivingDetailsEntity.setBusinessDate(format);
integrationTaskLivingDetailsEntity.setRootAppPk(ofsCode+"_"+detail.getSkuCode());
integrationTaskLivingDetailsEntity.setRootAppBill(ofsCode);
integrationTaskLivingDetailsEntity.setPluginId(getPluginId());
saveOrUpdateBusinessLogUtil.saveOrUpdate(integrationTaskLivingDetailsEntity);
}
}
}
}
@ -414,13 +489,13 @@ public class AdjustInZZPluginInitializer extends PluginBaseEntity {
}
private GeneralBillVO_4ADto resultDataHandle(String resultData) {
private SpecialbillVO resultDataHandle(String resultData) {
try {
if (resultData != null && !"".equals(resultData)) {
if (resultData.contains("[")) {
resultData = resultData.substring(1, resultData.length() - 1);
}
return JSON.parseObject(resultData, GeneralBillVO_4ADto.class);
return JSON.parseObject(resultData, SpecialbillVO.class);
}
} catch (Exception e) {
e.printStackTrace();
@ -452,12 +527,9 @@ public class AdjustInZZPluginInitializer extends PluginBaseEntity {
/**
* 查询成套件信息,因为是调整入库只有套件信息
* @param skuCode ofs sku编码
* @param pkCorp 公司编码
* 套件 存货管理档案的主键
* 根据存货编码+公司主键查询查询货品管理档案
*/
public void queryBdSetPart(String skuCode,String pkCorp){
public BdInvmandocEntity queryBdInvmandocBySkuCodeAndPkcorp(String skuCode,String pkCorp){
//查询存货基本档案
BdInvbasdocEntity bdInvbasdocEntity = queryU8CEntityUtil.queryBdInvbasdocByCode(skuCode);
@ -470,15 +542,25 @@ public class AdjustInZZPluginInitializer extends PluginBaseEntity {
if (bdInvmandocEntity == null) {
Assert.state(false,"根据存货编码:{},存货基本档案主键:{},公司编码:{},查询存货管理档案失败,请检查是否分配。",skuCode,bdInvbasdocEntity.getPkInvbasdoc(),pkCorp);
}
return bdInvmandocEntity;
}
/**
* 查询成套件信息,因为是调整入库只有套件信息
* @param pkinvmandoc 套件存货管理档案
* 套件 存货管理档案的主键
* @return 配件的 存货管理档案
*/
public List<BdSetpartEntity> queryBdSetPart(String pkinvmandoc){
//查询配件信息
BdSetpartEntity bdSetpartEntity = new BdSetpartEntity();
bdSetpartEntity.setPkInvmandocpart(bdInvmandocEntity.getPkInvmandoc());
bdSetpartEntity.setPkInvmandocset(pkinvmandoc);
bdSetpartEntity.setDataSourceCode(ProfilesActiveConstant.LETS_DATE_SOURCE);
List<BdSetpartEntity> query = bdSetpartDao.query(bdSetpartEntity);
if(query.size()==0){
Assert.state(false,"OFS调整入库组装,查询");
}
return query;
}
}

View File

@ -0,0 +1,116 @@
package com.hzya.frame.plugin.lets.plugin.adjust;
import cn.hutool.core.lang.Assert;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.base.PluginBaseEntity;
import com.hzya.frame.plugin.lets.constant.ProfilesActiveConstant;
import com.hzya.frame.plugin.lets.dao.IIcGeneralHDao;
import com.hzya.frame.plugin.lets.util.PushDataByU8cUtil;
import com.hzya.frame.plugin.lets.util.SaveOrUpdateBusinessLogUtil;
import com.hzya.frame.plugin.lets.util.pushData.PushU8CByApiCode;
import com.hzya.frame.sysnew.integtationTaskLivingDetails.dao.IIntegrationTaskLivingDetailsDao;
import com.hzya.frame.sysnew.integtationTaskLivingDetails.entity.IntegrationTaskLivingDetailsEntity;
import com.hzya.frame.ttxofs.service.OfsUnifiedService;
import com.hzya.frame.web.entity.JsonResultEntity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.concurrent.locks.ReentrantLock;
/**
* 组装自动生成的其他入库单自动审核
*/
public class OtherInPluginInitializer extends PluginBaseEntity {
Logger logger = LoggerFactory.getLogger(OtherInPluginInitializer.class);
private static final ReentrantLock LOCK = new ReentrantLock(true);
@Override
public void initialize() {
logger.info(getPluginLabel() + "執行初始化方法initialize()");
}
@Override
public void destroy() {
logger.info(getPluginLabel() + "執行銷毀方法destroy()");
}
@Override
public String getPluginId() {
return "adjust.OtherInPluginInitializer";
}
@Override
public String getPluginName() {
return "丽知:其他入库单自动审核";
}
@Override
public String getPluginLabel() {
return "丽知:其他入库单自动审核";
}
@Autowired
private IIntegrationTaskLivingDetailsDao iIntegrationTaskLivingDetailsDao;
@Autowired
private PushDataByU8cUtil pushDataByU8cUtil;
@Autowired
private PushU8CByApiCode pushU8CByApiCode;
@Autowired
private SaveOrUpdateBusinessLogUtil saveOrUpdateBusinessLogUtil;
@Autowired
private OfsUnifiedService ofsUnifiedService;
@Autowired
private IIcGeneralHDao iIcGeneralHDao;
@Override
public String getPluginType() {
return "1";
}
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
try {
logger.info("调用:" + getPluginName() + "-插件");
String prod = "prod";
String param = String.valueOf(requestJson.get("param"));
if (requestJson != null && ProfilesActiveConstant.TYPE_DATE.equals(requestJson.get("type"))) {
//按日期
if (param != null && !"".equals(param)) {
String[] split = param.split("/");
if (!(split.length == 2)) {
Assert.state(false, "时间格式传递不正确");
}
Assert.notNull(split[0], "开始时间不能为空");
Assert.notNull(split[1], "结束时间不能为空");
start(split[0], split[1]);
}
} else if (requestJson != null && ProfilesActiveConstant.TYPE_VBILLCODE.equals(requestJson.get("type"))) {
//按单号
if (param != null && !"".equals(param)) {
start(param);
}
} else if (ProfilesActiveConstant.TYPE_DETAIL_ERROR.equals(requestJson.get("type"))) {
String integrationTaskLivingDetails = (String) requestJson.get("integration_task_living_details_id");
IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = saveOrUpdateBusinessLogUtil.queryIntegrationTaskLivingDetailsEntity(integrationTaskLivingDetails);
start(integrationTaskLivingDetailsEntity.getRootAppPk());
} else if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals(prod)) {
//默认
start();
}
} catch (Exception e) {
e.printStackTrace();
logger.error("executeBusiness方法抛出异常", e);
}
return null;
}
public void start(){
}
public void start(String vbillcode){
}
public void start(String startTime, String endTime){
}
}

View File

@ -0,0 +1,117 @@
package com.hzya.frame.plugin.lets.plugin.adjust;
import cn.hutool.core.lang.Assert;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.base.PluginBaseEntity;
import com.hzya.frame.plugin.lets.constant.ProfilesActiveConstant;
import com.hzya.frame.plugin.lets.dao.IIcGeneralHDao;
import com.hzya.frame.plugin.lets.util.PushDataByU8cUtil;
import com.hzya.frame.plugin.lets.util.SaveOrUpdateBusinessLogUtil;
import com.hzya.frame.plugin.lets.util.pushData.PushU8CByApiCode;
import com.hzya.frame.sysnew.integtationTaskLivingDetails.dao.IIntegrationTaskLivingDetailsDao;
import com.hzya.frame.sysnew.integtationTaskLivingDetails.entity.IntegrationTaskLivingDetailsEntity;
import com.hzya.frame.ttxofs.service.OfsUnifiedService;
import com.hzya.frame.web.entity.JsonResultEntity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.concurrent.locks.ReentrantLock;
/**
* 组装自动生成的其他出库单自动审核
*/
public class OtherOutPluginInitializer extends PluginBaseEntity {
Logger logger = LoggerFactory.getLogger(OtherOutPluginInitializer.class);
private static final ReentrantLock LOCK = new ReentrantLock(true);
@Override
public void initialize() {
logger.info(getPluginLabel() + "執行初始化方法initialize()");
}
@Override
public void destroy() {
logger.info(getPluginLabel() + "執行銷毀方法destroy()");
}
@Override
public String getPluginId() {
return "adjust.OtherOutPluginInitializer";
}
@Override
public String getPluginName() {
return "丽知:其他出库单自动审核";
}
@Override
public String getPluginLabel() {
return "丽知:其他出库单自动审核";
}
@Autowired
private IIntegrationTaskLivingDetailsDao iIntegrationTaskLivingDetailsDao;
@Autowired
private PushDataByU8cUtil pushDataByU8cUtil;
@Autowired
private PushU8CByApiCode pushU8CByApiCode;
@Autowired
private SaveOrUpdateBusinessLogUtil saveOrUpdateBusinessLogUtil;
@Autowired
private OfsUnifiedService ofsUnifiedService;
@Autowired
private IIcGeneralHDao iIcGeneralHDao;
@Override
public String getPluginType() {
return "1";
}
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
try {
logger.info("调用:" + getPluginName() + "-插件");
String prod = "prod";
String param = String.valueOf(requestJson.get("param"));
if (requestJson != null && ProfilesActiveConstant.TYPE_DATE.equals(requestJson.get("type"))) {
//按日期
if (param != null && !"".equals(param)) {
String[] split = param.split("/");
if (!(split.length == 2)) {
Assert.state(false, "时间格式传递不正确");
}
Assert.notNull(split[0], "开始时间不能为空");
Assert.notNull(split[1], "结束时间不能为空");
start(split[0], split[1]);
}
} else if (requestJson != null && ProfilesActiveConstant.TYPE_VBILLCODE.equals(requestJson.get("type"))) {
//按单号
if (param != null && !"".equals(param)) {
start(param);
}
} else if (ProfilesActiveConstant.TYPE_DETAIL_ERROR.equals(requestJson.get("type"))) {
String integrationTaskLivingDetails = (String) requestJson.get("integration_task_living_details_id");
IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = saveOrUpdateBusinessLogUtil.queryIntegrationTaskLivingDetailsEntity(integrationTaskLivingDetails);
start(integrationTaskLivingDetailsEntity.getRootAppPk());
} else if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals(prod)) {
//默认
start();
}
} catch (Exception e) {
e.printStackTrace();
logger.error("executeBusiness方法抛出异常", e);
}
return null;
}
public void start(){
}
public void start(String vbillcode){
}
public void start(String startTime, String endTime){
}
}

View File

@ -301,17 +301,17 @@ public class TransferInPluginInitializer extends PluginBaseEntity {
//pk_corp 公司
parentvo.setPk_corp(ofsTransferHeader.getCompanyCode());
//pk_defdoc19 自定义项19ofs调拨订单号
parentvo.setPk_defdoc19(ofsSourceOrderCode);
parentvo.setVuserdef19(ofsSourceOrderCode);
//U8C调拨订单信息
// List<ToBillEntity> toBillEntityList = queryToBillByPkVdefdoc19(ofsSourceOrderCode);
//U8C调拨出库单主表信息
List<IcGeneralHEntity> icGeneralHEntityList = queryIcGeneralHByPkVdefdoc19(ofsSourceOrderCode);
List<IcGeneralHEntity> icGeneralHEntityList = queryIcGeneralHByVdef19(ofsSourceOrderCode);
if (icGeneralHEntityList == null) {
Assert.state(false, "在U8C内根据OFS调拨订单号pk_vdefdoc19:{},没有查询到调拨出库单,请检查。", ofsSourceOrderCode);
Assert.state(false, "在U8C内根据OFS调拨订单号vdefdoc19:{},没有查询到调拨出库单,请检查。", ofsSourceOrderCode);
}
if (icGeneralHEntityList.size() > 1) {
Assert.state(false, "在U8C内根据OFS调拨订单号pk_vdefdoc19:{},查询到调拨出库单不唯一,请检查。", ofsSourceOrderCode);
Assert.state(false, "在U8C内根据OFS调拨订单号vdefdoc19:{},查询到调拨出库单不唯一,请检查。", ofsSourceOrderCode);
}
IcGeneralHEntity icGeneralHEntity = icGeneralHEntityList.get(0);
@ -339,11 +339,11 @@ public class TransferInPluginInitializer extends PluginBaseEntity {
for (IcGeneralBEntity icGeneralBEntity : icGeneralBEntityList) {
System.out.println(icGeneralBEntity);
//根据存货+行号匹配
if (ofsTransferDetail.getRefOrderDetailId().equals(icGeneralBEntity.getPkDefdoc20().trim()) && ofsTransferDetail.getSkuCode().equals(icGeneralBEntity.getCinvbascode())) {
if (ofsTransferDetail.getRefOrderDetailId().equals(icGeneralBEntity.getVuserdef20().trim()) && ofsTransferDetail.getSkuCode().equals(icGeneralBEntity.getCinvbascode())) {
//crowno 行号
childrenvo.setCrowno(i++ + "0");
//ofs来源单据行行号
childrenvo.setPk_defdoc20(ofsTransferDetail.getRefOrderDetailId());
childrenvo.setVuserdef20(ofsTransferDetail.getRefOrderDetailId());
//vsourcerowno 来源单据行号
childrenvo.setVsourcerowno(icGeneralBEntity.getCrowno());
break;
@ -506,10 +506,10 @@ public class TransferInPluginInitializer extends PluginBaseEntity {
/**
* 根据调拨出库单主表自定义项19ofs调拨订单号查询调拨出库单主表
*/
public List<IcGeneralHEntity> queryIcGeneralHByPkVdefdoc19(String pkDefdoc19) {
public List<IcGeneralHEntity> queryIcGeneralHByVdef19(String pkDefdoc19) {
IcGeneralHEntity icGeneralHEntity = new IcGeneralHEntity();
icGeneralHEntity.setDr(0);
icGeneralHEntity.setPkDefdoc19(pkDefdoc19);
icGeneralHEntity.setVuserdef19(pkDefdoc19);
icGeneralHEntity.setDataSourceCode(ProfilesActiveConstant.LETS_DATE_SOURCE);
List<IcGeneralHEntity> icGeneralHEntityList = icGeneralHDao.query(icGeneralHEntity);
if (icGeneralHEntityList == null || icGeneralHEntityList.size() == 0) {

View File

@ -320,17 +320,17 @@ public class TransferOutPluginInitializer extends PluginBaseEntity {
//vnote 备注
parentvo.setVnote(ofsTranseferOrder.getHeader().getNotes());
// //pk_defdoc1 ofs调出店铺
// //pk_defdoc1 ofs调出店铺
parentvo.setPk_defdoc1(ofsTranseferOrder.getHeader().getStoreCode());
// //pk_defdoc4 ofs调入店铺
// //pk_defdoc4 ofs调入店铺
parentvo.setPk_defdoc4(ofsTranseferOrder.getHeader().getToStoreCode());
//pk_defdoc17 来源系统
parentvo.setPk_defdoc17(ProfilesActiveConstant.sourceSystem1);
//vuserdef17 来源系统
parentvo.setVdef17(ProfilesActiveConstant.sourceSystem1);
//pk_defdoc19 OFS调拨订单号
parentvo.setPk_defdoc19(ofsTranseferOrder.getHeader().getCode());
//pk_defdoc20 OFS调拨订单 id
parentvo.setPk_defdoc20(ofsTranseferOrder.getHeader().getId());
//vuserdef19 OFS调拨订单号
parentvo.setVdef19(ofsTranseferOrder.getHeader().getCode());
//vuserdef20 OFS调拨订单 id
parentvo.setVdef20(ofsTranseferOrder.getHeader().getId());
//子表
List<OFSTranseferOrderSearchResponse.OFSTranseferOrder.OFSTranseferB> ofsDetails = ofsTranseferOrder.getDetails();
@ -345,23 +345,19 @@ public class TransferOutPluginInitializer extends PluginBaseEntity {
children.setNnum(BigDecimal.valueOf(Long.parseLong(ofsDetail.getShipQty())));
childrenvo.add(children);
//ofs行id
children.setPk_defdoc20(ofsDetail.getId());
// children.setPk_defdoc20(ofsDetail.getId());
children.setVbdef20(ofsDetail.getId());
//nprice 单价取上一次结账的单价 nmny金额 nnotaxmny无税金额 nnotaxprice 无税单价
//nprice 单价(含税单价)取上一次结账的单价 nmny金额 nnotaxmny无税金额 nnotaxprice 无税单价
IaMonthledgerEntity iaMonthledgerEntity = queryIaMonthledger(ofsDetail, ofsTranseferOrder.getHeader().getCompanyCode());
System.out.println(iaMonthledgerEntity);
if(iaMonthledgerEntity==null){
// children.setNprice("0");
children.setNmny("0");
children.setNprice("0");
}else {
// children.setNprice(iaMonthledgerEntity.getNabprice());
children.setNmny(iaMonthledgerEntity.getNabprice());
children.setNprice(iaMonthledgerEntity.getNabprice());
}
//ntaxrate 税率
children.setNtaxrate("13");
}
billVO.setParentvo(parentvo);
billVO.setChildrenvo(childrenvo);

View File

@ -55,9 +55,26 @@ public class BillVO {
private String ts;//ts
private String vcode;//单据号
private String vnote;//备注
private String vdef15;//自定义项15旺店通订单号
private String vdef1;
private String vdef2;
private String vdef3;
private String vdef4;
private String vdef5;
private String vdef6;
private String vdef7;
private String vdef8;
private String vdef9;
private String vdef10;
private String vdef11;
private String vdef12;
private String vdef13;
private String vdef14;
private String vdef15;
private String vdef16;
private String vdef17;
private String vdef18;
private String vdef19;
private String vdef20;
}

View File

@ -74,6 +74,27 @@ public class GeneralBillVO {
private String pk_defdoc7;
private String pk_defdoc8;
private String pk_defdoc9;
private String vuserdef1;
private String vuserdef10;
private String vuserdef11;
private String vuserdef12;
private String vuserdef13;
private String vuserdef14;
private String vuserdef15;
private String vuserdef16;
private String vuserdef17;
private String vuserdef18;
private String vuserdef19;
private String vuserdef2;
private String vuserdef20;
private String vuserdef3;
private String vuserdef4;
private String vuserdef5;
private String vuserdef6;
private String vuserdef7;
private String vuserdef8;
private String vuserdef9;
}
@Data
@ -135,6 +156,27 @@ public class GeneralBillVO {
*/
private String pk_defdoc20;
private String vuserdef1;
private String vuserdef10;
private String vuserdef11;
private String vuserdef12;
private String vuserdef13;
private String vuserdef14;
private String vuserdef15;
private String vuserdef16;
private String vuserdef17;
private String vuserdef18;
private String vuserdef19;
private String vuserdef2;
private String vuserdef20;
private String vuserdef3;
private String vuserdef4;
private String vuserdef5;
private String vuserdef6;
private String vuserdef7;
private String vuserdef8;
private String vuserdef9;
}
}

View File

@ -0,0 +1,31 @@
package com.hzya.frame.plugin.lets.u8cdto;
import lombok.Data;
/**
* 其他出入库VO签字取消签字
*/
@Data
public class IcGeneralAuditVO {
private QueryInfo queryInfo;
private SignInfo signInfo;
@Data
public static class QueryInfo{
private String billcode;//单据号
private String calbody;//库存组织
private String corp;//公司
private String date_begin;//起始日期
private String date_end;//结束日期
private String inventory;//存货
private String maker;//制单人
private String warehouse;//仓库
}
@Data
public static class SignInfo{
private String coperator;//登陆人
private String date_sign;//签字日期
private String date_unsign;//取消签字日期
}
}

View File

@ -4,9 +4,11 @@ import com.hzya.frame.plugin.lets.constant.ProfilesActiveConstant;
import com.hzya.frame.plugin.lets.dao.IBdCorpDao;
import com.hzya.frame.plugin.lets.dao.IBdInvbasdocDao;
import com.hzya.frame.plugin.lets.dao.IBdInvmandocDao;
import com.hzya.frame.plugin.lets.dao.IBdStordocDao;
import com.hzya.frame.plugin.lets.entity.BdCorpEntity;
import com.hzya.frame.plugin.lets.entity.BdInvbasdocEntity;
import com.hzya.frame.plugin.lets.entity.BdInvmandocEntity;
import com.hzya.frame.plugin.lets.entity.BdStordocEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@ -38,6 +40,7 @@ public class QueryU8CEntityUtil {
*/
public BdCorpEntity queryBdCorpByUnitCode(String unitCode) {
BdCorpEntity entity = new BdCorpEntity();
entity.setDr(0);
entity.setUnitcode(unitCode);
entity.setDataSourceCode(ProfilesActiveConstant.LETS_DATE_SOURCE);
List<BdCorpEntity> query = iBdCorpDao.query(entity);
@ -53,6 +56,7 @@ public class QueryU8CEntityUtil {
*/
public BdCorpEntity queryBdCorpByPkCorp(String pkCorp) {
BdCorpEntity entity = new BdCorpEntity();
entity.setDr(0);
entity.setPkCorp(pkCorp);
entity.setDataSourceCode(ProfilesActiveConstant.LETS_DATE_SOURCE);
List<BdCorpEntity> query = iBdCorpDao.query(entity);
@ -64,6 +68,82 @@ public class QueryU8CEntityUtil {
}
////////////////////////////////////////////////////////////////////////////////////////公司
////////////////////////////////////////////////////////////////////////////////////////仓库
@Autowired
private IBdStordocDao iBdStordocDao;
/**
* 根据仓库编码查询仓库
* @param storCode
* @return
*/
public BdStordocEntity queryBdStordocByCode(String storCode){
BdStordocEntity entity = new BdStordocEntity();
entity.setDr(0L);
entity.setStorcode(storCode);
entity.setDataSourceCode(ProfilesActiveConstant.LETS_DATE_SOURCE);
List<BdStordocEntity> query = iBdStordocDao.query(entity);
if (query.size() >= 1) {
return query.get(0);
} else {
return null;
}
}
/**
* 根据仓库主键查询仓库
* @param pkStordoc
* @return
*/
public BdStordocEntity queryBdStordocByPk(String pkStordoc){
BdStordocEntity entity = new BdStordocEntity();
entity.setDr(0L);
entity.setPkStordoc(pkStordoc);
entity.setDataSourceCode(ProfilesActiveConstant.LETS_DATE_SOURCE);
List<BdStordocEntity> query = iBdStordocDao.query(entity);
if (query.size() >= 1) {
return query.get(0);
} else {
return null;
}
}
/**
* 根据仓库名称查询仓库
* @param StorName
* @return
*/
public BdStordocEntity queryBdStordocByNamek(String StorName){
BdStordocEntity entity = new BdStordocEntity();
entity.setDr(0L);
entity.setStorname(StorName);
entity.setDataSourceCode(ProfilesActiveConstant.LETS_DATE_SOURCE);
List<BdStordocEntity> query = iBdStordocDao.query(entity);
if (query.size() >= 1) {
return query.get(0);
} else {
return null;
}
}
/**
* 根据仓库编码+公司编码查询仓库
* @param storCode
* @param pkCorp
* @return
*/
public BdStordocEntity queryBdStordocByCodeAndPkCorp(String storCode,String pkCorp){
BdStordocEntity entity = new BdStordocEntity();
entity.setDr(0L);
entity.setStorcode(storCode);
entity.setPkCorp(pkCorp);
entity.setDataSourceCode(ProfilesActiveConstant.LETS_DATE_SOURCE);
List<BdStordocEntity> query = iBdStordocDao.query(entity);
if (query.size() >= 1) {
return query.get(0);
} else {
return null;
}
}
////////////////////////////////////////////////////////////////////////////////////////仓库
////////////////////////////////////////////////////////////////////////////////////////存货基本档案
@Autowired
private IBdInvbasdocDao iBdInvbasdocDao;

View File

@ -25,6 +25,8 @@
<!--调整-->
<bean name="adjustInPluginInitializer" class="com.hzya.frame.plugin.lets.plugin.adjust.AdjustInPluginInitializer"/>
<bean name="adjustOutPluginInitializer" class="com.hzya.frame.plugin.lets.plugin.adjust.AdjustOutPluginInitializer"/>
<bean name="otherOutPluginInitializer" class="com.hzya.frame.plugin.lets.plugin.adjust.OtherOutPluginInitializer"/>
<bean name="otherInPluginInitializer" class="com.hzya.frame.plugin.lets.plugin.adjust.OtherInPluginInitializer"/>
<bean name="soSaleOutPluginInitializerToB" class="com.hzya.frame.plugin.lets.plugin.sales.SoSaleOutPluginInitializerToB"/>
<bean name="soSaleReturnPluginInitializerToB" class="com.hzya.frame.plugin.lets.plugin.sales.SoSaleReturnPluginInitializerToB"/>

View File

@ -48,7 +48,7 @@ public class BaseTest {
}
@Test
public void t11(){
goodsAutoAllotPluginInitializer.start("2024-09-10","2024-09-10");
goodsAutoAllotPluginInitializer.start("2022-09-10","2024-09-13");
}
////////////////////////////////////////////////////////////////////////////////////SKU分类
@Test

View File

@ -2,6 +2,7 @@ package com.hzya.frame.plugin.lets.plugin.transfer;
import com.hzya.frame.WebappApplication;
import com.hzya.frame.plugin.lets.plugin.adjust.AdjustInPluginInitializer;
import com.hzya.frame.plugin.lets.plugin.adjust.AdjustInZZPluginInitializer;
import com.hzya.frame.plugin.lets.plugin.adjust.AdjustOutPluginInitializer;
import org.junit.Test;
import org.junit.runner.RunWith;
@ -23,6 +24,8 @@ public class TransferTest {
private AdjustInPluginInitializer adjustInPluginInitializer;
@Autowired
private AdjustOutPluginInitializer adjustOutPluginInitializer;
@Autowired
private AdjustInZZPluginInitializer adjustInZZPluginInitializerm;
////////////////////////////////////////////////////////////////////////////////////调拨订单
// @Test
@ -59,7 +62,7 @@ public class TransferTest {
}
@Test
public void t21(){
transferInPluginInitializer.start("LETS-RE2024091100000001");
transferInPluginInitializer.start("LETS-RE2024090400000004");
}
@ -99,4 +102,11 @@ public class TransferTest {
adjustOutPluginInitializer.queryOfsAdjustOrders("LETS-AH2024082200000001");
}
////////////////////////////////////////////////////////////////////////////////////组装单
@Test
public void t50(){
adjustInZZPluginInitializerm.start("LETS-RE2024091200000002");
}
////////////////////////////////////////////////////////////////////////////////////组装单
}