丽知:修改存货基本档案新增、封存。
This commit is contained in:
parent
149b43bdd0
commit
01a7b2a473
|
@ -113,6 +113,17 @@ public class BdInvbasdocEntity extends BaseEntity {
|
|||
*/
|
||||
private String createtime_end_time;
|
||||
|
||||
/**
|
||||
* createtime开始时间
|
||||
*/
|
||||
private String modifytime_start_time;
|
||||
|
||||
/**
|
||||
* createtime结束时间
|
||||
*/
|
||||
private String modifytime_end_time;
|
||||
|
||||
|
||||
/**
|
||||
* 管理档案公司主键
|
||||
*/
|
||||
|
@ -142,6 +153,22 @@ public class BdInvbasdocEntity extends BaseEntity {
|
|||
this.createtime_end_time = createtime_end_time;
|
||||
}
|
||||
|
||||
public String getModifytime_start_time() {
|
||||
return modifytime_start_time;
|
||||
}
|
||||
|
||||
public void setModifytime_start_time(String modifytime_start_time) {
|
||||
this.modifytime_start_time = modifytime_start_time;
|
||||
}
|
||||
|
||||
public String getModifytime_end_time() {
|
||||
return modifytime_end_time;
|
||||
}
|
||||
|
||||
public void setModifytime_end_time(String modifytime_end_time) {
|
||||
this.modifytime_end_time = modifytime_end_time;
|
||||
}
|
||||
|
||||
public String getPk_corp() {
|
||||
return pk_corp;
|
||||
}
|
||||
|
|
|
@ -259,6 +259,10 @@
|
|||
|
||||
<if test="createtime_start_time!=null and createtime_start_time!=''">and createtime >= #{createtime_start_time}</if>
|
||||
<if test="createtime_end_time!=null and createtime_end_time!=''">and createtime <= #{createtime_end_time}</if>
|
||||
|
||||
<if test="modifytime_start_time!=null and modifytime_start_time!=''">and ts >= #{modifytime_start_time}</if>
|
||||
<if test="modifytime_end_time!=null and modifytime_end_time!=''">and ts <= #{modifytime_end_time}</if>
|
||||
and dr=0
|
||||
</trim>
|
||||
<if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
|
||||
</select>
|
||||
|
|
|
@ -97,8 +97,8 @@ public class GoodsAutoAllotPluginInitializer extends PluginBaseEntity {
|
|||
String endTimeStr = DateUtil.format(endTime, "yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
BdInvbasdocEntity bdInvbasdocEntity = new BdInvbasdocEntity();
|
||||
bdInvbasdocEntity.setCreatetime_start_time(startTimeStr);
|
||||
bdInvbasdocEntity.setCreatetime_end_time(endTimeStr);
|
||||
bdInvbasdocEntity.setModifytime_start_time(startTimeStr);
|
||||
bdInvbasdocEntity.setModifytime_end_time(endTimeStr);
|
||||
bdInvbasdocEntity.setDataSourceCode(ProfilesActiveConstant.LETS_DATE_SOURCE);
|
||||
|
||||
List<BdInvbasdocEntity> bdInvbasdocEntityList = bdInvbasdocDao.query(bdInvbasdocEntity);
|
||||
|
@ -158,8 +158,8 @@ public class GoodsAutoAllotPluginInitializer extends PluginBaseEntity {
|
|||
String end = DateUtil.format(business_end, "yyyy-MM-dd") + " 23:59:59";
|
||||
|
||||
BdInvbasdocEntity bdInvbasdocEntity = new BdInvbasdocEntity();
|
||||
bdInvbasdocEntity.setCreatetime_start_time(start);
|
||||
bdInvbasdocEntity.setCreatetime_end_time(end);
|
||||
bdInvbasdocEntity.setModifytime_start_time(start);
|
||||
bdInvbasdocEntity.setModifytime_end_time(end);
|
||||
bdInvbasdocEntity.setDataSourceCode(ProfilesActiveConstant.LETS_DATE_SOURCE);
|
||||
List<BdInvbasdocEntity> bdInvbasdocEntityList = bdInvbasdocDao.query(bdInvbasdocEntity);
|
||||
if (bdInvbasdocEntityList.size() == 0) {
|
||||
|
|
|
@ -473,6 +473,7 @@ public class SKUPluginInitializer extends PluginBaseEntity {
|
|||
InterfaceParamByU8CApiDto interfaceParamDto = new InterfaceParamByU8CApiDto();
|
||||
interfaceParamDto.setApi("ofs.sku.search");
|
||||
queryOfsSKURequestVO.setClientCode("LETS");
|
||||
queryOfsSKURequestVO.setStatus("1");
|
||||
queryOfsSKURequestVO.setPageNo(String.valueOf(pageNo));
|
||||
queryOfsSKURequestVO.setPageSize(String.valueOf(pageSize));
|
||||
interfaceParamDto.setData(JSON.toJSONString(queryOfsSKURequestVO));
|
||||
|
|
|
@ -15,6 +15,7 @@ import com.hzya.frame.plugin.lets.ofsvo.QueryOfsSKURequestVO;
|
|||
import com.hzya.frame.plugin.lets.u8cdto.InvBasDocVO;
|
||||
import com.hzya.frame.plugin.lets.u8cdto.ReusltStrDto;
|
||||
import com.hzya.frame.plugin.lets.util.PushDataByU8cUtil;
|
||||
import com.hzya.frame.plugin.lets.util.QueryU8CEntityUtil;
|
||||
import com.hzya.frame.plugin.lets.util.SaveOrUpdateBusinessLogUtil;
|
||||
import com.hzya.frame.plugin.lets.util.pushData.Attribute;
|
||||
import com.hzya.frame.plugin.lets.util.pushData.PushU8CByApiCode;
|
||||
|
@ -36,6 +37,7 @@ import java.util.stream.Collectors;
|
|||
/**
|
||||
* OFS->U8C货品档案 封存、解封
|
||||
* add by zyd 20240902
|
||||
* 不过滤状态,根据状态判断
|
||||
*/
|
||||
public class SKUSealPluginInitializer extends PluginBaseEntity {
|
||||
|
||||
|
@ -87,6 +89,8 @@ public class SKUSealPluginInitializer extends PluginBaseEntity {
|
|||
|
||||
@Autowired
|
||||
private IBdInvbasdocDao bdInvbasdocDao;
|
||||
@Autowired
|
||||
private QueryU8CEntityUtil queryU8CEntityUtil;
|
||||
|
||||
@Override
|
||||
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
|
||||
|
@ -142,19 +146,14 @@ public class SKUSealPluginInitializer extends PluginBaseEntity {
|
|||
queryOfsSKURequestVO.setLastUpdated_start(startTimeStr);
|
||||
queryOfsSKURequestVO.setLastUpdated_end(endTimeStr);
|
||||
List<OFSSKUSearchResponse.OFSSKU> ofsskuList = queryOfsSKUs(queryOfsSKURequestVO);
|
||||
if(ofsskuList.size()==0){
|
||||
return;
|
||||
if (ofsskuList.size() == 0) {
|
||||
return;
|
||||
}
|
||||
// //分组排序,
|
||||
// List<OFSSKUSearchResponse.OFSSKU> sortSkuList = groupAndSort(ofsskuList);
|
||||
//
|
||||
// //过滤日志
|
||||
// List<OFSSKUSearchResponse.OFSSKU> filterSkus = filterData(sortSkuList);
|
||||
// if(filterSkus.size()==0){
|
||||
// return;
|
||||
// }
|
||||
// //具体实现
|
||||
// implement(filterSkus);
|
||||
//找到最后修改时间的,进行过滤
|
||||
|
||||
//查询物料的所有公司,根据物料分组
|
||||
|
||||
//推送
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
|
@ -163,10 +162,7 @@ public class SKUSealPluginInitializer extends PluginBaseEntity {
|
|||
}
|
||||
|
||||
/**
|
||||
* 按sku名称
|
||||
* 存在 编码相同,名称不一样的情况
|
||||
* 先根据code分组,在根据修改时间倒排
|
||||
* 按修改时间倒排,取最新的修改时间
|
||||
* 按sku名称,没有过滤状态
|
||||
*/
|
||||
public void start(String goodsCode) {
|
||||
String[] split = goodsCode.split("_");
|
||||
|
@ -174,19 +170,19 @@ public class SKUSealPluginInitializer extends PluginBaseEntity {
|
|||
QueryOfsSKURequestVO queryOfsSKURequestVO = new QueryOfsSKURequestVO();
|
||||
queryOfsSKURequestVO.setCode(split[0]);
|
||||
List<OFSSKUSearchResponse.OFSSKU> ofsskuList = queryOfsSKUs(queryOfsSKURequestVO);
|
||||
if(ofsskuList.size()==0){
|
||||
if (ofsskuList.size() == 0) {
|
||||
Assert.state(false, "根据OFS SKU主档编码:{},未查询到SKU主档,请检查入参或者OFS SKU主档。", split[0]);
|
||||
}
|
||||
//分组排序,
|
||||
List<OFSSKUSearchResponse.OFSSKU> sortSkuList = groupAndSort(ofsskuList);
|
||||
|
||||
//过滤日志
|
||||
//找到最后修改时间的,进行过滤
|
||||
List<OFSSKUSearchResponse.OFSSKU> sortSkuList = groupAndSort(ofsskuList);
|
||||
List<OFSSKUSearchResponse.OFSSKU> filterSkus = filterData(sortSkuList);
|
||||
if(filterSkus.size()==0){
|
||||
Assert.state(false, "根据OFS SKU主档编码:{},已被推送成功,请勿重新推送。", split[0]);
|
||||
}
|
||||
//具体实现
|
||||
implement(filterSkus);
|
||||
|
||||
//查到每个code下所有的公司并且分组,得到一个map
|
||||
Map<String, List<OFSSKUSearchResponse.OFSSKU>> skuMap = getSkuMap(filterSkus);
|
||||
|
||||
//循环map实现
|
||||
sealImplement(skuMap);
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("丽知:OFS货品档案--->U8C货品档案(封存、取消封存),start(String goodsName)方法报错:", e);
|
||||
|
@ -208,8 +204,8 @@ public class SKUSealPluginInitializer extends PluginBaseEntity {
|
|||
queryOfsSKURequestVO.setLastUpdated_start(start);
|
||||
queryOfsSKURequestVO.setLastUpdated_end(end);
|
||||
List<OFSSKUSearchResponse.OFSSKU> ofsskuList = queryOfsSKUs(queryOfsSKURequestVO);
|
||||
if(ofsskuList.size()==0){
|
||||
Assert.state(false,"根据期间:{} - {} 内,未查询到OFS系统中SKU主档信息,请检查。");
|
||||
if (ofsskuList.size() == 0) {
|
||||
Assert.state(false, "根据期间:{} - {} 内,未查询到OFS系统中SKU主档信息,请检查。");
|
||||
}
|
||||
// //分组排序,
|
||||
// List<OFSSKUSearchResponse.OFSSKU> sortSkuList = groupAndSort(ofsskuList);
|
||||
|
@ -231,13 +227,14 @@ public class SKUSealPluginInitializer extends PluginBaseEntity {
|
|||
* 过滤成功日志
|
||||
* rootAppPk
|
||||
* [code]_[lastUpdated]
|
||||
*
|
||||
* @param ofsskuList
|
||||
* @return
|
||||
*/
|
||||
public List<OFSSKUSearchResponse.OFSSKU> filterData(List<OFSSKUSearchResponse.OFSSKU> ofsskuList){
|
||||
public List<OFSSKUSearchResponse.OFSSKU> filterData(List<OFSSKUSearchResponse.OFSSKU> ofsskuList) {
|
||||
List<OFSSKUSearchResponse.OFSSKU> filterSkus = new ArrayList<>();
|
||||
for (OFSSKUSearchResponse.OFSSKU ofssku : ofsskuList) {
|
||||
String rootAppPk = ofssku.getCode()+"_"+ofssku.getLastUpdated();
|
||||
String rootAppPk = ofssku.getCode() + "_" + ofssku.getLastUpdated();
|
||||
boolean isExis = true;
|
||||
IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity();
|
||||
integrationTaskLivingDetailsEntity.setRootAppPk(rootAppPk);
|
||||
|
@ -255,90 +252,83 @@ public class SKUSealPluginInitializer extends PluginBaseEntity {
|
|||
return filterSkus;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 推送
|
||||
* 注意:
|
||||
* 可能一家公司封存则,则取消分配这家公司的存货管理档案
|
||||
* sealflag 封存标志
|
||||
*
|
||||
* @param skuMap
|
||||
*/
|
||||
public void implement(List<OFSSKUSearchResponse.OFSSKU> filterSkus){
|
||||
for (OFSSKUSearchResponse.OFSSKU sku : filterSkus) {
|
||||
|
||||
String PkInvbasdoc= "";
|
||||
String url = "";
|
||||
public void sealImplement(Map<String, List<OFSSKUSearchResponse.OFSSKU>> skuMap) {
|
||||
skuMap.forEach((k, v) -> {
|
||||
String mapStr = "";
|
||||
String format = sku.getLastUpdated();
|
||||
String format = "";
|
||||
String response = "";
|
||||
|
||||
String ofsCode = "";
|
||||
OFSSKUSearchResponse.OFSSKU sku=null;
|
||||
try {
|
||||
InvBasDocVO invbasdoc = new InvBasDocVO();
|
||||
//主表
|
||||
InvBasDocVO.Parent parentvo = new InvBasDocVO.Parent();
|
||||
|
||||
//查询是否存在,返回pkInvbasdoc,如果有则是修改,null则为新增
|
||||
//查询该id再u8c是否有数据,没有则是新增,有则是修改 存货基本档案:def2-》ofs主键
|
||||
PkInvbasdoc=queryInvbasDocIsExist(sku);
|
||||
if (PkInvbasdoc != null) {
|
||||
//修改
|
||||
parentvo.setPk_invbasdoc(PkInvbasdoc);
|
||||
url=OverallConstant.getOverAllValue("bdinvclUpdateCode");
|
||||
} else if (PkInvbasdoc == null) {
|
||||
//新增
|
||||
url=OverallConstant.getOverAllValue("bdinvclSaveCode");
|
||||
//k:code
|
||||
//v:skuList
|
||||
String pk_invbasdoc = null;
|
||||
String url = null;
|
||||
boolean isSeal = false;
|
||||
for (OFSSKUSearchResponse.OFSSKU ofssku : v) {
|
||||
if ("1".equals(ofssku.getStatus())) {//status 0禁用 1启用
|
||||
isSeal = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
//isSeal=false为全公司禁用,所以封存
|
||||
//isSeal=true可能不只一家启用,所以解封,先查询,如果没有封存则不处理
|
||||
if (!isSeal) {//isSeal=false为全公司禁用,所以封存
|
||||
//封存
|
||||
BdInvbasdocEntity bdInvbasdocEntity = queryU8CEntityUtil.queryBdInvbasdocByCode(k);
|
||||
if (bdInvbasdocEntity == null) {
|
||||
Assert.state(false, "根据存货编码:{},未查询到U8C存货基本档案。", k);
|
||||
}
|
||||
if ("Y".equals(bdInvbasdocEntity.getSealflag())) {
|
||||
return;
|
||||
} else if ("N".equals(bdInvbasdocEntity.getSealflag())) {
|
||||
pk_invbasdoc = bdInvbasdocEntity.getPkInvbasdoc();
|
||||
url = OverallConstant.getOverAllValue("bdinvclSealCode");
|
||||
}
|
||||
}
|
||||
if (isSeal) {//isSeal=true可能不只一家启用,所以解封,先查询,如果没有封存则不处理
|
||||
//解封,判断是否封存,若已封存则处理,反之不处理
|
||||
BdInvbasdocEntity bdInvbasdocEntity = queryU8CEntityUtil.queryBdInvbasdocByCode(k);
|
||||
if (bdInvbasdocEntity == null) {
|
||||
Assert.state(false, "根据存货编码:{},未查询到U8C存货基本档案。", k);
|
||||
}
|
||||
if ("N".equals(bdInvbasdocEntity.getSealflag())) {
|
||||
return;
|
||||
} else if ("Y".equals(bdInvbasdocEntity.getSealflag())) {
|
||||
pk_invbasdoc = bdInvbasdocEntity.getPkInvbasdoc();
|
||||
url = OverallConstant.getOverAllValue("bdinvclUnsealCode");
|
||||
}
|
||||
}
|
||||
|
||||
//def2 ofs id
|
||||
parentvo.setDef2(sku.getId());
|
||||
//invcode 存货编码
|
||||
parentvo.setInvcode(sku.getCode());
|
||||
//invmnecode 助记码
|
||||
parentvo.setInvmnecode(sku.getCode());
|
||||
//invname 存货名称
|
||||
parentvo.setInvname(sku.getName());
|
||||
//invshortname 存货简称
|
||||
parentvo.setInvshortname(sku.getName());
|
||||
//pk_invcl 分类
|
||||
parentvo.setPk_invcl(sku.getCInvCCode());
|
||||
|
||||
//def1 ofs品牌
|
||||
parentvo.setDef1(sku.getBrandCode());
|
||||
|
||||
//pk_measdoc 主计量单位,ofs没有单位,默认个,20240830万万同意
|
||||
parentvo.setPk_measdoc("EA");
|
||||
|
||||
//pk_taxitems 税率 4001 商业(13 % ) 13.00000000
|
||||
parentvo.setPk_taxitems("4001");
|
||||
|
||||
//creator 创建人
|
||||
parentvo.setCreator("tbadmin");
|
||||
|
||||
//memo 备注
|
||||
parentvo.setMemo(sku.getRemark());
|
||||
|
||||
invbasdoc.setParentvo(parentvo);
|
||||
//子表,暂时没有要传的值
|
||||
String jsonStr = JSONUtil.toJsonStr(invbasdoc);
|
||||
mapStr= "{\"invbasdoc\":" + jsonStr + "}";
|
||||
//推送
|
||||
mapStr = "{\"pk_invbasdoc\":" + pk_invbasdoc + "}";
|
||||
ZTResult ztResult = pushU8CByApiCode.pushByCode(url, mapStr);
|
||||
//两层判断,一层中台转发,一层u8c返回
|
||||
Attribute attribute = ztResult.getAttribute();
|
||||
|
||||
if ("false".equals(ztResult.getFlag())) {
|
||||
//转发失败
|
||||
response=JSONUtil.toJsonStr(ztResult.getAttribute());
|
||||
Assert.state(false, "丽知:OFS货品档案--->U8C货品档案(封存、取消封存),中台转发失败,失败原因:{}", ztResult.getAttribute());
|
||||
response = JSONUtil.toJsonStr(ztResult.getAttribute());
|
||||
Assert.state(false, "丽知:U8C货品档案(封存、取消封存),中台转发失败,失败原因:{}", ztResult.getAttribute());
|
||||
}
|
||||
Attribute attribute = ztResult.getAttribute();
|
||||
boolean isSuccess = false;
|
||||
String invbascode = "";
|
||||
if ("success".equals(attribute.getStatus())) {
|
||||
isSuccess = true;
|
||||
String data = attribute.getData();
|
||||
InvBasDocVO resInvBasDocVO = resultDataHandle(data);
|
||||
invbascode = resInvBasDocVO.getParentvo().getInvcode();
|
||||
System.out.println(data);
|
||||
}
|
||||
if (!isSuccess) {
|
||||
Assert.state(false, "丽知:OFS货品档案--->U8C货品档案(封存、取消封存) 失败 接口返回结果:{} 接口入参:{}", attribute.getErrormsg(), mapStr);
|
||||
Assert.state(false, "推送U8C--> 丽知:U8C货品档案(封存、取消封存) 失败 接口返回结果:{} 接口入参:{}", attribute.getErrormsg(), mapStr);
|
||||
}
|
||||
|
||||
//获取最后修改的对象
|
||||
List<OFSSKUSearchResponse.OFSSKU> ofsskus = groupAndSort(v);
|
||||
sku = ofsskus.get(0);
|
||||
|
||||
//成功
|
||||
IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity();
|
||||
integrationTaskLivingDetailsEntity.setNewState(ProfilesActiveConstant.LOG_STATUS_Y);
|
||||
|
@ -346,18 +336,18 @@ public class SKUSealPluginInitializer extends PluginBaseEntity {
|
|||
integrationTaskLivingDetailsEntity.setNewTransmitInfo(attribute.getData());
|
||||
integrationTaskLivingDetailsEntity.setNewPushDate(new Date());
|
||||
integrationTaskLivingDetailsEntity.setBusinessDate(format);
|
||||
integrationTaskLivingDetailsEntity.setRootAppPk(sku.getCode()+"_"+sku.getLastUpdated());
|
||||
integrationTaskLivingDetailsEntity.setRootAppBill(sku.getCode());
|
||||
integrationTaskLivingDetailsEntity.setRootAppPk(k + "_" + sku.getLastUpdated());
|
||||
integrationTaskLivingDetailsEntity.setRootAppBill(k);
|
||||
integrationTaskLivingDetailsEntity.setPluginId(getPluginId());
|
||||
integrationTaskLivingDetailsEntity.setDef1(sku.getId());
|
||||
integrationTaskLivingDetailsEntity.setNewSystemNumber(k);
|
||||
integrationTaskLivingDetailsEntity.setNewSystemPrimary(sku.getId());
|
||||
saveOrUpdateBusinessLogUtil.saveOrUpdate(integrationTaskLivingDetailsEntity);
|
||||
|
||||
}catch (Exception e){
|
||||
} catch (Exception e) {
|
||||
//失败
|
||||
e.printStackTrace();
|
||||
logger.error("推送U8C,丽知:OFS货品档案--->U8C货品档案(封存、取消封存)失败,失败原因:" + e);
|
||||
//失败
|
||||
ReusltStrDto reusltStrDto = JSON.parseObject(response, ReusltStrDto.class);
|
||||
String ErrMessage = "推送U8C,丽知:OFS货品档案--->U8C货品档案(封存、取消封存)失败,失败原因:" + reusltStrDto.getErrormsg();
|
||||
String ErrMessage = "推送U8C货品档案(封存、取消封存)失败,失败原因:" + reusltStrDto.getErrormsg();
|
||||
//失败
|
||||
IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity();
|
||||
integrationTaskLivingDetailsEntity.setNewState(ProfilesActiveConstant.LOG_STATUS_N);
|
||||
|
@ -365,88 +355,101 @@ public class SKUSealPluginInitializer extends PluginBaseEntity {
|
|||
integrationTaskLivingDetailsEntity.setNewTransmitInfo(ErrMessage);
|
||||
integrationTaskLivingDetailsEntity.setNewPushDate(new Date());
|
||||
integrationTaskLivingDetailsEntity.setBusinessDate(format);
|
||||
integrationTaskLivingDetailsEntity.setRootAppPk(sku.getCode()+"_"+sku.getLastUpdated());
|
||||
integrationTaskLivingDetailsEntity.setRootAppBill(sku.getCode());
|
||||
integrationTaskLivingDetailsEntity.setRootAppPk(k+"_"+sku.getLastUpdated());
|
||||
integrationTaskLivingDetailsEntity.setRootAppBill(k);
|
||||
integrationTaskLivingDetailsEntity.setPluginId(getPluginId());
|
||||
integrationTaskLivingDetailsEntity.setDef1(sku.getId());
|
||||
integrationTaskLivingDetailsEntity.setNewSystemNumber(k);
|
||||
integrationTaskLivingDetailsEntity.setNewSystemPrimary(sku.getId());
|
||||
saveOrUpdateBusinessLogUtil.saveOrUpdate(integrationTaskLivingDetailsEntity);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public String queryInvbasDocIsExist(OFSSKUSearchResponse.OFSSKU sku){
|
||||
String PkInvbasdoc="";
|
||||
/**
|
||||
* 封存,编码不会重复,可以根据编码查询主键
|
||||
* 8000370058 存货基本档案封存
|
||||
*/
|
||||
public void seal(OFSSKUSearchResponse.OFSSKU sku) {
|
||||
BdInvbasdocEntity bdInvbasdocEntity = queryU8CEntityUtil.queryBdInvbasdocByCode(sku.getCode());
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 解封,编码不会重复,可以根据编码查询主键
|
||||
* 8000370059 存货基本档案取消封存
|
||||
*/
|
||||
public void noSeal() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public String queryInvbasDocIsExist(OFSSKUSearchResponse.OFSSKU sku) {
|
||||
String PkInvbasdoc = "";
|
||||
BdInvbasdocEntity bdInvbasdocEntity = new BdInvbasdocEntity();
|
||||
bdInvbasdocEntity.setDr(0L);
|
||||
bdInvbasdocEntity.setDef2(sku.getId());
|
||||
bdInvbasdocEntity.setDataSourceCode(ProfilesActiveConstant.LETS_DATE_SOURCE);
|
||||
List<BdInvbasdocEntity> bdInvbasdocEntityList = bdInvbasdocDao.query(bdInvbasdocEntity);//根据ofs id
|
||||
if(bdInvbasdocEntityList.size()==0){
|
||||
if (bdInvbasdocEntityList.size() == 0) {
|
||||
bdInvbasdocEntity.setDef2(null);
|
||||
bdInvbasdocEntity.setInvcode(sku.getCode());
|
||||
bdInvbasdocEntity.setInvname(sku.getName());
|
||||
List<BdInvbasdocEntity> bdInvbasdocEntityList1 = bdInvbasdocDao.query(bdInvbasdocEntity);//根据编码+名称
|
||||
if(bdInvbasdocEntityList1.size()==0){
|
||||
if (bdInvbasdocEntityList1.size() == 0) {
|
||||
bdInvbasdocEntity.setInvname(null);
|
||||
List<BdInvbasdocEntity> bdInvbasdocEntityList2 = bdInvbasdocDao.query(bdInvbasdocEntity);//进查询编码
|
||||
if (bdInvbasdocEntityList2.size() == 0) {//编码不存在
|
||||
return null;
|
||||
} else if (bdInvbasdocEntityList2.size() == 1) {//编码存在
|
||||
PkInvbasdoc=bdInvbasdocEntityList2.get(0).getPkInvbasdoc();//主键
|
||||
PkInvbasdoc = bdInvbasdocEntityList2.get(0).getPkInvbasdoc();//主键
|
||||
}
|
||||
}else if(bdInvbasdocEntityList1.size()==1){
|
||||
} else if (bdInvbasdocEntityList1.size() == 1) {
|
||||
//修改
|
||||
PkInvbasdoc=bdInvbasdocEntityList1.get(0).getPkInvbasdoc();//主键
|
||||
PkInvbasdoc = bdInvbasdocEntityList1.get(0).getPkInvbasdoc();//主键
|
||||
}
|
||||
}else if(bdInvbasdocEntityList.size()==1){
|
||||
} else if (bdInvbasdocEntityList.size() == 1) {
|
||||
//修改
|
||||
PkInvbasdoc=bdInvbasdocEntityList.get(0).getPkInvbasdoc();//主键
|
||||
}else {
|
||||
PkInvbasdoc = bdInvbasdocEntityList.get(0).getPkInvbasdoc();//主键
|
||||
} else {
|
||||
//异常,存在多个
|
||||
Assert.state(false,"SKU主档编码:{},id:{}。U8C存货基本档案def2(OFS中SKU主档id)存在多个,请检查。",sku.getCode(),sku.getId());
|
||||
Assert.state(false, "SKU主档编码:{},id:{}。U8C存货基本档案def2(OFS中SKU主档id)存在多个,请检查。", sku.getCode(), sku.getId());
|
||||
}
|
||||
return PkInvbasdoc;
|
||||
return PkInvbasdoc;
|
||||
}
|
||||
|
||||
/**
|
||||
* 按code分组,并按lastUpdated排序
|
||||
*
|
||||
* @param ofsskuList
|
||||
* @return
|
||||
*/
|
||||
public List<OFSSKUSearchResponse.OFSSKU> groupAndSort(List<OFSSKUSearchResponse.OFSSKU> ofsskuList){
|
||||
List<OFSSKUSearchResponse.OFSSKU> sortSkus=new ArrayList<>();
|
||||
public List<OFSSKUSearchResponse.OFSSKU> groupAndSort(List<OFSSKUSearchResponse.OFSSKU> ofsskuList) {
|
||||
List<OFSSKUSearchResponse.OFSSKU> sortSkus = new ArrayList<>();
|
||||
|
||||
//根据code进行分组
|
||||
Map<String, List<OFSSKUSearchResponse.OFSSKU>> collectMapByCode =
|
||||
ofsskuList.stream().collect(Collectors.groupingBy(OFSSKUSearchResponse.OFSSKU::getCode));
|
||||
|
||||
collectMapByCode.forEach((k,v)->{
|
||||
collectMapByCode.forEach((k, v) -> {
|
||||
//降序排序 (从新到旧),根据最后修改时间倒排
|
||||
List<OFSSKUSearchResponse.OFSSKU> sorted =
|
||||
v.stream().sorted(Comparator.comparing(OFSSKUSearchResponse.OFSSKU::getLastUpdated).reversed()).collect(Collectors.toList());
|
||||
|
||||
//排除status==0的
|
||||
for (int i = 0; i < sorted.size(); i++) {
|
||||
if("0".equals(sorted.get(i).getStatus())){
|
||||
if ("0".equals(sorted.get(i).getStatus())) {
|
||||
sorted.remove(i);
|
||||
}
|
||||
}
|
||||
|
||||
if(sorted.size()!=0){
|
||||
if (sorted.size() != 0) {
|
||||
sortSkus.add(sorted.get(0));//只取最后修改的一个
|
||||
}
|
||||
});
|
||||
return sortSkus;
|
||||
}
|
||||
|
||||
/**
|
||||
* 封存存货基本档案
|
||||
*/
|
||||
public void sealImplement(String code){
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询OFS SKU档案
|
||||
|
@ -485,6 +488,27 @@ public class SKUSealPluginInitializer extends PluginBaseEntity {
|
|||
}
|
||||
return all;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据编码获取每个组织下的档案
|
||||
*
|
||||
* @param filterSkus list里面的sku均不一样
|
||||
* @return
|
||||
*/
|
||||
public Map<String, List<OFSSKUSearchResponse.OFSSKU>> getSkuMap(List<OFSSKUSearchResponse.OFSSKU> filterSkus) throws Exception {
|
||||
|
||||
Map<String, List<OFSSKUSearchResponse.OFSSKU>> map = new HashMap<>();
|
||||
|
||||
QueryOfsSKURequestVO queryOfsSKURequestVO = new QueryOfsSKURequestVO();
|
||||
for (OFSSKUSearchResponse.OFSSKU sku : filterSkus) {
|
||||
queryOfsSKURequestVO.setCode(sku.getCode());
|
||||
List<OFSSKUSearchResponse.OFSSKU> ofsskus = queryOfsSKUs(queryOfsSKURequestVO);
|
||||
map.put(sku.getCode(), ofsskus);
|
||||
}
|
||||
return map;
|
||||
|
||||
}
|
||||
|
||||
private InvBasDocVO resultDataHandle(String resultData) {
|
||||
try {
|
||||
if (resultData != null && !"".equals(resultData)) {
|
||||
|
|
|
@ -14,6 +14,8 @@ public class BaseTest {
|
|||
@Autowired
|
||||
private SKUPluginInitializer skuPluginInitializer;
|
||||
@Autowired
|
||||
private SKUSealPluginInitializer skuSealPluginInitializer;
|
||||
@Autowired
|
||||
private SKUClassPluginInitializer skuClassPluginInitializer;
|
||||
@Autowired
|
||||
private GoodsAutoAllotPluginInitializer goodsAutoAllotPluginInitializer;
|
||||
|
@ -25,17 +27,26 @@ public class BaseTest {
|
|||
}
|
||||
@Test
|
||||
public void t01(){
|
||||
skuPluginInitializer.start("6971898450656");
|
||||
skuPluginInitializer.start("6971229882248");
|
||||
}
|
||||
@Test
|
||||
public void t02(){
|
||||
skuPluginInitializer.start("2024-08-28","2024-08-29");
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////////////SKU封存给
|
||||
@Test
|
||||
public void t31(){
|
||||
skuSealPluginInitializer.start("6971229882248");
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////SKU自动分配
|
||||
@Test
|
||||
public void t10(){
|
||||
// goodsAutoAllotPluginInitializer.start("0001A210000000000U4C");
|
||||
goodsAutoAllotPluginInitializer.start("6971229882248");
|
||||
goodsAutoAllotPluginInitializer.start("6973391735469");
|
||||
}
|
||||
@Test
|
||||
public void t11(){
|
||||
goodsAutoAllotPluginInitializer.start("2024-09-09","2024-09-09");
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////////////SKU分类
|
||||
@Test
|
||||
|
|
Loading…
Reference in New Issue