feat(buildpackage): 新增售后类型标识并更新相关实体
- 在 OverallConstant 中添加 TOC 无源件的售后类型标识编码- 更新 OnlyAfterSalesBEntity、OfsPassiveorderDetailEntity 和 TocofsReturngoodsDetailedEntity 实体的数据库操作映射 - 修改数据库连接配置,注释掉本地测试用的 URL 和用户名密码 - 更新测试用例中的实施代码
This commit is contained in:
parent
e513b6431a
commit
d3ceb69a36
|
@ -158,6 +158,9 @@ public class OverallConstant {
|
||||||
prodOverAll.put("售后类型标识-TOC无源件-主键", "0001A110000000ADSWWJ");
|
prodOverAll.put("售后类型标识-TOC无源件-主键", "0001A110000000ADSWWJ");
|
||||||
prodOverAll.put("售后类型标识-TOC无源件-名称", "TOC无源件");
|
prodOverAll.put("售后类型标识-TOC无源件-名称", "TOC无源件");
|
||||||
|
|
||||||
|
//售后类型标识-TOC无源件-编码
|
||||||
|
prodOverAll.put("售后类型标识-TOC无源件-编码", "02");
|
||||||
|
|
||||||
prodOverAll.put("售后类型标识-TOB售后-主键", "0001A110000000AFFT7M");
|
prodOverAll.put("售后类型标识-TOB售后-主键", "0001A110000000AFFT7M");
|
||||||
prodOverAll.put("售后类型标识-TOB售后-名称", "TOB售后");
|
prodOverAll.put("售后类型标识-TOB售后-名称", "TOB售后");
|
||||||
|
|
||||||
|
|
|
@ -421,10 +421,10 @@
|
||||||
|
|
||||||
<!-- 批量新增或者修改-->
|
<!-- 批量新增或者修改-->
|
||||||
<insert id="entityInsertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
|
<insert id="entityInsertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
|
||||||
insert into only_after_sales_b(hid,ofsid,returnOrderId, returnOrderCode, skuCode, skuName, companyCode, clientCode, storeCode, returnType, refundInd, requestQty, fulfillQty, quantityUM, msrPrice, totalWeight, totalVolume, weightUM, volumeUM, totalAmount, sourceLineNum, sourceOrderCode, sourceDiscountPrice, sourcePayAmount, sourceRequestQty, bomType, originalDetailId, reasonCode, reasonDesc,businessType,transactionDate)
|
insert into only_after_sales_b(hid,ofsid,returnOrderId, returnOrderCode, skuCode, skuName, companyCode, clientCode, storeCode, returnType, refundInd, requestQty, fulfillQty, quantityUM, msrPrice, totalWeight, totalVolume, weightUM, volumeUM, totalAmount, sourceLineNum, sourceOrderCode, sourceDiscountPrice, sourcePayAmount, sourceRequestQty, bomType, originalDetailId, reasonCode, reasonDesc,businessType,transactionDate,def7,def13)
|
||||||
values
|
values
|
||||||
<foreach collection="list" item="entity" separator=",">
|
<foreach collection="list" item="entity" separator=",">
|
||||||
(#{entity.hid},#{entity.ofsid},#{entity.returnorderid},#{entity.returnordercode},#{entity.skucode},#{entity.skuname},#{entity.companycode},#{entity.clientcode},#{entity.storecode},#{entity.returntype},#{entity.refundind},#{entity.requestqty},#{entity.fulfillqty},#{entity.quantityum},#{entity.msrprice},#{entity.totalweight},#{entity.totalvolume},#{entity.weightum},#{entity.volumeum},#{entity.totalamount},#{entity.sourcelinenum},#{entity.sourceordercode},#{entity.sourcediscountprice},#{entity.sourcepayamount},#{entity.sourcerequestqty},#{entity.bomtype},#{entity.originaldetailid},#{entity.reasoncode},#{entity.reasondesc},#{entity.businessType},#{entity.transactionDate})
|
(#{entity.hid},#{entity.ofsid},#{entity.returnorderid},#{entity.returnordercode},#{entity.skucode},#{entity.skuname},#{entity.companycode},#{entity.clientcode},#{entity.storecode},#{entity.returntype},#{entity.refundind},#{entity.requestqty},#{entity.fulfillqty},#{entity.quantityum},#{entity.msrprice},#{entity.totalweight},#{entity.totalvolume},#{entity.weightum},#{entity.volumeum},#{entity.totalamount},#{entity.sourcelinenum},#{entity.sourceordercode},#{entity.sourcediscountprice},#{entity.sourcepayamount},#{entity.sourcerequestqty},#{entity.bomtype},#{entity.originaldetailid},#{entity.reasoncode},#{entity.reasondesc},#{entity.businessType},#{entity.transactionDate},#{entity.def7},#{entity.def13})
|
||||||
</foreach>
|
</foreach>
|
||||||
on duplicate key update
|
on duplicate key update
|
||||||
hid = values(hid),
|
hid = values(hid),
|
||||||
|
@ -457,7 +457,9 @@
|
||||||
reasonCode = values(reasonCode),
|
reasonCode = values(reasonCode),
|
||||||
reasonDesc = values(reasonDesc),
|
reasonDesc = values(reasonDesc),
|
||||||
businessType = values(businessType),
|
businessType = values(businessType),
|
||||||
transactionDate = values(transactionDate)
|
transactionDate = values(transactionDate),
|
||||||
|
def7 = def7,
|
||||||
|
def13 = def13
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<!-- 批量新增或者修改-->
|
<!-- 批量新增或者修改-->
|
||||||
|
@ -515,10 +517,10 @@
|
||||||
|
|
||||||
<!-- 批量新增或者修改-->
|
<!-- 批量新增或者修改-->
|
||||||
<insert id="entityInsertOrUpdateBatchBySuccessOrFail2" keyProperty="id" useGeneratedKeys="true">
|
<insert id="entityInsertOrUpdateBatchBySuccessOrFail2" keyProperty="id" useGeneratedKeys="true">
|
||||||
insert into only_after_sales_b(ofsid,def8,def9,def10,def11,def12,def1,def2,def3,def4,def5,def6,def7)
|
insert into only_after_sales_b(ofsid,def8,def9,def10,def11,def12,def13,def1,def2,def3,def4,def5,def6,def7)
|
||||||
values
|
values
|
||||||
<foreach collection="list" item="entity" separator=",">
|
<foreach collection="list" item="entity" separator=",">
|
||||||
(#{entity.ofsid},#{entity.def8},#{entity.def9},#{entity.def10},#{entity.def11},#{entity.def12},#{entity.def1},#{entity.def2},#{entity.def3},#{entity.def4},#{entity.def5},#{entity.def6},#{entity.def7})
|
(#{entity.ofsid},#{entity.def8},#{entity.def9},#{entity.def10},#{entity.def11},#{entity.def12},#{entity.def13},#{entity.def1},#{entity.def2},#{entity.def3},#{entity.def4},#{entity.def5},#{entity.def6},#{entity.def7})
|
||||||
</foreach>
|
</foreach>
|
||||||
on duplicate key update
|
on duplicate key update
|
||||||
ofsid = values(ofsid),
|
ofsid = values(ofsid),
|
||||||
|
@ -527,6 +529,7 @@
|
||||||
def10 = values(def10),
|
def10 = values(def10),
|
||||||
def11 = values(def11),
|
def11 = values(def11),
|
||||||
def12 = values(def12),
|
def12 = values(def12),
|
||||||
|
def13 = values(def13),
|
||||||
def1 = values(def1),
|
def1 = values(def1),
|
||||||
def2 = values(def2),
|
def2 = values(def2),
|
||||||
def3 = values(def3),
|
def3 = values(def3),
|
||||||
|
|
|
@ -264,10 +264,10 @@
|
||||||
|
|
||||||
<!-- 批量新增或者修改底表数据-->
|
<!-- 批量新增或者修改底表数据-->
|
||||||
<insert id="entityInsertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
|
<insert id="entityInsertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
|
||||||
insert into ofs_passiveorder_detail(id,headerId, receiptCode, skuCode, skuName, quantity, inventorySts, created, createdBy, lastUpdated, lastUpdatedBy, businessDate, businessType)
|
insert into ofs_passiveorder_detail(id,headerId, receiptCode, skuCode, skuName, quantity, inventorySts, created, createdBy, lastUpdated, lastUpdatedBy, businessDate, businessType,def11)
|
||||||
values
|
values
|
||||||
<foreach collection="list" item="entity" separator=",">
|
<foreach collection="list" item="entity" separator=",">
|
||||||
(#{entity.id},#{entity.headerid},#{entity.receiptcode},#{entity.skucode},#{entity.skuname},#{entity.quantity},#{entity.inventorysts},#{entity.created},#{entity.createdby},#{entity.lastupdated},#{entity.lastupdatedby},#{entity.businessdate},#{entity.businesstype})
|
(#{entity.id},#{entity.headerid},#{entity.receiptcode},#{entity.skucode},#{entity.skuname},#{entity.quantity},#{entity.inventorysts},#{entity.created},#{entity.createdby},#{entity.lastupdated},#{entity.lastupdatedby},#{entity.businessdate},#{entity.businesstype},#{entity.def11})
|
||||||
</foreach>
|
</foreach>
|
||||||
on duplicate key update
|
on duplicate key update
|
||||||
id = values(id),
|
id = values(id),
|
||||||
|
@ -282,7 +282,8 @@
|
||||||
lastUpdated = values(lastUpdated),
|
lastUpdated = values(lastUpdated),
|
||||||
lastUpdatedBy = values(lastUpdatedBy),
|
lastUpdatedBy = values(lastUpdatedBy),
|
||||||
businessDate = values(businessDate),
|
businessDate = values(businessDate),
|
||||||
businessType = values(businessType)
|
businessType = values(businessType),
|
||||||
|
def11 = values(def11)
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<!-- 批量更新入库或者退款完成的状态-->
|
<!-- 批量更新入库或者退款完成的状态-->
|
||||||
|
|
|
@ -847,10 +847,10 @@
|
||||||
|
|
||||||
<!-- 批量新增或者修改,TOC、TOB 退货-同步基本底表数据-->
|
<!-- 批量新增或者修改,TOC、TOB 退货-同步基本底表数据-->
|
||||||
<insert id="entityInsertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
|
<insert id="entityInsertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
|
||||||
insert into tocofs_returngoods_detailed(id,receiptId, receiptCode, refOrderId, refOrderDetailId, sourceOrderCode, sourceLineNum, clientCode, companyCode, facilityCode, skuCode, skuName, requestQty, receivedQty, openQty, quantityUM, totalWeight, totalVolume, totalVolumeWeight, totalAmount, weightUM, volumeUM, inventorySts, inTransInvId, closed, created, createdBy, lastUpdated, lastUpdatedBy, discountPrice, mainTableId, businessDate, refundedAt, businessType)
|
insert into tocofs_returngoods_detailed(id,receiptId, receiptCode, refOrderId, refOrderDetailId, sourceOrderCode, sourceLineNum, clientCode, companyCode, facilityCode, skuCode, skuName, requestQty, receivedQty, openQty, quantityUM, totalWeight, totalVolume, totalVolumeWeight, totalAmount, weightUM, volumeUM, inventorySts, inTransInvId, closed, created, createdBy, lastUpdated, lastUpdatedBy, discountPrice, mainTableId, businessDate, refundedAt, businessType,def23,def24)
|
||||||
values
|
values
|
||||||
<foreach collection="list" item="entity" separator=",">
|
<foreach collection="list" item="entity" separator=",">
|
||||||
(#{entity.id},#{entity.receiptid},#{entity.receiptcode},#{entity.reforderid},#{entity.reforderdetailid},#{entity.sourceordercode},#{entity.sourcelinenum},#{entity.clientcode},#{entity.companycode},#{entity.facilitycode},#{entity.skucode},#{entity.skuname},#{entity.requestqty},#{entity.receivedqty},#{entity.openqty},#{entity.quantityum},#{entity.totalweight},#{entity.totalvolume},#{entity.totalvolumeweight},#{entity.totalamount},#{entity.weightum},#{entity.volumeum},#{entity.inventorysts},#{entity.intransinvid},#{entity.closed},#{entity.created},#{entity.createdby},#{entity.lastupdated},#{entity.lastupdatedby},#{entity.discountprice},#{entity.maintableid},#{entity.businessdate},#{entity.refundedat},#{entity.businesstype})
|
(#{entity.id},#{entity.receiptid},#{entity.receiptcode},#{entity.reforderid},#{entity.reforderdetailid},#{entity.sourceordercode},#{entity.sourcelinenum},#{entity.clientcode},#{entity.companycode},#{entity.facilitycode},#{entity.skucode},#{entity.skuname},#{entity.requestqty},#{entity.receivedqty},#{entity.openqty},#{entity.quantityum},#{entity.totalweight},#{entity.totalvolume},#{entity.totalvolumeweight},#{entity.totalamount},#{entity.weightum},#{entity.volumeum},#{entity.inventorysts},#{entity.intransinvid},#{entity.closed},#{entity.created},#{entity.createdby},#{entity.lastupdated},#{entity.lastupdatedby},#{entity.discountprice},#{entity.maintableid},#{entity.businessdate},#{entity.refundedat},#{entity.businesstype},#{entity.def23},#{entity.def24})
|
||||||
</foreach>
|
</foreach>
|
||||||
on duplicate key update
|
on duplicate key update
|
||||||
id = values(id),
|
id = values(id),
|
||||||
|
@ -886,7 +886,9 @@
|
||||||
mainTableId = values(mainTableId),
|
mainTableId = values(mainTableId),
|
||||||
businessDate = values(businessDate),
|
businessDate = values(businessDate),
|
||||||
refundedAt = values(refundedAt),
|
refundedAt = values(refundedAt),
|
||||||
businessType = values(businessType)
|
businessType = values(businessType),
|
||||||
|
def23 = values(def23),
|
||||||
|
def24 = values(def24)
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<!-- 批量新增或者修改,TOC退货-库存-->
|
<!-- 批量新增或者修改,TOC退货-库存-->
|
||||||
|
|
|
@ -1072,226 +1072,233 @@ public class PassiveWarehouseReceiptToC extends PluginBaseEntity {
|
||||||
String newState = value.get(0).getNewState();//红字订单推送状态
|
String newState = value.get(0).getNewState();//红字订单推送状态
|
||||||
String def10 = value.get(0).getDef10();//蓝字订单推送状态
|
String def10 = value.get(0).getDef10();//蓝字订单推送状态
|
||||||
|
|
||||||
// try {
|
// 验证是否为指定的店铺,如果为true,则取结存价
|
||||||
//生成业务日期
|
Boolean isCheckShopChoose = balanceUnitPriceUtil.checkOfsShop(header.getStoreCode());
|
||||||
// String generateBusinessDate = createSuccessFulTradeDate(header);
|
// 把汇总好的出库单明细行合并成一行
|
||||||
// String generateBusinessDate = value.get(0).getTargetBusinessDate().substring(0, 10);
|
PassiveStorageSonDetailsDto2 passiveStorageSonDetailsDto2 = groupMergeDetailedRows2(value, isCheckShopChoose);
|
||||||
|
BigDecimal groupTotalPayAmount1 = passiveStorageSonDetailsDto2.getGroupTotalPayAmount();
|
||||||
|
BigDecimal groupShipQty = passiveStorageSonDetailsDto2.getGroupShipQty();
|
||||||
|
//当金额>0,但数量为0时,推送红字应收单
|
||||||
|
if (groupTotalPayAmount1 != null && groupShipQty != null && groupTotalPayAmount1.compareTo(BigDecimal.ZERO) > 0 && groupShipQty.compareTo(BigDecimal.ZERO) == 0) {
|
||||||
|
try {
|
||||||
|
BdBusitypeEntity bdBusitypeEntity = u8cOperationFlowV4();
|
||||||
|
// 生成业务日期
|
||||||
|
String generateBusinessDate = value.get(0).getTargetBusinessDate().substring(0, 10);
|
||||||
|
|
||||||
//组装应收单表头
|
// 组装应收单表头
|
||||||
// ArapDjzbVO.Parentt parentVo = new ArapDjzbVO.Parentt();
|
ArapDjzbVO.Parentt parentVo = new ArapDjzbVO.Parentt();
|
||||||
// parentVo.setDjrq(generateBusinessDate);//单据日期
|
parentVo.setDjrq(generateBusinessDate);//单据日期
|
||||||
// parentVo.setDwbm(bdCorpEntity.getUnitcode());//公司
|
parentVo.setDwbm(bdCorpEntity.getUnitcode());//公司
|
||||||
// parentVo.setLrr(OverallConstant.getOverAllValue("u8cApiZdrCode"));//录入人
|
parentVo.setLrr(OverallConstant.getOverAllValue("u8cApiZdrCode"));//录入人
|
||||||
// parentVo.setWldx("0");//往来对象标识 固定为:客户
|
parentVo.setWldx("0");//往来对象标识 固定为:客户
|
||||||
// parentVo.setDeptid(bdDeptdocEntity.getDeptcode());//部门
|
parentVo.setDeptid(bdDeptdocEntity.getDeptcode());//部门
|
||||||
// parentVo.setShr(OverallConstant.getOverAllValue("u8cApiZdrCode"));//审批人
|
parentVo.setShr(OverallConstant.getOverAllValue("u8cApiZdrCode"));//审批人
|
||||||
// parentVo.setShrq(generateBusinessDate);//审核日期
|
parentVo.setShrq(generateBusinessDate);//审核日期
|
||||||
// parentVo.setDjlxbm("D0");//单据类型编码
|
parentVo.setDjlxbm("D0");//单据类型编码
|
||||||
// parentVo.setXslxbm(bdBusitypeEntity.getBusicode());//业务流程
|
parentVo.setXslxbm(bdBusitypeEntity.getBusicode());//业务流程
|
||||||
// parentVo.setFeinvstatus("0");//开票状态
|
parentVo.setFeinvstatus("0");//开票状态
|
||||||
// parentVo.setHbbm(bdCubasdocEntity.getCustcode());//客商主键
|
parentVo.setHbbm(bdCubasdocEntity.getCustcode());//客商主键
|
||||||
// //店铺档案
|
//店铺档案
|
||||||
// parentVo.setZyx1(shopArchives.getDoccode());
|
parentVo.setZyx1(shopArchives.getDoccode());
|
||||||
//// parentVo.setDef1(shopArchives.getDocname());
|
// parentVo.setDef1(shopArchives.getDocname());
|
||||||
// //来源平台
|
//来源平台
|
||||||
// parentVo.setZyx2(platformArchives.getDoccode());
|
parentVo.setZyx2(platformArchives.getDoccode());
|
||||||
//// parentVo.setDef2(platformArchives.getDocname());
|
// parentVo.setDef2(platformArchives.getDocname());
|
||||||
// //收发类别
|
//收发类别
|
||||||
// parentVo.setZyx3(bdRdclEntity.getRdcode());
|
parentVo.setZyx3(bdRdclEntity.getRdcode());
|
||||||
//// parentVo.setDef3(bdRdclEntity.getRdname());
|
// parentVo.setDef3(bdRdclEntity.getRdname());
|
||||||
// //单据红字标识
|
|
||||||
// parentVo.setZyx16("1");
|
|
||||||
//// parentVo.setDef16(OverallConstant.getOverAllValue("u8c自定义项档案-单据红字标识-Y名称"));
|
|
||||||
//// parentVo.setZyx19();//自定义项19 OFS单号不传,因为是汇总的
|
|
||||||
// parentVo.setZyx17(ProfilesActiveConstant.sourceSystem1);//来源系统
|
|
||||||
// parentVo.setZyx18(key);
|
|
||||||
|
|
||||||
//验证是否为指定的店铺,如果为true,则取结存价
|
parentVo.setZyx8(OverallConstant.getOverAllValue("售后类型标识-TOC无源件-编码"));
|
||||||
// Boolean isCheckShopChoose = balanceUnitPriceUtil.checkOfsShop(header.getStoreCode());
|
//单据红字标识
|
||||||
//把汇总好的出库单明细行合并成一行
|
parentVo.setZyx16("1");
|
||||||
// PassiveStorageSonDetailsDto2 passiveStorageSonDetailsDto2 = groupMergeDetailedRows2(value, isCheckShopChoose);
|
// parentVo.setDef16(OverallConstant.getOverAllValue("u8c自定义项档案-单据红字标识-Y名称"));
|
||||||
//存货管理档案:取发货公司的存货管理档案
|
// parentVo.setZyx19();//自定义项19 OFS单号不传,因为是汇总的
|
||||||
// BdInvmandocEntity bdInvmandocEntity = value.get(0).getBdInvmandocEntity();
|
parentVo.setZyx17(ProfilesActiveConstant.sourceSystem1);//来源系统
|
||||||
//存货基础档案
|
parentVo.setZyx18(key);
|
||||||
// BdInvbasdocEntity bdInvbasdocEntity = value.get(0).getBdInvbasdocEntity();
|
|
||||||
//根据存货基础档案编码,查询当前存货的税率
|
|
||||||
// BdTaxitemsEntity bdTaxitemsEntity1 = value.get(0).getBdTaxitemsEntity();
|
|
||||||
|
|
||||||
//如果合并后的金额为0,则不传到U8C
|
// 存货管理档案:取发货公司的存货管理档案
|
||||||
// Assert.notNull(passiveStorageSonDetailsDto2.getGroupTotalPayAmount(), "passiveStorageSonDetailsDto.getGroupTotalPayAmount()不能为空!");
|
BdInvmandocEntity bdInvmandocEntity = value.get(0).getBdInvmandocEntity();
|
||||||
// BigDecimal groupTotalPayAmount = passiveStorageSonDetailsDto2.getGroupTotalPayAmount().setScale(2, BigDecimal.ROUND_HALF_UP);
|
// 存货基础档案
|
||||||
// if ("0".equals(groupTotalPayAmount.stripTrailingZeros().toPlainString())) {
|
BdInvbasdocEntity bdInvbasdocEntity = value.get(0).getBdInvbasdocEntity();
|
||||||
// continue;
|
// 根据存货基础档案编码,查询当前存货的税率
|
||||||
// }
|
BdTaxitemsEntity bdTaxitemsEntity1 = value.get(0).getBdTaxitemsEntity();
|
||||||
|
|
||||||
// String tax = null;//税率
|
// 如果合并后的金额为0,则不传到U8C
|
||||||
// BigDecimal noriginalcurmny = null;//无税金额
|
Assert.notNull(passiveStorageSonDetailsDto2.getGroupTotalPayAmount(), "passiveStorageSonDetailsDto.getGroupTotalPayAmount()不能为空!");
|
||||||
// BigDecimal noriginalcurtaxmny = null;//税额
|
BigDecimal groupTotalPayAmount = passiveStorageSonDetailsDto2.getGroupTotalPayAmount().setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||||
// try {
|
if ("0".equals(groupTotalPayAmount.stripTrailingZeros().toPlainString())) {
|
||||||
// tax = new BigDecimal(bdTaxitemsEntity1.getTaxratio()).divide(new BigDecimal(100), 20, BigDecimal.ROUND_HALF_UP).setScale(2, BigDecimal.ROUND_HALF_UP).stripTrailingZeros().toPlainString();
|
continue;
|
||||||
// noriginalcurmny = groupTotalPayAmount.divide(new BigDecimal(1).add(new BigDecimal(tax)), 20, BigDecimal.ROUND_HALF_UP).setScale(2, BigDecimal.ROUND_HALF_UP);
|
}
|
||||||
// noriginalcurtaxmny = groupTotalPayAmount.subtract(noriginalcurmny).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
||||||
// } catch (Exception e) {
|
|
||||||
// logger.error("金额计算失败", e);
|
|
||||||
// Assert.state(false, "金额计算失败 跑出异常:{}", e.getMessage());
|
|
||||||
// }
|
|
||||||
|
|
||||||
//组装应收单表体
|
String tax = null;//税率
|
||||||
// List<ArapDjzbVO.Childrenn> pushScenarioType = new ArrayList<>();
|
BigDecimal noriginalcurmny = null;//无税金额
|
||||||
// ArapDjzbVO.Childrenn arapDjzbVOChildrenn = new ArapDjzbVO.Childrenn();
|
BigDecimal noriginalcurtaxmny = null;//税额
|
||||||
// pushScenarioType.add(arapDjzbVOChildrenn);
|
try {
|
||||||
// arapDjzbVOChildrenn.setCinventoryid(bdInvbasdocEntity.getInvcode());//存货管理档案
|
tax = new BigDecimal(bdTaxitemsEntity1.getTaxratio()).divide(new BigDecimal(100), 20, BigDecimal.ROUND_HALF_UP).setScale(2, BigDecimal.ROUND_HALF_UP).stripTrailingZeros().toPlainString();
|
||||||
// arapDjzbVOChildrenn.setJfbbje("-" + groupTotalPayAmount.stripTrailingZeros().toPlainString());//借方本币金额
|
noriginalcurmny = groupTotalPayAmount.divide(new BigDecimal(1).add(new BigDecimal(tax)), 20, BigDecimal.ROUND_HALF_UP).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||||
// arapDjzbVOChildrenn.setJfybje("-" + groupTotalPayAmount.stripTrailingZeros().toPlainString());//借方原币金额
|
noriginalcurtaxmny = groupTotalPayAmount.subtract(noriginalcurmny).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||||
// arapDjzbVOChildrenn.setJfbbsj("-" + noriginalcurmny.stripTrailingZeros().toPlainString());//借方本币税金
|
} catch (Exception e) {
|
||||||
// arapDjzbVOChildrenn.setJfybsj("-" + noriginalcurmny.stripTrailingZeros().toPlainString());//借方原币税金
|
logger.error("金额计算失败", e);
|
||||||
// arapDjzbVOChildrenn.setWbfbbje("-" + noriginalcurtaxmny.stripTrailingZeros().toPlainString());//借方本币无税金额
|
Assert.state(false, "金额计算失败 跑出异常:{}", e.getMessage());
|
||||||
// arapDjzbVOChildrenn.setJfybwsje("-" + noriginalcurtaxmny.stripTrailingZeros().toPlainString());//借方原币无税金额
|
}
|
||||||
|
|
||||||
// //退货没有邮费金额,已经向万万确认
|
// 组装应收单表体
|
||||||
// //平台优惠
|
List<ArapDjzbVO.Childrenn> pushScenarioType = new ArrayList<>();
|
||||||
// if (passiveStorageSonDetailsDto2.getVdef4() != null) {
|
ArapDjzbVO.Childrenn arapDjzbVOChildrenn = new ArapDjzbVO.Childrenn();
|
||||||
// BigDecimal vdef4 = passiveStorageSonDetailsDto2.getVdef4();
|
pushScenarioType.add(arapDjzbVOChildrenn);
|
||||||
// if (vdef4.compareTo(BigDecimal.ZERO) > 0) {
|
arapDjzbVOChildrenn.setCinventoryid(bdInvbasdocEntity.getInvcode());//存货管理档案
|
||||||
// //发货运费-存货基本档案
|
arapDjzbVOChildrenn.setJfbbje("-" + groupTotalPayAmount.stripTrailingZeros().toPlainString());//借方本币金额
|
||||||
// BdInvbasdocEntity bdInvbasdocEntity1 = mapBdInvbasdocEntity.get("FY01");
|
arapDjzbVOChildrenn.setJfybje("-" + groupTotalPayAmount.stripTrailingZeros().toPlainString());//借方原币金额
|
||||||
// //存货管理档案
|
arapDjzbVOChildrenn.setJfbbsj("-" + noriginalcurmny.stripTrailingZeros().toPlainString());//借方本币税金
|
||||||
// BdInvmandocEntity bdInvmandocEntity1 = stringBdInvmandocEntityMap.get(bdInvbasdocEntity1.getInvcode() + deliverGoodsCorp.getPkCorp());
|
arapDjzbVOChildrenn.setJfybsj("-" + noriginalcurmny.stripTrailingZeros().toPlainString());//借方原币税金
|
||||||
// //存货对应的税率
|
arapDjzbVOChildrenn.setWbfbbje("-" + noriginalcurtaxmny.stripTrailingZeros().toPlainString());//借方本币无税金额
|
||||||
// BdTaxitemsEntity bdTaxitemsEntity = stringBdTaxitemsEntityMap.get("FY01");
|
arapDjzbVOChildrenn.setJfybwsje("-" + noriginalcurtaxmny.stripTrailingZeros().toPlainString());//借方原币无税金额
|
||||||
// //补充:平台优惠-存货
|
|
||||||
// BigDecimal absAccumulatedPostage = vdef4.abs();
|
|
||||||
// BigDecimal negativeValue = absAccumulatedPostage.negate();
|
|
||||||
// queryAdditionUtil.additionalV2(pushScenarioType, bdInvmandocEntity1, bdInvbasdocEntity1, negativeValue, bdTaxitemsEntity);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// //达人优惠
|
|
||||||
// if (passiveStorageSonDetailsDto2.getVdef6() != null) {
|
|
||||||
// BigDecimal vdef6 = passiveStorageSonDetailsDto2.getVdef6();
|
|
||||||
// if (vdef6.compareTo(BigDecimal.ZERO) > 0) {
|
|
||||||
// //发货运费-存货基本档案
|
|
||||||
// BdInvbasdocEntity bdInvbasdocEntity1 = mapBdInvbasdocEntity.get("FY02");
|
|
||||||
// //存货管理档案
|
|
||||||
// BdInvmandocEntity bdInvmandocEntity1 = stringBdInvmandocEntityMap.get(bdInvbasdocEntity1.getInvcode() + deliverGoodsCorp.getPkCorp());
|
|
||||||
// //存货对应的税率
|
|
||||||
// BdTaxitemsEntity bdTaxitemsEntity = stringBdTaxitemsEntityMap.get("FY02");
|
|
||||||
// //补充:达人优惠-存货
|
|
||||||
// BigDecimal absAccumulatedPostage = vdef6.abs();
|
|
||||||
// BigDecimal negativeValue = absAccumulatedPostage.negate();
|
|
||||||
// queryAdditionUtil.additionalV2(pushScenarioType, bdInvmandocEntity1, bdInvbasdocEntity1, negativeValue, bdTaxitemsEntity);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//支付优惠
|
|
||||||
// if (passiveStorageSonDetailsDto2.getVdef5() != null) {
|
|
||||||
// BigDecimal vdef5 = passiveStorageSonDetailsDto2.getVdef5();
|
|
||||||
// if (vdef5.compareTo(BigDecimal.ZERO) > 0) {
|
|
||||||
// //发货运费-存货基本档案
|
|
||||||
// BdInvbasdocEntity bdInvbasdocEntity1 = mapBdInvbasdocEntity.get("FY04");
|
|
||||||
// //存货管理档案
|
|
||||||
// BdInvmandocEntity bdInvmandocEntity1 = stringBdInvmandocEntityMap.get(bdInvbasdocEntity1.getInvcode() + deliverGoodsCorp.getPkCorp());
|
|
||||||
// //存货对应的税率
|
|
||||||
// BdTaxitemsEntity bdTaxitemsEntity = stringBdTaxitemsEntityMap.get("FY04");
|
|
||||||
// //补充:支付优惠-存货
|
|
||||||
// BigDecimal absAccumulatedPostage = vdef5.abs();
|
|
||||||
// BigDecimal negativeValue = absAccumulatedPostage.negate();
|
|
||||||
// queryAdditionUtil.additionalV2(pushScenarioType, bdInvmandocEntity1, bdInvbasdocEntity1, negativeValue, bdTaxitemsEntity);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
//推送U8C
|
//退货没有邮费金额,已经向万万确认
|
||||||
// List<ArapDjzbVO> arapDjzbVOList = new ArrayList<>();
|
//平台优惠
|
||||||
// ArapDjzbVO arapDjzbVO = new ArapDjzbVO();
|
if (passiveStorageSonDetailsDto2.getVdef4() != null) {
|
||||||
// arapDjzbVO.setParentvo(parentVo);
|
BigDecimal vdef4 = passiveStorageSonDetailsDto2.getVdef4();
|
||||||
// arapDjzbVO.setChildren(pushScenarioType);
|
if (vdef4.compareTo(BigDecimal.ZERO) > 0) {
|
||||||
// arapDjzbVOList.add(arapDjzbVO);
|
//发货运费-存货基本档案
|
||||||
//
|
BdInvbasdocEntity bdInvbasdocEntity1 = mapBdInvbasdocEntity.get("FY01");
|
||||||
// Map<String, List<ArapDjzbVO>> listMap = new HashMap<>();
|
//存货管理档案
|
||||||
// listMap.put("djzbvo", arapDjzbVOList);
|
BdInvmandocEntity bdInvmandocEntity1 = stringBdInvmandocEntityMap.get(bdInvbasdocEntity1.getInvcode() + deliverGoodsCorp.getPkCorp());
|
||||||
// ArapDjzb arapDjzb = sendU8cRedReceivable(JSON.toJSONString(listMap));
|
//存货对应的税率
|
||||||
// String djbh = null;
|
BdTaxitemsEntity bdTaxitemsEntity = stringBdTaxitemsEntityMap.get("FY01");
|
||||||
// String dwbm = null;
|
//补充:平台优惠-存货
|
||||||
// String vouchid = null;
|
BigDecimal absAccumulatedPostage = vdef4.abs();
|
||||||
// if (arapDjzb != null && arapDjzb.getParentvo() != null) {
|
BigDecimal negativeValue = absAccumulatedPostage.negate();
|
||||||
// djbh = arapDjzb.getParentvo().getDjbh();
|
queryAdditionUtil.additionalV2(pushScenarioType, bdInvmandocEntity1, bdInvbasdocEntity1, negativeValue, bdTaxitemsEntity);
|
||||||
// dwbm = arapDjzb.getParentvo().getDwbm();
|
}
|
||||||
// vouchid = arapDjzb.getParentvo().getVouchid();
|
}
|
||||||
// }
|
//达人优惠
|
||||||
// logger.info("TOC红字应收单:{} 应收单主键:{} 销售公司:{}", djbh, vouchid, dwbm);
|
if (passiveStorageSonDetailsDto2.getVdef6() != null) {
|
||||||
//生成业务日期
|
BigDecimal vdef6 = passiveStorageSonDetailsDto2.getVdef6();
|
||||||
|
if (vdef6.compareTo(BigDecimal.ZERO) > 0) {
|
||||||
|
//发货运费-存货基本档案
|
||||||
|
BdInvbasdocEntity bdInvbasdocEntity1 = mapBdInvbasdocEntity.get("FY02");
|
||||||
|
//存货管理档案
|
||||||
|
BdInvmandocEntity bdInvmandocEntity1 = stringBdInvmandocEntityMap.get(bdInvbasdocEntity1.getInvcode() + deliverGoodsCorp.getPkCorp());
|
||||||
|
//存货对应的税率
|
||||||
|
BdTaxitemsEntity bdTaxitemsEntity = stringBdTaxitemsEntityMap.get("FY02");
|
||||||
|
//补充:达人优惠-存货
|
||||||
|
BigDecimal absAccumulatedPostage = vdef6.abs();
|
||||||
|
BigDecimal negativeValue = absAccumulatedPostage.negate();
|
||||||
|
queryAdditionUtil.additionalV2(pushScenarioType, bdInvmandocEntity1, bdInvbasdocEntity1, negativeValue, bdTaxitemsEntity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 支付优惠
|
||||||
|
if (passiveStorageSonDetailsDto2.getVdef5() != null) {
|
||||||
|
BigDecimal vdef5 = passiveStorageSonDetailsDto2.getVdef5();
|
||||||
|
if (vdef5.compareTo(BigDecimal.ZERO) > 0) {
|
||||||
|
//发货运费-存货基本档案
|
||||||
|
BdInvbasdocEntity bdInvbasdocEntity1 = mapBdInvbasdocEntity.get("FY04");
|
||||||
|
//存货管理档案
|
||||||
|
BdInvmandocEntity bdInvmandocEntity1 = stringBdInvmandocEntityMap.get(bdInvbasdocEntity1.getInvcode() + deliverGoodsCorp.getPkCorp());
|
||||||
|
//存货对应的税率
|
||||||
|
BdTaxitemsEntity bdTaxitemsEntity = stringBdTaxitemsEntityMap.get("FY04");
|
||||||
|
//补充:支付优惠-存货
|
||||||
|
BigDecimal absAccumulatedPostage = vdef5.abs();
|
||||||
|
BigDecimal negativeValue = absAccumulatedPostage.negate();
|
||||||
|
queryAdditionUtil.additionalV2(pushScenarioType, bdInvmandocEntity1, bdInvbasdocEntity1, negativeValue, bdTaxitemsEntity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 推送U8C
|
||||||
|
List<ArapDjzbVO> arapDjzbVOList = new ArrayList<>();
|
||||||
|
ArapDjzbVO arapDjzbVO = new ArapDjzbVO();
|
||||||
|
arapDjzbVO.setParentvo(parentVo);
|
||||||
|
arapDjzbVO.setChildren(pushScenarioType);
|
||||||
|
arapDjzbVOList.add(arapDjzbVO);
|
||||||
|
|
||||||
// updateSuccessOrFail3(value, "Y", "success", djbh, vouchid);
|
Map<String, List<ArapDjzbVO>> listMap = new HashMap<>();
|
||||||
// } catch (Exception e) {
|
listMap.put("djzbvo", arapDjzbVOList);
|
||||||
// logger.error("TOC红字应收单转换成U8C对象过程中、或者单据推送到U8C出现异常!", e);
|
ArapDjzb arapDjzb = sendU8cRedReceivable(JSON.toJSONString(listMap));
|
||||||
// //记录失败
|
String djbh = null;
|
||||||
// String message = e.getMessage();
|
String dwbm = null;
|
||||||
// if (message == null) {
|
String vouchid = null;
|
||||||
// message = "未知错误";
|
if (arapDjzb != null && arapDjzb.getParentvo() != null) {
|
||||||
// }
|
djbh = arapDjzb.getParentvo().getDjbh();
|
||||||
// updateSuccessOrFail3(value, "N", message, null, null);
|
dwbm = arapDjzb.getParentvo().getDwbm();
|
||||||
// }
|
vouchid = arapDjzb.getParentvo().getVouchid();
|
||||||
|
}
|
||||||
|
logger.info("TOC红字应收单:{} 应收单主键:{} 销售公司:{}", djbh, vouchid, dwbm);
|
||||||
|
// 记录同步状态
|
||||||
|
updateSuccessOrFail3(value, "Y", "success", djbh, vouchid, value.get(0).getStorageTimeStamp());
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("TOC红字应收单转换成U8C对象过程中、或者单据推送到U8C出现异常!", e);
|
||||||
|
//记录失败
|
||||||
|
String message = e.getMessage();
|
||||||
|
if (message == null) {
|
||||||
|
message = "未知错误";
|
||||||
|
}
|
||||||
|
updateSuccessOrFail3(value, "N", message, null, null, value.get(0).getStorageTimeStamp());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
//当金额大于或者等于0,数量大于0推送销售订单
|
||||||
String generateBusinessDate = value.get(0).getTargetBusinessDate().substring(0, 10);
|
if (groupTotalPayAmount1 != null && groupShipQty != null && groupTotalPayAmount1.compareTo(BigDecimal.ZERO) >= 0 && groupShipQty.compareTo(BigDecimal.ZERO) > 0) {
|
||||||
|
try {
|
||||||
|
String generateBusinessDate = value.get(0).getTargetBusinessDate().substring(0, 10);
|
||||||
|
|
||||||
SaleorderRequestDto saleorderRequestDto = new SaleorderRequestDto();
|
SaleorderRequestDto saleorderRequestDto = new SaleorderRequestDto();
|
||||||
SaleorderRequestParentDto saleorderRequestParentDto = new SaleorderRequestParentDto();
|
SaleorderRequestParentDto saleorderRequestParentDto = new SaleorderRequestParentDto();
|
||||||
saleorderRequestParentDto.setDbilldate(generateBusinessDate);//单据日期
|
saleorderRequestParentDto.setDbilldate(generateBusinessDate);//单据日期
|
||||||
saleorderRequestParentDto.setBretinvflag("Y");//退货标记
|
saleorderRequestParentDto.setBretinvflag("Y");//退货标记
|
||||||
saleorderRequestParentDto.setCbiztype(bdBusitypeEntity1.getPkBusitype());//业务流程
|
saleorderRequestParentDto.setCbiztype(bdBusitypeEntity1.getPkBusitype());//业务流程
|
||||||
saleorderRequestParentDto.setCcalbodyid(bdCalbodyEntity.getPkCalbody());//库存组织
|
saleorderRequestParentDto.setCcalbodyid(bdCalbodyEntity.getPkCalbody());//库存组织
|
||||||
saleorderRequestParentDto.setCcustomerid(bdCumandocEntity.getPkCumandoc());//客户=开票单位=收货单位=表体收货单位=收货单位
|
saleorderRequestParentDto.setCcustomerid(bdCumandocEntity.getPkCumandoc());//客户=开票单位=收货单位=表体收货单位=收货单位
|
||||||
saleorderRequestParentDto.setCdeptid(bdDeptdocEntity.getPkDeptdoc());//部门
|
saleorderRequestParentDto.setCdeptid(bdDeptdocEntity.getPkDeptdoc());//部门
|
||||||
saleorderRequestParentDto.setCemployeeid(null);//业务员
|
saleorderRequestParentDto.setCemployeeid(null);//业务员
|
||||||
saleorderRequestParentDto.setCoperatorid(OverallConstant.getOverAllValue("u8cApiZdrPK"));//制单人
|
saleorderRequestParentDto.setCoperatorid(OverallConstant.getOverAllValue("u8cApiZdrPK"));//制单人
|
||||||
saleorderRequestParentDto.setCreceiptcorpid(bdCumandocEntity.getPkCumandoc());//开票单位
|
saleorderRequestParentDto.setCreceiptcorpid(bdCumandocEntity.getPkCumandoc());//开票单位
|
||||||
saleorderRequestParentDto.setCreceiptcustomerid(bdCumandocEntity.getPkCumandoc());//收货单位
|
saleorderRequestParentDto.setCreceiptcustomerid(bdCumandocEntity.getPkCumandoc());//收货单位
|
||||||
saleorderRequestParentDto.setCsalecorpid(bdSalestruEntity.getCsalestruid());//销售组织
|
saleorderRequestParentDto.setCsalecorpid(bdSalestruEntity.getCsalestruid());//销售组织
|
||||||
saleorderRequestParentDto.setCwarehouseid(bdStordocEntity.getPkStordoc());//仓库
|
saleorderRequestParentDto.setCwarehouseid(bdStordocEntity.getPkStordoc());//仓库
|
||||||
saleorderRequestParentDto.setDapprovedate(generateBusinessDate);//审核日期
|
saleorderRequestParentDto.setDapprovedate(generateBusinessDate);//审核日期
|
||||||
saleorderRequestParentDto.setNdiscountrate("100.000000");//整单折扣
|
saleorderRequestParentDto.setNdiscountrate("100.000000");//整单折扣
|
||||||
saleorderRequestParentDto.setPk_corp(bdCorpEntity.getPkCorp());//公司id
|
saleorderRequestParentDto.setPk_corp(bdCorpEntity.getPkCorp());//公司id
|
||||||
//汇总单号=汇总维度
|
//汇总单号=汇总维度
|
||||||
saleorderRequestParentDto.setVdef18(key);
|
saleorderRequestParentDto.setVdef18(key);
|
||||||
//平台
|
//平台
|
||||||
saleorderRequestParentDto.setPk_defdoc2(platformArchives.getPkDefdoc());
|
saleorderRequestParentDto.setPk_defdoc2(platformArchives.getPkDefdoc());
|
||||||
saleorderRequestParentDto.setVdef2(platformArchives.getDocname());
|
saleorderRequestParentDto.setVdef2(platformArchives.getDocname());
|
||||||
saleorderRequestParentDto.setVdef17(ProfilesActiveConstant.sourceSystem1);//来源系统
|
saleorderRequestParentDto.setVdef17(ProfilesActiveConstant.sourceSystem1);//来源系统
|
||||||
|
|
||||||
//收发类别
|
//收发类别
|
||||||
saleorderRequestParentDto.setPk_defdoc3(bdRdclEntity.getPkRdcl());
|
saleorderRequestParentDto.setPk_defdoc3(bdRdclEntity.getPkRdcl());
|
||||||
saleorderRequestParentDto.setVdef3(bdRdclEntity.getRdname());
|
saleorderRequestParentDto.setVdef3(bdRdclEntity.getRdname());
|
||||||
|
|
||||||
//2024年8月8日 17:17:58 店铺档案自定义项1,先不传,后续维护好之后再传!
|
//2024年8月8日 17:17:58 店铺档案自定义项1,先不传,后续维护好之后再传!
|
||||||
//店铺
|
//店铺
|
||||||
saleorderRequestParentDto.setPk_defdoc1(shopArchives.getPkDefdoc());
|
saleorderRequestParentDto.setPk_defdoc1(shopArchives.getPkDefdoc());
|
||||||
saleorderRequestParentDto.setVdef1(shopArchives.getDocname());
|
saleorderRequestParentDto.setVdef1(shopArchives.getDocname());
|
||||||
|
|
||||||
//单据红字标识
|
//单据红字标识
|
||||||
saleorderRequestParentDto.setPk_defdoc16(OverallConstant.getOverAllValue("u8c自定义项档案-单据红字标识-Y主键"));
|
saleorderRequestParentDto.setPk_defdoc16(OverallConstant.getOverAllValue("u8c自定义项档案-单据红字标识-Y主键"));
|
||||||
saleorderRequestParentDto.setVdef16(OverallConstant.getOverAllValue("u8c自定义项档案-单据红字标识-Y名称"));
|
saleorderRequestParentDto.setVdef16(OverallConstant.getOverAllValue("u8c自定义项档案-单据红字标识-Y名称"));
|
||||||
|
|
||||||
//售后类型标识
|
//售后类型标识
|
||||||
saleorderRequestParentDto.setPk_defdoc8(OverallConstant.getOverAllValue("售后类型标识-TOC无源件-主键"));
|
saleorderRequestParentDto.setPk_defdoc8(OverallConstant.getOverAllValue("售后类型标识-TOC无源件-主键"));
|
||||||
saleorderRequestParentDto.setVdef8(OverallConstant.getOverAllValue("售后类型标识-TOC无源件-名称"));
|
saleorderRequestParentDto.setVdef8(OverallConstant.getOverAllValue("售后类型标识-TOC无源件-名称"));
|
||||||
|
|
||||||
saleorderRequestDto.setParentvo(saleorderRequestParentDto);
|
saleorderRequestDto.setParentvo(saleorderRequestParentDto);
|
||||||
|
|
||||||
List<SaleorderRequestChildrenDto> saleorderRequestChildrenDtoList = new ArrayList<>();
|
List<SaleorderRequestChildrenDto> saleorderRequestChildrenDtoList = new ArrayList<>();
|
||||||
saleorderRequestDto.setChildrenvo(saleorderRequestChildrenDtoList);
|
saleorderRequestDto.setChildrenvo(saleorderRequestChildrenDtoList);
|
||||||
|
|
||||||
//验证是否为指定的店铺,如果为true,则取结存价
|
//验证是否为指定的店铺,如果为true,则取结存价
|
||||||
Boolean isCheckShopChoose = balanceUnitPriceUtil.checkOfsShop(header.getStoreCode());
|
// Boolean isCheckShopChoose = balanceUnitPriceUtil.checkOfsShop(header.getStoreCode());
|
||||||
//把汇总好的出库单明细行合并成一行
|
//把汇总好的出库单明细行合并成一行
|
||||||
PassiveStorageSonDetailsDto2 passiveStorageSonDetailsDto2 = groupMergeDetailedRows2(value, isCheckShopChoose);
|
// PassiveStorageSonDetailsDto2 passiveStorageSonDetailsDto2 = groupMergeDetailedRows2(value, isCheckShopChoose);
|
||||||
|
|
||||||
//存货管理档案:取发货公司的存货管理档案
|
//存货管理档案:取发货公司的存货管理档案
|
||||||
BdInvmandocEntity bdInvmandocEntity = value.get(0).getBdInvmandocEntity();
|
BdInvmandocEntity bdInvmandocEntity = value.get(0).getBdInvmandocEntity();
|
||||||
//存货基础档案
|
//存货基础档案
|
||||||
BdInvbasdocEntity bdInvbasdocEntity = value.get(0).getBdInvbasdocEntity();
|
BdInvbasdocEntity bdInvbasdocEntity = value.get(0).getBdInvbasdocEntity();
|
||||||
//根据存货基础档案编码,查询当前存货的税率
|
//根据存货基础档案编码,查询当前存货的税率
|
||||||
BdTaxitemsEntity bdTaxitemsEntity1 = value.get(0).getBdTaxitemsEntity();
|
BdTaxitemsEntity bdTaxitemsEntity1 = value.get(0).getBdTaxitemsEntity();
|
||||||
//查询收支项目
|
//查询收支项目
|
||||||
// BdInvclEntity bdInvclEntity = queryU8CEntityUtil.queryBdInvbasdocByBdInvcl(bdInvbasdocEntity);
|
// BdInvclEntity bdInvclEntity = queryU8CEntityUtil.queryBdInvbasdocByBdInvcl(bdInvbasdocEntity);
|
||||||
// BdCostsubjEntity bdCostsubjEntity = queryU8CEntityUtil.queryBdCostsubj(bdInvclEntity);
|
// BdCostsubjEntity bdCostsubjEntity = queryU8CEntityUtil.queryBdCostsubj(bdInvclEntity);
|
||||||
|
|
||||||
|
@ -1314,189 +1321,189 @@ public class PassiveWarehouseReceiptToC extends PluginBaseEntity {
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// 判断是否为赠品
|
// 判断是否为赠品
|
||||||
Boolean isblargessflag = false;
|
Boolean isblargessflag = false;
|
||||||
if ("0".equals(passiveStorageSonDetailsDto2.getGroupTotalPayAmount().setScale(2, BigDecimal.ROUND_HALF_UP).stripTrailingZeros().toPlainString())) {
|
if ("0".equals(passiveStorageSonDetailsDto2.getGroupTotalPayAmount().setScale(2, BigDecimal.ROUND_HALF_UP).stripTrailingZeros().toPlainString())) {
|
||||||
isblargessflag = true;
|
isblargessflag = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//合并后如果数量为0,则过滤掉
|
//合并后如果数量为0,则过滤掉
|
||||||
if ("0".equals(passiveStorageSonDetailsDto2.getGroupShipQty().stripTrailingZeros().toPlainString())) {
|
if ("0".equals(passiveStorageSonDetailsDto2.getGroupShipQty().stripTrailingZeros().toPlainString())) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
SaleorderRequestChildrenDto saleorderRequestChildrenDto = new SaleorderRequestChildrenDto();
|
SaleorderRequestChildrenDto saleorderRequestChildrenDto = new SaleorderRequestChildrenDto();
|
||||||
saleorderRequestChildrenDto.setBlargessflag(isblargessflag);//是否赠品
|
saleorderRequestChildrenDto.setBlargessflag(isblargessflag);//是否赠品
|
||||||
saleorderRequestChildrenDto.setCadvisecalbodyid(bdCalbodyEntity.getPkCalbody());//发货库存组织
|
saleorderRequestChildrenDto.setCadvisecalbodyid(bdCalbodyEntity.getPkCalbody());//发货库存组织
|
||||||
saleorderRequestChildrenDto.setCbodywarehouseid(bdStordocEntity.getPkStordoc());//发货仓库
|
saleorderRequestChildrenDto.setCbodywarehouseid(bdStordocEntity.getPkStordoc());//发货仓库
|
||||||
saleorderRequestChildrenDto.setCconsigncorpid(deliverGoodsCorp.getPkCorp());//发货公司
|
saleorderRequestChildrenDto.setCconsigncorpid(deliverGoodsCorp.getPkCorp());//发货公司
|
||||||
saleorderRequestChildrenDto.setCcurrencytypeid("00010000000000000001");//币种
|
saleorderRequestChildrenDto.setCcurrencytypeid("00010000000000000001");//币种
|
||||||
saleorderRequestChildrenDto.setCinventoryid(bdInvmandocEntity.getPkInvmandoc());//存货id
|
saleorderRequestChildrenDto.setCinventoryid(bdInvmandocEntity.getPkInvmandoc());//存货id
|
||||||
saleorderRequestChildrenDto.setCreceiptcorpid(bdCumandocEntity.getPkCumandoc());//收货单位
|
saleorderRequestChildrenDto.setCreceiptcorpid(bdCumandocEntity.getPkCumandoc());//收货单位
|
||||||
saleorderRequestChildrenDto.setDconsigndate(generateBusinessDate);//计划发货日期
|
saleorderRequestChildrenDto.setDconsigndate(generateBusinessDate);//计划发货日期
|
||||||
saleorderRequestChildrenDto.setDdeliverdate(generateBusinessDate);// 要求收货日期
|
saleorderRequestChildrenDto.setDdeliverdate(generateBusinessDate);// 要求收货日期
|
||||||
saleorderRequestChildrenDto.setNexchangeotobrate("1.00000000");//折本汇率
|
saleorderRequestChildrenDto.setNexchangeotobrate("1.00000000");//折本汇率
|
||||||
saleorderRequestChildrenDto.setNitemdiscountrate("100.000000");//单品折扣
|
saleorderRequestChildrenDto.setNitemdiscountrate("100.000000");//单品折扣
|
||||||
saleorderRequestChildrenDto.setNnumber("-" + passiveStorageSonDetailsDto2.getGroupShipQty().stripTrailingZeros().toPlainString());//数量
|
saleorderRequestChildrenDto.setNnumber("-" + passiveStorageSonDetailsDto2.getGroupShipQty().stripTrailingZeros().toPlainString());//数量
|
||||||
saleorderRequestChildrenDto.setNoriginalcurdiscountmny("0");//折扣额
|
saleorderRequestChildrenDto.setNoriginalcurdiscountmny("0");//折扣额
|
||||||
// saleorderRequestChildrenDto.setNoriginalcurmny("-" + noriginalcurmny.stripTrailingZeros().toPlainString());//无税金额
|
// saleorderRequestChildrenDto.setNoriginalcurmny("-" + noriginalcurmny.stripTrailingZeros().toPlainString());//无税金额
|
||||||
// saleorderRequestChildrenDto.setNoriginalcurnetprice(noriginalcurprice.stripTrailingZeros().toPlainString());//无税净价
|
// saleorderRequestChildrenDto.setNoriginalcurnetprice(noriginalcurprice.stripTrailingZeros().toPlainString());//无税净价
|
||||||
// saleorderRequestChildrenDto.setNoriginalcurprice(noriginalcurprice.stripTrailingZeros().toPlainString());//无税单价
|
// saleorderRequestChildrenDto.setNoriginalcurprice(noriginalcurprice.stripTrailingZeros().toPlainString());//无税单价
|
||||||
// saleorderRequestChildrenDto.setNoriginalcursummny("-" + noriginalcursummny.stripTrailingZeros().toPlainString());//价税合计
|
// saleorderRequestChildrenDto.setNoriginalcursummny("-" + noriginalcursummny.stripTrailingZeros().toPlainString());//价税合计
|
||||||
if (isblargessflag) {
|
if (isblargessflag) {
|
||||||
saleorderRequestChildrenDto.setNoriginalcursummny("0");
|
saleorderRequestChildrenDto.setNoriginalcursummny("0");
|
||||||
} else {
|
} else {
|
||||||
saleorderRequestChildrenDto.setNoriginalcursummny("-" + passiveStorageSonDetailsDto2.getGroupTotalPayAmount().setScale(2, BigDecimal.ROUND_HALF_UP).stripTrailingZeros().toPlainString());//价税合计
|
saleorderRequestChildrenDto.setNoriginalcursummny("-" + passiveStorageSonDetailsDto2.getGroupTotalPayAmount().setScale(2, BigDecimal.ROUND_HALF_UP).stripTrailingZeros().toPlainString());//价税合计
|
||||||
}
|
}
|
||||||
// saleorderRequestChildrenDto.setNoriginalcurtaxmny("-" + noriginalcurtaxmny.stripTrailingZeros().toPlainString());//税额
|
// saleorderRequestChildrenDto.setNoriginalcurtaxmny("-" + noriginalcurtaxmny.stripTrailingZeros().toPlainString());//税额
|
||||||
// saleorderRequestChildrenDto.setNoriginalcurtaxnetprice(noriginalcurtaxprice.stripTrailingZeros().toPlainString());//含税净价
|
// saleorderRequestChildrenDto.setNoriginalcurtaxnetprice(noriginalcurtaxprice.stripTrailingZeros().toPlainString());//含税净价
|
||||||
// saleorderRequestChildrenDto.setNoriginalcurtaxprice(noriginalcurtaxprice.stripTrailingZeros().toPlainString());//含税单价
|
// saleorderRequestChildrenDto.setNoriginalcurtaxprice(noriginalcurtaxprice.stripTrailingZeros().toPlainString());//含税单价
|
||||||
// saleorderRequestChildrenDto.setNtaxrate(new BigDecimal(bdTaxitemsEntity1.getTaxratio()).stripTrailingZeros().toPlainString());//税率
|
// saleorderRequestChildrenDto.setNtaxrate(new BigDecimal(bdTaxitemsEntity1.getTaxratio()).stripTrailingZeros().toPlainString());//税率
|
||||||
// saleorderRequestChildrenDto.setVdef2(bdCostsubjEntity.getCostname());//收支项目
|
// saleorderRequestChildrenDto.setVdef2(bdCostsubjEntity.getCostname());//收支项目
|
||||||
// saleorderRequestChildrenDto.setPk_defdoc2(bdCostsubjEntity.getPkCostsubj());
|
// saleorderRequestChildrenDto.setPk_defdoc2(bdCostsubjEntity.getPkCostsubj());
|
||||||
//如果优惠金额为0,则传0
|
//如果优惠金额为0,则传0
|
||||||
if (!"0".equals(passiveStorageSonDetailsDto2.getVdef4().stripTrailingZeros().toPlainString())) {
|
if (!"0".equals(passiveStorageSonDetailsDto2.getVdef4().stripTrailingZeros().toPlainString())) {
|
||||||
saleorderRequestChildrenDto.setVdef4("-" + passiveStorageSonDetailsDto2.getVdef4().stripTrailingZeros().toPlainString());
|
saleorderRequestChildrenDto.setVdef4("-" + passiveStorageSonDetailsDto2.getVdef4().stripTrailingZeros().toPlainString());
|
||||||
} else {
|
} else {
|
||||||
saleorderRequestChildrenDto.setVdef4("0");
|
saleorderRequestChildrenDto.setVdef4("0");
|
||||||
}
|
}
|
||||||
if (!"0".equals(passiveStorageSonDetailsDto2.getVdef5().stripTrailingZeros().toPlainString())) {
|
if (!"0".equals(passiveStorageSonDetailsDto2.getVdef5().stripTrailingZeros().toPlainString())) {
|
||||||
saleorderRequestChildrenDto.setVdef5("-" + passiveStorageSonDetailsDto2.getVdef5().stripTrailingZeros().toPlainString());
|
saleorderRequestChildrenDto.setVdef5("-" + passiveStorageSonDetailsDto2.getVdef5().stripTrailingZeros().toPlainString());
|
||||||
} else {
|
} else {
|
||||||
saleorderRequestChildrenDto.setVdef5("0");
|
saleorderRequestChildrenDto.setVdef5("0");
|
||||||
}
|
}
|
||||||
if (!"0".equals(passiveStorageSonDetailsDto2.getVdef6().stripTrailingZeros().toPlainString())) {
|
if (!"0".equals(passiveStorageSonDetailsDto2.getVdef6().stripTrailingZeros().toPlainString())) {
|
||||||
saleorderRequestChildrenDto.setVdef6("-" + passiveStorageSonDetailsDto2.getVdef6().stripTrailingZeros().toPlainString());
|
saleorderRequestChildrenDto.setVdef6("-" + passiveStorageSonDetailsDto2.getVdef6().stripTrailingZeros().toPlainString());
|
||||||
} else {
|
} else {
|
||||||
saleorderRequestChildrenDto.setVdef6("0");
|
saleorderRequestChildrenDto.setVdef6("0");
|
||||||
}
|
}
|
||||||
if (!"0".equals(passiveStorageSonDetailsDto2.getVdef7().stripTrailingZeros().toPlainString())) {
|
if (!"0".equals(passiveStorageSonDetailsDto2.getVdef7().stripTrailingZeros().toPlainString())) {
|
||||||
saleorderRequestChildrenDto.setVdef7("-" + passiveStorageSonDetailsDto2.getVdef7().stripTrailingZeros().toPlainString());
|
saleorderRequestChildrenDto.setVdef7("-" + passiveStorageSonDetailsDto2.getVdef7().stripTrailingZeros().toPlainString());
|
||||||
} else {
|
} else {
|
||||||
saleorderRequestChildrenDto.setVdef7("0");
|
saleorderRequestChildrenDto.setVdef7("0");
|
||||||
}
|
}
|
||||||
saleorderRequestChildrenDtoList.add(saleorderRequestChildrenDto);
|
saleorderRequestChildrenDtoList.add(saleorderRequestChildrenDto);
|
||||||
|
|
||||||
//如果合并后的金额为0,则不传到U8C
|
//如果合并后的金额为0,则不传到U8C
|
||||||
Assert.notNull(passiveStorageSonDetailsDto2.getGroupTotalPayAmount(), "goodsRertunSonDetailsDto.getGroupTotalPayAmount()不能为空!");
|
Assert.notNull(passiveStorageSonDetailsDto2.getGroupTotalPayAmount(), "goodsRertunSonDetailsDto.getGroupTotalPayAmount()不能为空!");
|
||||||
// BigDecimal groupTotalPayAmount = passiveStorageSonDetailsDto2.getGroupTotalPayAmount().setScale(2, BigDecimal.ROUND_HALF_UP);
|
// BigDecimal groupTotalPayAmount = passiveStorageSonDetailsDto2.getGroupTotalPayAmount().setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||||
// if ("0".equals(groupTotalPayAmount.stripTrailingZeros().toPlainString())) {
|
// if ("0".equals(groupTotalPayAmount.stripTrailingZeros().toPlainString())) {
|
||||||
// continue;
|
// continue;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
//退货没有邮费金额,已经向万万确认
|
//退货没有邮费金额,已经向万万确认
|
||||||
//平台优惠
|
//平台优惠
|
||||||
if (passiveStorageSonDetailsDto2.getVdef4() != null) {
|
if (passiveStorageSonDetailsDto2.getVdef4() != null) {
|
||||||
BigDecimal vdef4 = passiveStorageSonDetailsDto2.getVdef4();
|
BigDecimal vdef4 = passiveStorageSonDetailsDto2.getVdef4();
|
||||||
if (vdef4.compareTo(BigDecimal.ZERO) > 0) {
|
if (vdef4.compareTo(BigDecimal.ZERO) > 0) {
|
||||||
//发货运费-存货基本档案
|
//发货运费-存货基本档案
|
||||||
BdInvbasdocEntity bdInvbasdocEntity1 = mapBdInvbasdocEntity.get("FY01");
|
BdInvbasdocEntity bdInvbasdocEntity1 = mapBdInvbasdocEntity.get("FY01");
|
||||||
//存货管理档案
|
//存货管理档案
|
||||||
BdInvmandocEntity bdInvmandocEntity1 = stringBdInvmandocEntityMap.get(bdInvbasdocEntity1.getInvcode() + deliverGoodsCorp.getPkCorp());
|
BdInvmandocEntity bdInvmandocEntity1 = stringBdInvmandocEntityMap.get(bdInvbasdocEntity1.getInvcode() + deliverGoodsCorp.getPkCorp());
|
||||||
//存货对应的税率
|
//存货对应的税率
|
||||||
BdTaxitemsEntity bdTaxitemsEntity = stringBdTaxitemsEntityMap.get("FY01");
|
BdTaxitemsEntity bdTaxitemsEntity = stringBdTaxitemsEntityMap.get("FY01");
|
||||||
//补充:平台优惠-存货
|
//补充:平台优惠-存货
|
||||||
BigDecimal absAccumulatedPostage = vdef4.abs();
|
BigDecimal absAccumulatedPostage = vdef4.abs();
|
||||||
BigDecimal negativeValue = absAccumulatedPostage.negate();
|
BigDecimal negativeValue = absAccumulatedPostage.negate();
|
||||||
queryAdditionUtil.additional(saleorderRequestChildrenDtoList, bdInvmandocEntity1, bdInvbasdocEntity1, negativeValue, "-1", bdTaxitemsEntity);
|
queryAdditionUtil.additional(saleorderRequestChildrenDtoList, bdInvmandocEntity1, bdInvbasdocEntity1, negativeValue, "-1", bdTaxitemsEntity);
|
||||||
}
|
|
||||||
}
|
|
||||||
//达人优惠
|
|
||||||
if (passiveStorageSonDetailsDto2.getVdef6() != null) {
|
|
||||||
BigDecimal vdef6 = passiveStorageSonDetailsDto2.getVdef6();
|
|
||||||
if (vdef6.compareTo(BigDecimal.ZERO) > 0) {
|
|
||||||
//发货运费-存货基本档案
|
|
||||||
BdInvbasdocEntity bdInvbasdocEntity1 = mapBdInvbasdocEntity.get("FY02");
|
|
||||||
//存货管理档案
|
|
||||||
BdInvmandocEntity bdInvmandocEntity1 = stringBdInvmandocEntityMap.get(bdInvbasdocEntity1.getInvcode() + deliverGoodsCorp.getPkCorp());
|
|
||||||
//存货对应的税率
|
|
||||||
BdTaxitemsEntity bdTaxitemsEntity = stringBdTaxitemsEntityMap.get("FY02");
|
|
||||||
//补充:达人优惠-存货
|
|
||||||
BigDecimal absAccumulatedPostage = vdef6.abs();
|
|
||||||
BigDecimal negativeValue = absAccumulatedPostage.negate();
|
|
||||||
queryAdditionUtil.additional(saleorderRequestChildrenDtoList, bdInvmandocEntity1, bdInvbasdocEntity1, negativeValue, "-1", bdTaxitemsEntity);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//支付优惠
|
|
||||||
if (passiveStorageSonDetailsDto2.getVdef5() != null) {
|
|
||||||
BigDecimal vdef5 = passiveStorageSonDetailsDto2.getVdef5();
|
|
||||||
if (vdef5.compareTo(BigDecimal.ZERO) > 0) {
|
|
||||||
//发货运费-存货基本档案
|
|
||||||
BdInvbasdocEntity bdInvbasdocEntity1 = mapBdInvbasdocEntity.get("FY04");
|
|
||||||
//存货管理档案
|
|
||||||
BdInvmandocEntity bdInvmandocEntity1 = stringBdInvmandocEntityMap.get(bdInvbasdocEntity1.getInvcode() + deliverGoodsCorp.getPkCorp());
|
|
||||||
//存货对应的税率
|
|
||||||
BdTaxitemsEntity bdTaxitemsEntity = stringBdTaxitemsEntityMap.get("FY04");
|
|
||||||
//补充:支付优惠-存货
|
|
||||||
BigDecimal absAccumulatedPostage = vdef5.abs();
|
|
||||||
BigDecimal negativeValue = absAccumulatedPostage.negate();// 符号取反(转为负数)
|
|
||||||
queryAdditionUtil.additional(saleorderRequestChildrenDtoList, bdInvmandocEntity1, bdInvbasdocEntity1, negativeValue, "-1", bdTaxitemsEntity);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean oneSuccess = false;
|
|
||||||
if (!"Y".equals(newState)) {
|
|
||||||
//推送U8C红字销售订单,如果推送失败,抛出异常,那么就会外围的try catch捕获,代码不会往下执行
|
|
||||||
|
|
||||||
List<SaleorderRequestDto> saleorderRequestDtoList = new ArrayList<>();
|
|
||||||
saleorderRequestDtoList.add(saleorderRequestDto);
|
|
||||||
Map<String, List<SaleorderRequestDto>> stringStringMap = new HashMap<>();
|
|
||||||
stringStringMap.put("saleorder", saleorderRequestDtoList);
|
|
||||||
SoSaleResultRootDto soSaleResultRootDto = sendU8CTOCOrder(JSON.toJSONString(stringStringMap));
|
|
||||||
String vreceiptcode = null;
|
|
||||||
String pk_corp = null;
|
|
||||||
String csaleid = null;
|
|
||||||
if (soSaleResultRootDto != null && soSaleResultRootDto.getParentvo() != null) {
|
|
||||||
vreceiptcode = soSaleResultRootDto.getParentvo().getVreceiptcode();
|
|
||||||
pk_corp = soSaleResultRootDto.getParentvo().getPk_corp();
|
|
||||||
csaleid = soSaleResultRootDto.getParentvo().getCsaleid();
|
|
||||||
}
|
|
||||||
logger.info("TOC红字销售订单编号:{} 销售订单主键:{} 销售公司:{}", vreceiptcode, csaleid, pk_corp);
|
|
||||||
updateSuccessOrFail3(value, "Y", "success", vreceiptcode, csaleid, value.get(0).getStorageTimeStamp());
|
|
||||||
oneSuccess = true;
|
|
||||||
} else {
|
|
||||||
oneSuccess = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
//判断关联时间与交易成功时间,推送u8c生成蓝字销售订单,仅满足情况二的条件才生成这张蓝字销售订单
|
|
||||||
try {
|
|
||||||
if (!"Y".equals(def10) && oneSuccess && "2".equals(value.get(0).getStorageTimeStamp())) {
|
|
||||||
SaleorderRequestDto saleorderRequestDto1 = transformRedSalesOrderToBlueSalesOrder(saleorderRequestDto, bdBusitypeEntity2);
|
|
||||||
|
|
||||||
List<SaleorderRequestDto> saleorderRequestDtoList2 = new ArrayList<>();
|
|
||||||
saleorderRequestDtoList2.add(saleorderRequestDto1);
|
|
||||||
Map<String, List<SaleorderRequestDto>> stringStringMap2 = new HashMap<>();
|
|
||||||
stringStringMap2.put("saleorder", saleorderRequestDtoList2);
|
|
||||||
SoSaleResultRootDto soSaleResultRootDto2 = sendU8CTOCOrder(JSON.toJSONString(stringStringMap2));
|
|
||||||
|
|
||||||
String vreceiptcode2 = null;
|
|
||||||
String pk_corp2 = null;
|
|
||||||
String csaleid2 = null;
|
|
||||||
if (soSaleResultRootDto2 != null && soSaleResultRootDto2.getParentvo() != null) {
|
|
||||||
vreceiptcode2 = soSaleResultRootDto2.getParentvo().getVreceiptcode();
|
|
||||||
pk_corp2 = soSaleResultRootDto2.getParentvo().getPk_corp();
|
|
||||||
csaleid2 = soSaleResultRootDto2.getParentvo().getCsaleid();
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
//达人优惠
|
||||||
|
if (passiveStorageSonDetailsDto2.getVdef6() != null) {
|
||||||
|
BigDecimal vdef6 = passiveStorageSonDetailsDto2.getVdef6();
|
||||||
|
if (vdef6.compareTo(BigDecimal.ZERO) > 0) {
|
||||||
|
//发货运费-存货基本档案
|
||||||
|
BdInvbasdocEntity bdInvbasdocEntity1 = mapBdInvbasdocEntity.get("FY02");
|
||||||
|
//存货管理档案
|
||||||
|
BdInvmandocEntity bdInvmandocEntity1 = stringBdInvmandocEntityMap.get(bdInvbasdocEntity1.getInvcode() + deliverGoodsCorp.getPkCorp());
|
||||||
|
//存货对应的税率
|
||||||
|
BdTaxitemsEntity bdTaxitemsEntity = stringBdTaxitemsEntityMap.get("FY02");
|
||||||
|
//补充:达人优惠-存货
|
||||||
|
BigDecimal absAccumulatedPostage = vdef6.abs();
|
||||||
|
BigDecimal negativeValue = absAccumulatedPostage.negate();
|
||||||
|
queryAdditionUtil.additional(saleorderRequestChildrenDtoList, bdInvmandocEntity1, bdInvbasdocEntity1, negativeValue, "-1", bdTaxitemsEntity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//支付优惠
|
||||||
|
if (passiveStorageSonDetailsDto2.getVdef5() != null) {
|
||||||
|
BigDecimal vdef5 = passiveStorageSonDetailsDto2.getVdef5();
|
||||||
|
if (vdef5.compareTo(BigDecimal.ZERO) > 0) {
|
||||||
|
//发货运费-存货基本档案
|
||||||
|
BdInvbasdocEntity bdInvbasdocEntity1 = mapBdInvbasdocEntity.get("FY04");
|
||||||
|
//存货管理档案
|
||||||
|
BdInvmandocEntity bdInvmandocEntity1 = stringBdInvmandocEntityMap.get(bdInvbasdocEntity1.getInvcode() + deliverGoodsCorp.getPkCorp());
|
||||||
|
//存货对应的税率
|
||||||
|
BdTaxitemsEntity bdTaxitemsEntity = stringBdTaxitemsEntityMap.get("FY04");
|
||||||
|
//补充:支付优惠-存货
|
||||||
|
BigDecimal absAccumulatedPostage = vdef5.abs();
|
||||||
|
BigDecimal negativeValue = absAccumulatedPostage.negate();// 符号取反(转为负数)
|
||||||
|
queryAdditionUtil.additional(saleorderRequestChildrenDtoList, bdInvmandocEntity1, bdInvbasdocEntity1, negativeValue, "-1", bdTaxitemsEntity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
logger.info("TOC蓝字销售订单编号:{} 销售订单主键:{} 销售公司:{}", vreceiptcode2, csaleid2, pk_corp2);
|
boolean oneSuccess = false;
|
||||||
updateSuccessOrFail4(value, "Y", "success", vreceiptcode2, csaleid2, value.get(0).getStorageTimeStamp());
|
if (!"Y".equals(newState)) {
|
||||||
|
//推送U8C红字销售订单,如果推送失败,抛出异常,那么就会外围的try catch捕获,代码不会往下执行
|
||||||
|
List<SaleorderRequestDto> saleorderRequestDtoList = new ArrayList<>();
|
||||||
|
saleorderRequestDtoList.add(saleorderRequestDto);
|
||||||
|
Map<String, List<SaleorderRequestDto>> stringStringMap = new HashMap<>();
|
||||||
|
stringStringMap.put("saleorder", saleorderRequestDtoList);
|
||||||
|
SoSaleResultRootDto soSaleResultRootDto = sendU8CTOCOrder(JSON.toJSONString(stringStringMap));
|
||||||
|
String vreceiptcode = null;
|
||||||
|
String pk_corp = null;
|
||||||
|
String csaleid = null;
|
||||||
|
if (soSaleResultRootDto != null && soSaleResultRootDto.getParentvo() != null) {
|
||||||
|
vreceiptcode = soSaleResultRootDto.getParentvo().getVreceiptcode();
|
||||||
|
pk_corp = soSaleResultRootDto.getParentvo().getPk_corp();
|
||||||
|
csaleid = soSaleResultRootDto.getParentvo().getCsaleid();
|
||||||
|
}
|
||||||
|
logger.info("TOC红字销售订单编号:{} 销售订单主键:{} 销售公司:{}", vreceiptcode, csaleid, pk_corp);
|
||||||
|
updateSuccessOrFail3(value, "Y", "success", vreceiptcode, csaleid, value.get(0).getStorageTimeStamp());
|
||||||
|
oneSuccess = true;
|
||||||
|
} else {
|
||||||
|
oneSuccess = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//判断关联时间与交易成功时间,推送u8c生成蓝字销售订单,仅满足情况二的条件才生成这张蓝字销售订单
|
||||||
|
try {
|
||||||
|
if (!"Y".equals(def10) && oneSuccess && "2".equals(value.get(0).getStorageTimeStamp())) {
|
||||||
|
SaleorderRequestDto saleorderRequestDto1 = transformRedSalesOrderToBlueSalesOrder(saleorderRequestDto, bdBusitypeEntity2);
|
||||||
|
|
||||||
|
List<SaleorderRequestDto> saleorderRequestDtoList2 = new ArrayList<>();
|
||||||
|
saleorderRequestDtoList2.add(saleorderRequestDto1);
|
||||||
|
Map<String, List<SaleorderRequestDto>> stringStringMap2 = new HashMap<>();
|
||||||
|
stringStringMap2.put("saleorder", saleorderRequestDtoList2);
|
||||||
|
SoSaleResultRootDto soSaleResultRootDto2 = sendU8CTOCOrder(JSON.toJSONString(stringStringMap2));
|
||||||
|
|
||||||
|
String vreceiptcode2 = null;
|
||||||
|
String pk_corp2 = null;
|
||||||
|
String csaleid2 = null;
|
||||||
|
if (soSaleResultRootDto2 != null && soSaleResultRootDto2.getParentvo() != null) {
|
||||||
|
vreceiptcode2 = soSaleResultRootDto2.getParentvo().getVreceiptcode();
|
||||||
|
pk_corp2 = soSaleResultRootDto2.getParentvo().getPk_corp();
|
||||||
|
csaleid2 = soSaleResultRootDto2.getParentvo().getCsaleid();
|
||||||
|
}
|
||||||
|
|
||||||
|
logger.info("TOC蓝字销售订单编号:{} 销售订单主键:{} 销售公司:{}", vreceiptcode2, csaleid2, pk_corp2);
|
||||||
|
updateSuccessOrFail4(value, "Y", "success", vreceiptcode2, csaleid2, value.get(0).getStorageTimeStamp());
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
//记录蓝字销售订单异常失败
|
||||||
|
logger.error("推送蓝字销售订单抛出异常!", e);
|
||||||
|
String message = e.getMessage();
|
||||||
|
if (message == null) {
|
||||||
|
message = "未知错误";
|
||||||
|
}
|
||||||
|
updateSuccessOrFail4(value, "N", message, null, null, value.get(0).getStorageTimeStamp());
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
//记录蓝字销售订单异常失败
|
//记录红字销售订单异常失败
|
||||||
logger.error("推送蓝字销售订单抛出异常!", e);
|
logger.error("TOC退货业务转换成U8C对象过程中、或者单据推送到U8C出现异常!", e);
|
||||||
String message = e.getMessage();
|
String message = e.getMessage();
|
||||||
if (message == null) {
|
if (message == null) {
|
||||||
message = "未知错误";
|
message = "未知错误";
|
||||||
}
|
}
|
||||||
updateSuccessOrFail4(value, "N", message, null, null, value.get(0).getStorageTimeStamp());
|
updateSuccessOrFail3(value, "N", message, null, null, value.get(0).getStorageTimeStamp());
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
|
||||||
//记录红字销售订单异常失败
|
|
||||||
logger.error("TOC退货业务转换成U8C对象过程中、或者单据推送到U8C出现异常!", e);
|
|
||||||
String message = e.getMessage();
|
|
||||||
if (message == null) {
|
|
||||||
message = "未知错误";
|
|
||||||
}
|
|
||||||
updateSuccessOrFail3(value, "N", message, null, null, value.get(0).getStorageTimeStamp());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -2537,6 +2544,20 @@ public class PassiveWarehouseReceiptToC extends PluginBaseEntity {
|
||||||
return bdBusitypeEntity;
|
return bdBusitypeEntity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 2025年8月15日15:58:55 查询U8C业务流程
|
||||||
|
*
|
||||||
|
* @author liuyang
|
||||||
|
*/
|
||||||
|
private BdBusitypeEntity u8cOperationFlowV4() throws Exception {
|
||||||
|
//查询业务流程
|
||||||
|
//2024年8月6日 11:33:07 具体的业务流程名称,还需要实施提供
|
||||||
|
String processName = "TOC销售退款";
|
||||||
|
BdBusitypeEntity bdBusitypeEntity = queryBdBusitypeUtil.queryBdBusitype(processName);
|
||||||
|
Assert.notNull(bdBusitypeEntity, "根据业务流程名称({})没有查询到业务流程", processName);
|
||||||
|
return bdBusitypeEntity;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 检查参数是否为空
|
* 检查参数是否为空
|
||||||
* 2024年8月6日 11:40:19 保险的做法,最好还是验证一下
|
* 2024年8月6日 11:40:19 保险的做法,最好还是验证一下
|
||||||
|
@ -2911,6 +2932,16 @@ public class PassiveWarehouseReceiptToC extends PluginBaseEntity {
|
||||||
if (header.getRelatedAt() != null) {
|
if (header.getRelatedAt() != null) {
|
||||||
ofsPassiveorderDetailEntity.setBusinessdate(header.getRelatedAt());
|
ofsPassiveorderDetailEntity.setBusinessdate(header.getRelatedAt());
|
||||||
}
|
}
|
||||||
|
//交易成功时间
|
||||||
|
HeaderDetailsDto headerDetailsDto = header.getHeaderDetailsDto();
|
||||||
|
if (headerDetailsDto != null && headerDetailsDto.getHeader() != null) {
|
||||||
|
HeaderDto header1 = headerDetailsDto.getHeader();
|
||||||
|
String tradeSuccessAt = header1.getTradeSuccessAt();
|
||||||
|
if (tradeSuccessAt != null) {
|
||||||
|
ofsPassiveorderDetailEntity.setDef11(tradeSuccessAt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//业务类型
|
//业务类型
|
||||||
ofsPassiveorderDetailEntity.setBusinesstype("TOC_ORDER");
|
ofsPassiveorderDetailEntity.setBusinesstype("TOC_ORDER");
|
||||||
}
|
}
|
||||||
|
@ -2949,6 +2980,19 @@ public class PassiveWarehouseReceiptToC extends PluginBaseEntity {
|
||||||
String relatedAt = header2.getRelatedAt();
|
String relatedAt = header2.getRelatedAt();
|
||||||
DateTime relatedAtDate = DateUtil.parse(relatedAt);
|
DateTime relatedAtDate = DateUtil.parse(relatedAt);
|
||||||
|
|
||||||
|
HeaderDetailsDto headerDetailsDto1 = header.getHeaderDetailsDto();
|
||||||
|
if (headerDetailsDto1 != null && headerDetailsDto1.getHeader() != null) {
|
||||||
|
HeaderDto header3 = headerDetailsDto1.getHeader();
|
||||||
|
if (header3.getTradeSuccessAt() != null) {
|
||||||
|
ofsPassiveorderDetailEntity.setDef13(header3.getTradeSuccessAt());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String storageTimeStamp = header.getStorageTimeStamp();
|
||||||
|
if (storageTimeStamp != null) {
|
||||||
|
ofsPassiveorderDetailEntity.setDef7(storageTimeStamp);
|
||||||
|
}
|
||||||
|
|
||||||
//售后订单-退款时间
|
//售后订单-退款时间
|
||||||
// String refundedAt = header.getRefundedAt();
|
// String refundedAt = header.getRefundedAt();
|
||||||
// DateTime refundedAtDate = DateUtil.parse(refundedAt);
|
// DateTime refundedAtDate = DateUtil.parse(refundedAt);
|
||||||
|
@ -3463,10 +3507,19 @@ public class PassiveWarehouseReceiptToC extends PluginBaseEntity {
|
||||||
for (int i = 0; i < sonDetailsDtoList.size(); i++) {
|
for (int i = 0; i < sonDetailsDtoList.size(); i++) {
|
||||||
PassiveStorageSonDetailsDto passiveStorageSonDetailsDto = sonDetailsDtoList.get(i);
|
PassiveStorageSonDetailsDto passiveStorageSonDetailsDto = sonDetailsDtoList.get(i);
|
||||||
|
|
||||||
|
String tradeSuccessAt = null;
|
||||||
|
PassiveStorageResponse.Header header = passiveStorageSonDetailsDto.getHeader();
|
||||||
|
if (header != null && header.getHeaderDetailsDto() != null) {
|
||||||
|
HeaderDetailsDto headerDetailsDto = header.getHeaderDetailsDto();
|
||||||
|
HeaderDto header1 = headerDetailsDto.getHeader();
|
||||||
|
tradeSuccessAt = header1.getTradeSuccessAt();
|
||||||
|
}
|
||||||
|
|
||||||
OfsPassiveorderDetailEntity ofsPassiveorderDetailEntity = new OfsPassiveorderDetailEntity();
|
OfsPassiveorderDetailEntity ofsPassiveorderDetailEntity = new OfsPassiveorderDetailEntity();
|
||||||
ofsPassiveorderDetailEntity.setId(passiveStorageSonDetailsDto.getId());
|
ofsPassiveorderDetailEntity.setId(passiveStorageSonDetailsDto.getId());
|
||||||
//2025年8月7日15:51:21 不需要这个字段,保存原始底表的mysql会处理这个字段
|
//2025年8月7日15:51:21 不需要这个字段,保存原始底表的mysql会处理这个字段
|
||||||
// ofsPassiveorderDetailEntity.setTransactionDate(passiveStorageSonDetailsDto.getRefundedAt());
|
// ofsPassiveorderDetailEntity.setTransactionDate(passiveStorageSonDetailsDto.getRefundedAt());
|
||||||
|
ofsPassiveorderDetailEntity.setDef11(tradeSuccessAt);
|
||||||
ofsPassiveorderDetailEntity.setNewpushdate(getNewDateStr());
|
ofsPassiveorderDetailEntity.setNewpushdate(getNewDateStr());
|
||||||
ofsPassiveorderDetailEntity.setNewtransmitinfo(finalNewTransmitInfo);
|
ofsPassiveorderDetailEntity.setNewtransmitinfo(finalNewTransmitInfo);
|
||||||
ofsPassiveorderDetailEntity.setNewstate(newstate);
|
ofsPassiveorderDetailEntity.setNewstate(newstate);
|
||||||
|
@ -3677,9 +3730,19 @@ public class PassiveWarehouseReceiptToC extends PluginBaseEntity {
|
||||||
List<OnlyAfterSalesBEntity> onlyAfterSalesBEntityArrayList = new ArrayList<>();
|
List<OnlyAfterSalesBEntity> onlyAfterSalesBEntityArrayList = new ArrayList<>();
|
||||||
for (int i = 0; i < value.size(); i++) {
|
for (int i = 0; i < value.size(); i++) {
|
||||||
PassiveStorageSonDetailsDto2 passiveStorageSonDetailsDto2 = value.get(i);
|
PassiveStorageSonDetailsDto2 passiveStorageSonDetailsDto2 = value.get(i);
|
||||||
|
String tradeSuccessAt = null;
|
||||||
|
RerturnGoodsOrderSearchHeader rerturnGoodsOrderSearchHeader = passiveStorageSonDetailsDto2.getRerturnGoodsOrderSearchHeader();
|
||||||
|
if (rerturnGoodsOrderSearchHeader != null) {
|
||||||
|
HeaderDetailsDto headerDetailsDto = rerturnGoodsOrderSearchHeader.getHeaderDetailsDto();
|
||||||
|
if (headerDetailsDto != null) {
|
||||||
|
HeaderDto header = headerDetailsDto.getHeader();
|
||||||
|
tradeSuccessAt = header.getTradeSuccessAt();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
OnlyAfterSalesBEntity ofsPassiveorderDetailEntity = new OnlyAfterSalesBEntity();
|
OnlyAfterSalesBEntity ofsPassiveorderDetailEntity = new OnlyAfterSalesBEntity();
|
||||||
ofsPassiveorderDetailEntity.setOfsid(passiveStorageSonDetailsDto2.getId());
|
ofsPassiveorderDetailEntity.setOfsid(passiveStorageSonDetailsDto2.getId());
|
||||||
|
ofsPassiveorderDetailEntity.setDef13(tradeSuccessAt);
|
||||||
|
|
||||||
ofsPassiveorderDetailEntity.setDef8(getNewDateStr());
|
ofsPassiveorderDetailEntity.setDef8(getNewDateStr());
|
||||||
ofsPassiveorderDetailEntity.setDef9(finalNewTransmitInfo);
|
ofsPassiveorderDetailEntity.setDef9(finalNewTransmitInfo);
|
||||||
|
|
|
@ -1004,7 +1004,7 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
|
||||||
pk_corp = soSaleResultRootDto.getParentvo().getPk_corp();
|
pk_corp = soSaleResultRootDto.getParentvo().getPk_corp();
|
||||||
csaleid = soSaleResultRootDto.getParentvo().getCsaleid();
|
csaleid = soSaleResultRootDto.getParentvo().getCsaleid();
|
||||||
}
|
}
|
||||||
logger.info("TOC销售订单编号:{} 主键:{} 销售公司:{}", vreceiptcode, csaleid, pk_corp);
|
logger.info("TOC销售订单编号:{} 主键:{} 销售公司:{} 公司:{}", vreceiptcode, csaleid, pk_corp, bdCorpEntity.getUnitname());
|
||||||
updateSuccessOrFail1(oldValue, "Y", "success", vreceiptcode, csaleid);
|
updateSuccessOrFail1(oldValue, "Y", "success", vreceiptcode, csaleid);
|
||||||
} else if (ProfilesActiveConstant.PUSH_SCENE_TYPE_0.equals(pushScenarioType)) {
|
} else if (ProfilesActiveConstant.PUSH_SCENE_TYPE_0.equals(pushScenarioType)) {
|
||||||
//选择暂存等待下次发起
|
//选择暂存等待下次发起
|
||||||
|
@ -1095,55 +1095,217 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
|
||||||
String newstate4 = oldValue.get(0).getNewstate4();
|
String newstate4 = oldValue.get(0).getNewstate4();
|
||||||
String def15 = oldValue.get(0).getDef15();
|
String def15 = oldValue.get(0).getDef15();
|
||||||
|
|
||||||
try {
|
//验证是否为指定的店铺,如果为true,则取结存价
|
||||||
|
Boolean isCheckShopChoose = balanceUnitPriceUtil.checkOfsShop(header.getStoreCode());
|
||||||
|
//把汇总好的出库单明细行合并成一行
|
||||||
|
GoodsRertunSonDetailsDto goodsRertunSonDetailsDto = groupMergeDetailedRows(oldValue, isCheckShopChoose, sceneType);
|
||||||
|
Assert.notNull(goodsRertunSonDetailsDto, "合并明细行失败!");
|
||||||
|
BigDecimal groupShipQty = goodsRertunSonDetailsDto.getGroupShipQty();
|
||||||
|
BigDecimal groupTotalPayAmount = goodsRertunSonDetailsDto.getGroupTotalPayAmount();
|
||||||
|
|
||||||
|
//当金额>0,但数量为0时,推送红字应收单
|
||||||
|
if (groupTotalPayAmount != null && groupShipQty != null && groupTotalPayAmount.compareTo(BigDecimal.ZERO) > 0 && groupShipQty.compareTo(BigDecimal.ZERO) == 0) {
|
||||||
|
try {
|
||||||
|
BdBusitypeEntity bdBusitypeEntity = u8cOperationFlowV4();
|
||||||
|
//生成业务日期
|
||||||
|
String generateBusinessDate = createSuccessFulTradeDate(header);
|
||||||
|
|
||||||
|
//红字应收单表头
|
||||||
|
ArapDjzbVO.Parentt parentVo = new ArapDjzbVO.Parentt();
|
||||||
|
parentVo.setDjrq(generateBusinessDate);//单据日期
|
||||||
|
parentVo.setDwbm(bdCorpEntity.getUnitcode());//公司
|
||||||
|
parentVo.setLrr(OverallConstant.getOverAllValue("u8cApiZdrCode"));//录入人
|
||||||
|
parentVo.setWldx("0");//往来对象标识 固定为:客户
|
||||||
|
parentVo.setDeptid(bdDeptdocEntity.getDeptcode());//部门
|
||||||
|
parentVo.setShr(OverallConstant.getOverAllValue("u8cApiZdrCode"));//审批人
|
||||||
|
parentVo.setShrq(generateBusinessDate);//审核日期
|
||||||
|
parentVo.setDjlxbm("D0");//单据类型编码
|
||||||
|
parentVo.setXslxbm(bdBusitypeEntity.getBusicode());//业务流程
|
||||||
|
parentVo.setFeinvstatus("0");//开票状态
|
||||||
|
parentVo.setHbbm(bdCubasdocEntity.getCustcode());//客商主键
|
||||||
|
parentVo.setZyx1(shopArchives.getDoccode());//店铺档案
|
||||||
|
parentVo.setZyx2(platformArchives.getDoccode());//来源平台
|
||||||
|
parentVo.setZyx3(bdRdclEntity.getRdcode());//收发类别
|
||||||
|
parentVo.setZyx16("1");//单据红字标识
|
||||||
|
parentVo.setZyx17(ProfilesActiveConstant.sourceSystem1);//来源系统
|
||||||
|
parentVo.setZyx18(keyGroup);//汇总维度
|
||||||
|
|
||||||
|
//验证是否为指定的店铺,如果为true,则取结存价
|
||||||
|
// Boolean isCheckShopChoose = balanceUnitPriceUtil.checkOfsShop(header.getStoreCode());
|
||||||
|
//把汇总好的出库单明细行合并成一行
|
||||||
|
// GoodsRertunSonDetailsDto goodsRertunSonDetailsDto = groupMergeDetailedRows(oldValue, isCheckShopChoose, sceneType);
|
||||||
|
|
||||||
|
//存货管理档案:取发货公司的存货管理档案
|
||||||
|
BdInvmandocEntity bdInvmandocEntity = oldValue.get(0).getBdInvmandocEntity();
|
||||||
|
//存货基础档案
|
||||||
|
BdInvbasdocEntity bdInvbasdocEntity = oldValue.get(0).getBdInvbasdocEntity();
|
||||||
|
//根据存货基础档案编码,查询当前存货的税率
|
||||||
|
BdTaxitemsEntity bdTaxitemsEntity1 = oldValue.get(0).getBdTaxitemsEntity();
|
||||||
|
|
||||||
|
//如果合并后的金额为0,则不传到U8C
|
||||||
|
Assert.notNull(goodsRertunSonDetailsDto.getGroupTotalPayAmount(), "goodsRertunSonDetailsDto.getGroupTotalPayAmount()不能为空!");
|
||||||
|
BigDecimal groupTotalPayAmount2 = goodsRertunSonDetailsDto.getGroupTotalPayAmount().setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||||
|
if ("0".equals(groupTotalPayAmount2.stripTrailingZeros().toPlainString())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//修改为生成红字应收单表体
|
||||||
|
List<ArapDjzbVO.Childrenn> childrennArrayList = new ArrayList<>();
|
||||||
|
ArapDjzbVO.Childrenn arapDjzbVOChildrenn = new ArapDjzbVO.Childrenn();
|
||||||
|
childrennArrayList.add(arapDjzbVOChildrenn);
|
||||||
|
arapDjzbVOChildrenn.setCinventoryid(bdInvbasdocEntity.getInvcode());//存货管理档案
|
||||||
|
arapDjzbVOChildrenn.setJfbbje("-" + groupTotalPayAmount2.stripTrailingZeros().toPlainString());//借方本币金额
|
||||||
|
arapDjzbVOChildrenn.setJfybje("-" + groupTotalPayAmount2.stripTrailingZeros().toPlainString());//借方原币金额
|
||||||
|
// arapDjzbVOChildrenn.setJfbbsj("-" + noriginalcurmny.stripTrailingZeros().toPlainString());//借方本币税金
|
||||||
|
// arapDjzbVOChildrenn.setJfybsj("-" + noriginalcurmny.stripTrailingZeros().toPlainString());//借方原币税金
|
||||||
|
// arapDjzbVOChildrenn.setWbfbbje("-" + noriginalcurtaxmny.stripTrailingZeros().toPlainString());//借方本币无税金额
|
||||||
|
// arapDjzbVOChildrenn.setJfybwsje("-" + noriginalcurtaxmny.stripTrailingZeros().toPlainString());//借方原币无税金额
|
||||||
|
|
||||||
|
//退货没有邮费金额,已经向万万确认
|
||||||
|
//平台优惠
|
||||||
|
if (goodsRertunSonDetailsDto.getVdef4() != null) {
|
||||||
|
BigDecimal vdef4 = goodsRertunSonDetailsDto.getVdef4();
|
||||||
|
if (vdef4.compareTo(BigDecimal.ZERO) > 0) {
|
||||||
|
//发货运费-存货基本档案
|
||||||
|
BdInvbasdocEntity bdInvbasdocEntity1 = mapBdInvbasdocEntity.get("FY01");
|
||||||
|
//存货管理档案
|
||||||
|
BdInvmandocEntity bdInvmandocEntity1 = stringBdInvmandocEntityMap.get(bdInvbasdocEntity1.getInvcode() + deliverGoodsCorp.getPkCorp());
|
||||||
|
//存货对应的税率
|
||||||
|
BdTaxitemsEntity bdTaxitemsEntity = stringBdTaxitemsEntityMap.get("FY01");
|
||||||
|
//补充:平台优惠-存货
|
||||||
|
BigDecimal absAccumulatedPostage = vdef4.abs();
|
||||||
|
BigDecimal negativeValue = absAccumulatedPostage.negate();
|
||||||
|
queryAdditionUtil.additionalV3(childrennArrayList, bdInvmandocEntity1, bdInvbasdocEntity1, negativeValue, bdTaxitemsEntity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//达人优惠
|
||||||
|
if (goodsRertunSonDetailsDto.getVdef6() != null) {
|
||||||
|
BigDecimal vdef6 = goodsRertunSonDetailsDto.getVdef6();
|
||||||
|
if (vdef6.compareTo(BigDecimal.ZERO) > 0) {
|
||||||
|
//发货运费-存货基本档案
|
||||||
|
BdInvbasdocEntity bdInvbasdocEntity1 = mapBdInvbasdocEntity.get("FY02");
|
||||||
|
//存货管理档案
|
||||||
|
BdInvmandocEntity bdInvmandocEntity1 = stringBdInvmandocEntityMap.get(bdInvbasdocEntity1.getInvcode() + deliverGoodsCorp.getPkCorp());
|
||||||
|
//存货对应的税率
|
||||||
|
BdTaxitemsEntity bdTaxitemsEntity = stringBdTaxitemsEntityMap.get("FY02");
|
||||||
|
//补充:达人优惠-存货
|
||||||
|
BigDecimal absAccumulatedPostage = vdef6.abs();
|
||||||
|
BigDecimal negativeValue = absAccumulatedPostage.negate();
|
||||||
|
queryAdditionUtil.additionalV3(childrennArrayList, bdInvmandocEntity1, bdInvbasdocEntity1, negativeValue, bdTaxitemsEntity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//支付优惠
|
||||||
|
if (goodsRertunSonDetailsDto.getVdef5() != null) {
|
||||||
|
BigDecimal vdef5 = goodsRertunSonDetailsDto.getVdef5();
|
||||||
|
if (vdef5.compareTo(BigDecimal.ZERO) > 0) {
|
||||||
|
//发货运费-存货基本档案
|
||||||
|
BdInvbasdocEntity bdInvbasdocEntity1 = mapBdInvbasdocEntity.get("FY04");
|
||||||
|
//存货管理档案
|
||||||
|
BdInvmandocEntity bdInvmandocEntity1 = stringBdInvmandocEntityMap.get(bdInvbasdocEntity1.getInvcode() + deliverGoodsCorp.getPkCorp());
|
||||||
|
//存货对应的税率
|
||||||
|
BdTaxitemsEntity bdTaxitemsEntity = stringBdTaxitemsEntityMap.get("FY04");
|
||||||
|
//补充:支付优惠-存货
|
||||||
|
BigDecimal absAccumulatedPostage = vdef5.abs();
|
||||||
|
BigDecimal negativeValue = absAccumulatedPostage.negate();
|
||||||
|
queryAdditionUtil.additionalV3(childrennArrayList, bdInvmandocEntity1, bdInvbasdocEntity1, negativeValue, bdTaxitemsEntity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ProfilesActiveConstant.PUSH_SCENE_TYPE_1.equals(pushScenarioType) || ProfilesActiveConstant.PUSH_SCENE_TYPE_2.equals(pushScenarioType)) {
|
||||||
|
//推送U8C生成红字应收单
|
||||||
|
List<ArapDjzbVO> arapDjzbVOList = new ArrayList<>();
|
||||||
|
ArapDjzbVO arapDjzbVO = new ArapDjzbVO();
|
||||||
|
arapDjzbVO.setParentvo(parentVo);
|
||||||
|
arapDjzbVO.setChildren(childrennArrayList);
|
||||||
|
arapDjzbVOList.add(arapDjzbVO);
|
||||||
|
|
||||||
|
Map<String, List<ArapDjzbVO>> listMap = new HashMap<>();
|
||||||
|
listMap.put("djzbvo", arapDjzbVOList);
|
||||||
|
|
||||||
|
ArapDjzb arapDjzb = sendU8cRedReceivable(JSON.toJSONString(listMap));
|
||||||
|
String djbh = null;
|
||||||
|
String dwbm = null;
|
||||||
|
String vouchid = null;
|
||||||
|
if (arapDjzb != null && arapDjzb.getParentvo() != null) {
|
||||||
|
djbh = arapDjzb.getParentvo().getDjbh();
|
||||||
|
dwbm = arapDjzb.getParentvo().getDwbm();
|
||||||
|
vouchid = arapDjzb.getParentvo().getVouchid();
|
||||||
|
}
|
||||||
|
logger.info("TOC红字应收单:{} 销售订单主键:{} 销售公司:{} 公司:{}", djbh, vouchid, dwbm, bdCorpEntity.getUnitname());
|
||||||
|
|
||||||
|
updateSuccessOrFail2(oldValue, "Y", "success", djbh, vouchid, oldValue.get(0).getStorageTimeStamp());
|
||||||
|
} else if (ProfilesActiveConstant.PUSH_SCENE_TYPE_0.equals(pushScenarioType)) {
|
||||||
|
//不推送U8C,单据暂存
|
||||||
|
String vreceiptcode = "暂存";
|
||||||
|
String csaleid = "暂存";
|
||||||
|
String newstate = "S";
|
||||||
|
String newTransmitInfo = "暂存";
|
||||||
|
updateSuccessOrFail2(oldValue, newstate, newTransmitInfo, vreceiptcode, csaleid, oldValue.get(0).getStorageTimeStamp());
|
||||||
|
} else {
|
||||||
|
Assert.state(false, "未知的场景类型 pushScenarioType={}", pushScenarioType);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("TOC退货业务转换成U8C对象过程中、或者单据推送到U8C出现异常!", e);
|
||||||
|
//记录失败
|
||||||
|
String message = e.getMessage();
|
||||||
|
if (message == null) {
|
||||||
|
message = "未知错误";
|
||||||
|
}
|
||||||
|
updateSuccessOrFail2(oldValue, "N", message, null, null, oldValue.get(0).getStorageTimeStamp());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//当金额大于或者等于0,数量大于0推送销售订单
|
||||||
|
if (groupShipQty != null && groupTotalPayAmount != null && groupTotalPayAmount.compareTo(BigDecimal.ZERO) >= 0 && groupShipQty.compareTo(BigDecimal.ZERO) > 0) {
|
||||||
|
try {
|
||||||
// checkArchives(oldValue.get(0));
|
// checkArchives(oldValue.get(0));
|
||||||
//生成业务日期
|
//生成业务日期
|
||||||
String generateBusinessDate = createSuccessFulTradeDate(header);
|
String generateBusinessDate = createSuccessFulTradeDate(header);
|
||||||
|
|
||||||
SaleorderRequestDto saleorderRequestDto = new SaleorderRequestDto();
|
SaleorderRequestDto saleorderRequestDto = new SaleorderRequestDto();
|
||||||
SaleorderRequestParentDto saleorderRequestParentDto = new SaleorderRequestParentDto();
|
SaleorderRequestParentDto saleorderRequestParentDto = new SaleorderRequestParentDto();
|
||||||
saleorderRequestParentDto.setDbilldate(generateBusinessDate);//单据日期
|
saleorderRequestParentDto.setDbilldate(generateBusinessDate);//单据日期
|
||||||
saleorderRequestParentDto.setBretinvflag("Y");//退货标记
|
saleorderRequestParentDto.setBretinvflag("Y");//退货标记
|
||||||
saleorderRequestParentDto.setCbiztype(bdBusitypeEntity1.getPkBusitype());//业务流程
|
saleorderRequestParentDto.setCbiztype(bdBusitypeEntity1.getPkBusitype());//业务流程
|
||||||
saleorderRequestParentDto.setCcalbodyid(bdCalbodyEntity.getPkCalbody());//库存组织
|
saleorderRequestParentDto.setCcalbodyid(bdCalbodyEntity.getPkCalbody());//库存组织
|
||||||
saleorderRequestParentDto.setCcustomerid(bdCumandocEntity.getPkCumandoc());//客户=开票单位=收货单位=表体收货单位=收货单位
|
saleorderRequestParentDto.setCcustomerid(bdCumandocEntity.getPkCumandoc());//客户=开票单位=收货单位=表体收货单位=收货单位
|
||||||
saleorderRequestParentDto.setCdeptid(bdDeptdocEntity.getPkDeptdoc());//部门
|
saleorderRequestParentDto.setCdeptid(bdDeptdocEntity.getPkDeptdoc());//部门
|
||||||
saleorderRequestParentDto.setCemployeeid(null);//业务员
|
saleorderRequestParentDto.setCemployeeid(null);//业务员
|
||||||
saleorderRequestParentDto.setCoperatorid(OverallConstant.getOverAllValue("u8cApiZdrPK"));//制单人
|
saleorderRequestParentDto.setCoperatorid(OverallConstant.getOverAllValue("u8cApiZdrPK"));//制单人
|
||||||
saleorderRequestParentDto.setCreceiptcorpid(bdCumandocEntity.getPkCumandoc());//开票单位
|
saleorderRequestParentDto.setCreceiptcorpid(bdCumandocEntity.getPkCumandoc());//开票单位
|
||||||
saleorderRequestParentDto.setCreceiptcustomerid(bdCumandocEntity.getPkCumandoc());//收货单位
|
saleorderRequestParentDto.setCreceiptcustomerid(bdCumandocEntity.getPkCumandoc());//收货单位
|
||||||
saleorderRequestParentDto.setCsalecorpid(bdSalestruEntity.getCsalestruid());//销售组织
|
saleorderRequestParentDto.setCsalecorpid(bdSalestruEntity.getCsalestruid());//销售组织
|
||||||
saleorderRequestParentDto.setCwarehouseid(bdStordocEntity.getPkStordoc());//仓库
|
saleorderRequestParentDto.setCwarehouseid(bdStordocEntity.getPkStordoc());//仓库
|
||||||
saleorderRequestParentDto.setDapprovedate(generateBusinessDate);//审核日期
|
saleorderRequestParentDto.setDapprovedate(generateBusinessDate);//审核日期
|
||||||
saleorderRequestParentDto.setNdiscountrate("100.000000");//整单折扣
|
saleorderRequestParentDto.setNdiscountrate("100.000000");//整单折扣
|
||||||
saleorderRequestParentDto.setPk_corp(bdCorpEntity.getPkCorp());//公司id
|
saleorderRequestParentDto.setPk_corp(bdCorpEntity.getPkCorp());//公司id
|
||||||
//汇总单号=汇总维度
|
//汇总单号=汇总维度
|
||||||
saleorderRequestParentDto.setVdef18(keyGroup);
|
saleorderRequestParentDto.setVdef18(keyGroup);
|
||||||
//平台
|
//平台
|
||||||
saleorderRequestParentDto.setPk_defdoc2(platformArchives.getPkDefdoc());
|
saleorderRequestParentDto.setPk_defdoc2(platformArchives.getPkDefdoc());
|
||||||
saleorderRequestParentDto.setVdef2(platformArchives.getDocname());
|
saleorderRequestParentDto.setVdef2(platformArchives.getDocname());
|
||||||
saleorderRequestParentDto.setVdef17(ProfilesActiveConstant.sourceSystem1);//来源系统
|
saleorderRequestParentDto.setVdef17(ProfilesActiveConstant.sourceSystem1);//来源系统
|
||||||
|
|
||||||
//收发类别
|
//收发类别
|
||||||
saleorderRequestParentDto.setPk_defdoc3(bdRdclEntity.getPkRdcl());
|
saleorderRequestParentDto.setPk_defdoc3(bdRdclEntity.getPkRdcl());
|
||||||
saleorderRequestParentDto.setVdef3(bdRdclEntity.getRdname());
|
saleorderRequestParentDto.setVdef3(bdRdclEntity.getRdname());
|
||||||
|
|
||||||
//2024年8月8日 17:17:58 店铺档案自定义项1,先不传,后续维护好之后再传!
|
//2024年8月8日 17:17:58 店铺档案自定义项1,先不传,后续维护好之后再传!
|
||||||
//店铺
|
//店铺
|
||||||
saleorderRequestParentDto.setPk_defdoc1(shopArchives.getPkDefdoc());
|
saleorderRequestParentDto.setPk_defdoc1(shopArchives.getPkDefdoc());
|
||||||
saleorderRequestParentDto.setVdef1(shopArchives.getDocname());
|
saleorderRequestParentDto.setVdef1(shopArchives.getDocname());
|
||||||
|
|
||||||
//单据红字标识
|
//单据红字标识
|
||||||
saleorderRequestParentDto.setPk_defdoc16(OverallConstant.getOverAllValue("u8c自定义项档案-单据红字标识-Y主键"));
|
saleorderRequestParentDto.setPk_defdoc16(OverallConstant.getOverAllValue("u8c自定义项档案-单据红字标识-Y主键"));
|
||||||
saleorderRequestParentDto.setVdef16(OverallConstant.getOverAllValue("u8c自定义项档案-单据红字标识-Y名称"));
|
saleorderRequestParentDto.setVdef16(OverallConstant.getOverAllValue("u8c自定义项档案-单据红字标识-Y名称"));
|
||||||
|
|
||||||
//售后类型标识
|
//售后类型标识
|
||||||
saleorderRequestParentDto.setPk_defdoc8(OverallConstant.getOverAllValue("售后类型标识-TOC售后-主键"));
|
saleorderRequestParentDto.setPk_defdoc8(OverallConstant.getOverAllValue("售后类型标识-TOC售后-主键"));
|
||||||
saleorderRequestParentDto.setVdef8(OverallConstant.getOverAllValue("售后类型标识-TOC售后-名称"));
|
saleorderRequestParentDto.setVdef8(OverallConstant.getOverAllValue("售后类型标识-TOC售后-名称"));
|
||||||
|
|
||||||
saleorderRequestDto.setParentvo(saleorderRequestParentDto);
|
saleorderRequestDto.setParentvo(saleorderRequestParentDto);
|
||||||
//改为红字应收单表头
|
//改为红字应收单表头
|
||||||
//组装应收单表头
|
//组装应收单表头
|
||||||
// ArapDjzbVO.Parentt parentVo = new ArapDjzbVO.Parentt();
|
// ArapDjzbVO.Parentt parentVo = new ArapDjzbVO.Parentt();
|
||||||
// parentVo.setDjrq(generateBusinessDate);//单据日期
|
// parentVo.setDjrq(generateBusinessDate);//单据日期
|
||||||
// parentVo.setDwbm(bdCorpEntity.getUnitcode());//公司
|
// parentVo.setDwbm(bdCorpEntity.getUnitcode());//公司
|
||||||
|
@ -1163,28 +1325,23 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
|
||||||
// parentVo.setZyx17(ProfilesActiveConstant.sourceSystem1);//来源系统
|
// parentVo.setZyx17(ProfilesActiveConstant.sourceSystem1);//来源系统
|
||||||
// parentVo.setZyx18(keyGroup);//汇总维度
|
// parentVo.setZyx18(keyGroup);//汇总维度
|
||||||
|
|
||||||
List<SaleorderRequestChildrenDto> saleorderRequestChildrenDtoList = new ArrayList<>();
|
List<SaleorderRequestChildrenDto> saleorderRequestChildrenDtoList = new ArrayList<>();
|
||||||
saleorderRequestDto.setChildrenvo(saleorderRequestChildrenDtoList);
|
saleorderRequestDto.setChildrenvo(saleorderRequestChildrenDtoList);
|
||||||
|
|
||||||
//验证是否为指定的店铺,如果为true,则取结存价
|
//存货管理档案:取发货公司的存货管理档案
|
||||||
Boolean isCheckShopChoose = balanceUnitPriceUtil.checkOfsShop(header.getStoreCode());
|
BdInvmandocEntity bdInvmandocEntity = oldValue.get(0).getBdInvmandocEntity();
|
||||||
//把汇总好的出库单明细行合并成一行
|
//存货基础档案
|
||||||
GoodsRertunSonDetailsDto goodsRertunSonDetailsDto = groupMergeDetailedRows(oldValue, isCheckShopChoose, sceneType);
|
BdInvbasdocEntity bdInvbasdocEntity = oldValue.get(0).getBdInvbasdocEntity();
|
||||||
|
//根据存货基础档案编码,查询当前存货的税率
|
||||||
//存货管理档案:取发货公司的存货管理档案
|
BdTaxitemsEntity bdTaxitemsEntity1 = oldValue.get(0).getBdTaxitemsEntity();
|
||||||
BdInvmandocEntity bdInvmandocEntity = oldValue.get(0).getBdInvmandocEntity();
|
//查询收支项目
|
||||||
//存货基础档案
|
|
||||||
BdInvbasdocEntity bdInvbasdocEntity = oldValue.get(0).getBdInvbasdocEntity();
|
|
||||||
//根据存货基础档案编码,查询当前存货的税率
|
|
||||||
BdTaxitemsEntity bdTaxitemsEntity1 = oldValue.get(0).getBdTaxitemsEntity();
|
|
||||||
//查询收支项目
|
|
||||||
// BdInvclEntity bdInvclEntity = queryU8CEntityUtil.queryBdInvbasdocByBdInvcl(bdInvbasdocEntity);
|
// BdInvclEntity bdInvclEntity = queryU8CEntityUtil.queryBdInvbasdocByBdInvcl(bdInvbasdocEntity);
|
||||||
// BdCostsubjEntity bdCostsubjEntity = queryU8CEntityUtil.queryBdCostsubj(bdInvclEntity);
|
// BdCostsubjEntity bdCostsubjEntity = queryU8CEntityUtil.queryBdCostsubj(bdInvclEntity);
|
||||||
|
|
||||||
//合并后如果数量为0,则过滤掉
|
//合并后如果数量为0,则过滤掉
|
||||||
if ("0".equals(goodsRertunSonDetailsDto.getGroupShipQty().stripTrailingZeros().toPlainString())) {
|
if ("0".equals(goodsRertunSonDetailsDto.getGroupShipQty().stripTrailingZeros().toPlainString())) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// String tax = new BigDecimal(bdTaxitemsEntity1.getTaxratio()).divide(new BigDecimal(100), 20, BigDecimal.ROUND_HALF_UP).setScale(2, BigDecimal.ROUND_HALF_UP).stripTrailingZeros().toPlainString();
|
// String tax = new BigDecimal(bdTaxitemsEntity1.getTaxratio()).divide(new BigDecimal(100), 20, BigDecimal.ROUND_HALF_UP).setScale(2, BigDecimal.ROUND_HALF_UP).stripTrailingZeros().toPlainString();
|
||||||
|
|
||||||
|
@ -1205,67 +1362,67 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// 判断是否为赠品
|
// 判断是否为赠品
|
||||||
Boolean isblargessflag = false;
|
Boolean isblargessflag = false;
|
||||||
if ("0".equals(goodsRertunSonDetailsDto.getGroupTotalPayAmount().setScale(2, BigDecimal.ROUND_HALF_UP).stripTrailingZeros().toPlainString())) {
|
if ("0".equals(goodsRertunSonDetailsDto.getGroupTotalPayAmount().setScale(2, BigDecimal.ROUND_HALF_UP).stripTrailingZeros().toPlainString())) {
|
||||||
isblargessflag = true;
|
isblargessflag = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
SaleorderRequestChildrenDto saleorderRequestChildrenDto = new SaleorderRequestChildrenDto();
|
SaleorderRequestChildrenDto saleorderRequestChildrenDto = new SaleorderRequestChildrenDto();
|
||||||
saleorderRequestChildrenDto.setBlargessflag(isblargessflag);//是否赠品
|
saleorderRequestChildrenDto.setBlargessflag(isblargessflag);//是否赠品
|
||||||
saleorderRequestChildrenDto.setCadvisecalbodyid(bdCalbodyEntity.getPkCalbody());//发货库存组织
|
saleorderRequestChildrenDto.setCadvisecalbodyid(bdCalbodyEntity.getPkCalbody());//发货库存组织
|
||||||
saleorderRequestChildrenDto.setCbodywarehouseid(bdStordocEntity.getPkStordoc());//发货仓库
|
saleorderRequestChildrenDto.setCbodywarehouseid(bdStordocEntity.getPkStordoc());//发货仓库
|
||||||
saleorderRequestChildrenDto.setCconsigncorpid(deliverGoodsCorp.getPkCorp());//发货公司
|
saleorderRequestChildrenDto.setCconsigncorpid(deliverGoodsCorp.getPkCorp());//发货公司
|
||||||
saleorderRequestChildrenDto.setCcurrencytypeid("00010000000000000001");//币种
|
saleorderRequestChildrenDto.setCcurrencytypeid("00010000000000000001");//币种
|
||||||
saleorderRequestChildrenDto.setCinventoryid(bdInvmandocEntity.getPkInvmandoc());//存货id
|
saleorderRequestChildrenDto.setCinventoryid(bdInvmandocEntity.getPkInvmandoc());//存货id
|
||||||
saleorderRequestChildrenDto.setCreceiptcorpid(bdCumandocEntity.getPkCumandoc());//收货单位
|
saleorderRequestChildrenDto.setCreceiptcorpid(bdCumandocEntity.getPkCumandoc());//收货单位
|
||||||
saleorderRequestChildrenDto.setDconsigndate(generateBusinessDate);//计划发货日期
|
saleorderRequestChildrenDto.setDconsigndate(generateBusinessDate);//计划发货日期
|
||||||
saleorderRequestChildrenDto.setDdeliverdate(generateBusinessDate);// 要求收货日期
|
saleorderRequestChildrenDto.setDdeliverdate(generateBusinessDate);// 要求收货日期
|
||||||
saleorderRequestChildrenDto.setNexchangeotobrate("1.00000000");//折本汇率
|
saleorderRequestChildrenDto.setNexchangeotobrate("1.00000000");//折本汇率
|
||||||
saleorderRequestChildrenDto.setNitemdiscountrate("100.000000");//单品折扣
|
saleorderRequestChildrenDto.setNitemdiscountrate("100.000000");//单品折扣
|
||||||
saleorderRequestChildrenDto.setNnumber("-" + goodsRertunSonDetailsDto.getGroupShipQty().stripTrailingZeros().toPlainString());//数量
|
saleorderRequestChildrenDto.setNnumber("-" + goodsRertunSonDetailsDto.getGroupShipQty().stripTrailingZeros().toPlainString());//数量
|
||||||
saleorderRequestChildrenDto.setNoriginalcurdiscountmny("0");//折扣额
|
saleorderRequestChildrenDto.setNoriginalcurdiscountmny("0");//折扣额
|
||||||
// saleorderRequestChildrenDto.setNoriginalcurmny("-" + noriginalcurmny.stripTrailingZeros().toPlainString());//无税金额
|
// saleorderRequestChildrenDto.setNoriginalcurmny("-" + noriginalcurmny.stripTrailingZeros().toPlainString());//无税金额
|
||||||
// saleorderRequestChildrenDto.setNoriginalcurnetprice(noriginalcurprice.stripTrailingZeros().toPlainString());//无税净价
|
// saleorderRequestChildrenDto.setNoriginalcurnetprice(noriginalcurprice.stripTrailingZeros().toPlainString());//无税净价
|
||||||
// saleorderRequestChildrenDto.setNoriginalcurprice(noriginalcurprice.stripTrailingZeros().toPlainString());//无税单价
|
// saleorderRequestChildrenDto.setNoriginalcurprice(noriginalcurprice.stripTrailingZeros().toPlainString());//无税单价
|
||||||
// saleorderRequestChildrenDto.setNoriginalcursummny("-" + noriginalcursummny.stripTrailingZeros().toPlainString());//价税合计
|
// saleorderRequestChildrenDto.setNoriginalcursummny("-" + noriginalcursummny.stripTrailingZeros().toPlainString());//价税合计
|
||||||
saleorderRequestChildrenDto.setNoriginalcursummny("-" + goodsRertunSonDetailsDto.getGroupTotalPayAmount().setScale(2, BigDecimal.ROUND_HALF_UP).stripTrailingZeros().toPlainString());//价税合计 新逻辑
|
saleorderRequestChildrenDto.setNoriginalcursummny("-" + goodsRertunSonDetailsDto.getGroupTotalPayAmount().setScale(2, BigDecimal.ROUND_HALF_UP).stripTrailingZeros().toPlainString());//价税合计 新逻辑
|
||||||
// saleorderRequestChildrenDto.setNoriginalcurtaxmny("-" + noriginalcurtaxmny.stripTrailingZeros().toPlainString());//税额
|
// saleorderRequestChildrenDto.setNoriginalcurtaxmny("-" + noriginalcurtaxmny.stripTrailingZeros().toPlainString());//税额
|
||||||
// saleorderRequestChildrenDto.setNoriginalcurtaxnetprice(noriginalcurtaxprice.stripTrailingZeros().toPlainString());//含税净价
|
// saleorderRequestChildrenDto.setNoriginalcurtaxnetprice(noriginalcurtaxprice.stripTrailingZeros().toPlainString());//含税净价
|
||||||
// saleorderRequestChildrenDto.setNoriginalcurtaxprice(noriginalcurtaxprice.stripTrailingZeros().toPlainString());//含税单价
|
// saleorderRequestChildrenDto.setNoriginalcurtaxprice(noriginalcurtaxprice.stripTrailingZeros().toPlainString());//含税单价
|
||||||
// saleorderRequestChildrenDto.setNtaxrate(new BigDecimal(bdTaxitemsEntity1.getTaxratio()).stripTrailingZeros().toPlainString());//税率
|
// saleorderRequestChildrenDto.setNtaxrate(new BigDecimal(bdTaxitemsEntity1.getTaxratio()).stripTrailingZeros().toPlainString());//税率
|
||||||
// saleorderRequestChildrenDto.setVdef2(bdCostsubjEntity.getCostname());//收支项目
|
// saleorderRequestChildrenDto.setVdef2(bdCostsubjEntity.getCostname());//收支项目
|
||||||
// saleorderRequestChildrenDto.setPk_defdoc2(bdCostsubjEntity.getPkCostsubj());
|
// saleorderRequestChildrenDto.setPk_defdoc2(bdCostsubjEntity.getPkCostsubj());
|
||||||
//如果优惠金额为0,则传0
|
//如果优惠金额为0,则传0
|
||||||
if (!"0".equals(goodsRertunSonDetailsDto.getVdef4().stripTrailingZeros().toPlainString())) {
|
if (!"0".equals(goodsRertunSonDetailsDto.getVdef4().stripTrailingZeros().toPlainString())) {
|
||||||
saleorderRequestChildrenDto.setVdef4("-" + goodsRertunSonDetailsDto.getVdef4().stripTrailingZeros().toPlainString());
|
saleorderRequestChildrenDto.setVdef4("-" + goodsRertunSonDetailsDto.getVdef4().stripTrailingZeros().toPlainString());
|
||||||
} else {
|
} else {
|
||||||
saleorderRequestChildrenDto.setVdef4("0");
|
saleorderRequestChildrenDto.setVdef4("0");
|
||||||
}
|
}
|
||||||
if (!"0".equals(goodsRertunSonDetailsDto.getVdef5().stripTrailingZeros().toPlainString())) {
|
if (!"0".equals(goodsRertunSonDetailsDto.getVdef5().stripTrailingZeros().toPlainString())) {
|
||||||
saleorderRequestChildrenDto.setVdef5("-" + goodsRertunSonDetailsDto.getVdef5().stripTrailingZeros().toPlainString());
|
saleorderRequestChildrenDto.setVdef5("-" + goodsRertunSonDetailsDto.getVdef5().stripTrailingZeros().toPlainString());
|
||||||
} else {
|
} else {
|
||||||
saleorderRequestChildrenDto.setVdef5("0");
|
saleorderRequestChildrenDto.setVdef5("0");
|
||||||
}
|
}
|
||||||
if (!"0".equals(goodsRertunSonDetailsDto.getVdef6().stripTrailingZeros().toPlainString())) {
|
if (!"0".equals(goodsRertunSonDetailsDto.getVdef6().stripTrailingZeros().toPlainString())) {
|
||||||
saleorderRequestChildrenDto.setVdef6("-" + goodsRertunSonDetailsDto.getVdef6().stripTrailingZeros().toPlainString());
|
saleorderRequestChildrenDto.setVdef6("-" + goodsRertunSonDetailsDto.getVdef6().stripTrailingZeros().toPlainString());
|
||||||
} else {
|
} else {
|
||||||
saleorderRequestChildrenDto.setVdef6("0");
|
saleorderRequestChildrenDto.setVdef6("0");
|
||||||
}
|
}
|
||||||
if (!"0".equals(goodsRertunSonDetailsDto.getVdef7().stripTrailingZeros().toPlainString())) {
|
if (!"0".equals(goodsRertunSonDetailsDto.getVdef7().stripTrailingZeros().toPlainString())) {
|
||||||
saleorderRequestChildrenDto.setVdef7("-" + goodsRertunSonDetailsDto.getVdef7().stripTrailingZeros().toPlainString());
|
saleorderRequestChildrenDto.setVdef7("-" + goodsRertunSonDetailsDto.getVdef7().stripTrailingZeros().toPlainString());
|
||||||
} else {
|
} else {
|
||||||
saleorderRequestChildrenDto.setVdef7("0");
|
saleorderRequestChildrenDto.setVdef7("0");
|
||||||
}
|
}
|
||||||
saleorderRequestChildrenDtoList.add(saleorderRequestChildrenDto);
|
saleorderRequestChildrenDtoList.add(saleorderRequestChildrenDto);
|
||||||
|
|
||||||
//如果合并后的金额为0,则不传到U8C
|
//如果合并后的金额为0,则不传到U8C
|
||||||
// Assert.notNull(goodsRertunSonDetailsDto.getGroupTotalPayAmount(), "goodsRertunSonDetailsDto.getGroupTotalPayAmount()不能为空!");
|
// Assert.notNull(goodsRertunSonDetailsDto.getGroupTotalPayAmount(), "goodsRertunSonDetailsDto.getGroupTotalPayAmount()不能为空!");
|
||||||
// BigDecimal groupTotalPayAmount = goodsRertunSonDetailsDto.getGroupTotalPayAmount().setScale(2, BigDecimal.ROUND_HALF_UP);
|
// BigDecimal groupTotalPayAmount = goodsRertunSonDetailsDto.getGroupTotalPayAmount().setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||||
// if ("0".equals(groupTotalPayAmount.stripTrailingZeros().toPlainString())) {
|
// if ("0".equals(groupTotalPayAmount.stripTrailingZeros().toPlainString())) {
|
||||||
// continue;
|
// continue;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
//修改为生成红字应收单表体
|
//修改为生成红字应收单表体
|
||||||
// List<ArapDjzbVO.Childrenn> childrennArrayList = new ArrayList<>();
|
// List<ArapDjzbVO.Childrenn> childrennArrayList = new ArrayList<>();
|
||||||
// ArapDjzbVO.Childrenn arapDjzbVOChildrenn = new ArapDjzbVO.Childrenn();
|
// ArapDjzbVO.Childrenn arapDjzbVOChildrenn = new ArapDjzbVO.Childrenn();
|
||||||
// childrennArrayList.add(arapDjzbVOChildrenn);
|
// childrennArrayList.add(arapDjzbVOChildrenn);
|
||||||
|
@ -1277,82 +1434,82 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
|
||||||
// arapDjzbVOChildrenn.setWbfbbje("-" + noriginalcurtaxmny.stripTrailingZeros().toPlainString());//借方本币无税金额
|
// arapDjzbVOChildrenn.setWbfbbje("-" + noriginalcurtaxmny.stripTrailingZeros().toPlainString());//借方本币无税金额
|
||||||
// arapDjzbVOChildrenn.setJfybwsje("-" + noriginalcurtaxmny.stripTrailingZeros().toPlainString());//借方原币无税金额
|
// arapDjzbVOChildrenn.setJfybwsje("-" + noriginalcurtaxmny.stripTrailingZeros().toPlainString());//借方原币无税金额
|
||||||
|
|
||||||
//退货没有邮费金额,已经向万万确认
|
//退货没有邮费金额,已经向万万确认
|
||||||
//所有业务商家优惠都不传
|
//所有业务商家优惠都不传
|
||||||
//平台优惠
|
//平台优惠
|
||||||
if (goodsRertunSonDetailsDto.getVdef4() != null) {
|
if (goodsRertunSonDetailsDto.getVdef4() != null) {
|
||||||
BigDecimal vdef4 = goodsRertunSonDetailsDto.getVdef4();
|
BigDecimal vdef4 = goodsRertunSonDetailsDto.getVdef4();
|
||||||
if (vdef4.compareTo(BigDecimal.ZERO) > 0) {
|
if (vdef4.compareTo(BigDecimal.ZERO) > 0) {
|
||||||
//发货运费-存货基本档案
|
//发货运费-存货基本档案
|
||||||
BdInvbasdocEntity bdInvbasdocEntity1 = mapBdInvbasdocEntity.get("FY01");
|
BdInvbasdocEntity bdInvbasdocEntity1 = mapBdInvbasdocEntity.get("FY01");
|
||||||
//存货管理档案
|
//存货管理档案
|
||||||
BdInvmandocEntity bdInvmandocEntity1 = stringBdInvmandocEntityMap.get(bdInvbasdocEntity1.getInvcode() + deliverGoodsCorp.getPkCorp());
|
BdInvmandocEntity bdInvmandocEntity1 = stringBdInvmandocEntityMap.get(bdInvbasdocEntity1.getInvcode() + deliverGoodsCorp.getPkCorp());
|
||||||
//存货对应的税率
|
//存货对应的税率
|
||||||
BdTaxitemsEntity bdTaxitemsEntity = stringBdTaxitemsEntityMap.get("FY01");
|
BdTaxitemsEntity bdTaxitemsEntity = stringBdTaxitemsEntityMap.get("FY01");
|
||||||
//补充:平台优惠-存货
|
//补充:平台优惠-存货
|
||||||
BigDecimal absAccumulatedPostage = vdef4.abs();
|
BigDecimal absAccumulatedPostage = vdef4.abs();
|
||||||
BigDecimal negativeValue = absAccumulatedPostage.negate();
|
BigDecimal negativeValue = absAccumulatedPostage.negate();
|
||||||
queryAdditionUtil.additional(saleorderRequestChildrenDtoList, bdInvmandocEntity1, bdInvbasdocEntity1, negativeValue, "-1", bdTaxitemsEntity);
|
queryAdditionUtil.additional(saleorderRequestChildrenDtoList, bdInvmandocEntity1, bdInvbasdocEntity1, negativeValue, "-1", bdTaxitemsEntity);
|
||||||
// queryAdditionUtil.additionalV3(childrennArrayList, bdInvmandocEntity1, bdInvbasdocEntity1, negativeValue, bdTaxitemsEntity);
|
// queryAdditionUtil.additionalV3(childrennArrayList, bdInvmandocEntity1, bdInvbasdocEntity1, negativeValue, bdTaxitemsEntity);
|
||||||
}
|
|
||||||
}
|
|
||||||
//达人优惠
|
|
||||||
if (goodsRertunSonDetailsDto.getVdef6() != null) {
|
|
||||||
BigDecimal vdef6 = goodsRertunSonDetailsDto.getVdef6();
|
|
||||||
if (vdef6.compareTo(BigDecimal.ZERO) > 0) {
|
|
||||||
//发货运费-存货基本档案
|
|
||||||
BdInvbasdocEntity bdInvbasdocEntity1 = mapBdInvbasdocEntity.get("FY02");
|
|
||||||
//存货管理档案
|
|
||||||
BdInvmandocEntity bdInvmandocEntity1 = stringBdInvmandocEntityMap.get(bdInvbasdocEntity1.getInvcode() + deliverGoodsCorp.getPkCorp());
|
|
||||||
//存货对应的税率
|
|
||||||
BdTaxitemsEntity bdTaxitemsEntity = stringBdTaxitemsEntityMap.get("FY02");
|
|
||||||
//补充:达人优惠-存货
|
|
||||||
BigDecimal absAccumulatedPostage = vdef6.abs();
|
|
||||||
BigDecimal negativeValue = absAccumulatedPostage.negate();
|
|
||||||
queryAdditionUtil.additional(saleorderRequestChildrenDtoList, bdInvmandocEntity1, bdInvbasdocEntity1, negativeValue, "-1", bdTaxitemsEntity);
|
|
||||||
// queryAdditionUtil.additionalV3(childrennArrayList, bdInvmandocEntity1, bdInvbasdocEntity1, negativeValue, bdTaxitemsEntity);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//支付优惠
|
|
||||||
if (goodsRertunSonDetailsDto.getVdef5() != null) {
|
|
||||||
BigDecimal vdef5 = goodsRertunSonDetailsDto.getVdef5();
|
|
||||||
if (vdef5.compareTo(BigDecimal.ZERO) > 0) {
|
|
||||||
//发货运费-存货基本档案
|
|
||||||
BdInvbasdocEntity bdInvbasdocEntity1 = mapBdInvbasdocEntity.get("FY04");
|
|
||||||
//存货管理档案
|
|
||||||
BdInvmandocEntity bdInvmandocEntity1 = stringBdInvmandocEntityMap.get(bdInvbasdocEntity1.getInvcode() + deliverGoodsCorp.getPkCorp());
|
|
||||||
//存货对应的税率
|
|
||||||
BdTaxitemsEntity bdTaxitemsEntity = stringBdTaxitemsEntityMap.get("FY04");
|
|
||||||
//补充:支付优惠-存货
|
|
||||||
BigDecimal absAccumulatedPostage = vdef5.abs();
|
|
||||||
BigDecimal negativeValue = absAccumulatedPostage.negate();// 符号取反(转为负数)
|
|
||||||
queryAdditionUtil.additional(saleorderRequestChildrenDtoList, bdInvmandocEntity1, bdInvbasdocEntity1, negativeValue, "-1", bdTaxitemsEntity);
|
|
||||||
// queryAdditionUtil.additionalV3(childrennArrayList, bdInvmandocEntity1, bdInvbasdocEntity1, negativeValue, bdTaxitemsEntity);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean oneSuccess = false;
|
|
||||||
if (!"Y".equals(newstate4)) {
|
|
||||||
if (ProfilesActiveConstant.PUSH_SCENE_TYPE_1.equals(pushScenarioType) || ProfilesActiveConstant.PUSH_SCENE_TYPE_2.equals(pushScenarioType)) {
|
|
||||||
//推送U8C红字销售订单,如果推送失败,抛出异常,那么就会外围的try catch捕获,代码不会往下执行
|
|
||||||
List<SaleorderRequestDto> saleorderRequestDtoList = new ArrayList<>();
|
|
||||||
saleorderRequestDtoList.add(saleorderRequestDto);
|
|
||||||
Map<String, List<SaleorderRequestDto>> stringStringMap = new HashMap<>();
|
|
||||||
stringStringMap.put("saleorder", saleorderRequestDtoList);
|
|
||||||
SoSaleResultRootDto soSaleResultRootDto = sendU8CTOCOrder(JSON.toJSONString(stringStringMap));
|
|
||||||
String vreceiptcode = null;
|
|
||||||
String pk_corp = null;
|
|
||||||
String csaleid = null;
|
|
||||||
if (soSaleResultRootDto != null && soSaleResultRootDto.getParentvo() != null) {
|
|
||||||
vreceiptcode = soSaleResultRootDto.getParentvo().getVreceiptcode();
|
|
||||||
pk_corp = soSaleResultRootDto.getParentvo().getPk_corp();
|
|
||||||
csaleid = soSaleResultRootDto.getParentvo().getCsaleid();
|
|
||||||
}
|
}
|
||||||
logger.info("TOC红字销售订单编号:{} 销售订单主键:{} 销售公司:{}", vreceiptcode, csaleid, pk_corp);
|
}
|
||||||
updateSuccessOrFail2(oldValue, "Y", "success", vreceiptcode, csaleid, oldValue.get(0).getStorageTimeStamp());
|
//达人优惠
|
||||||
oneSuccess = true;
|
if (goodsRertunSonDetailsDto.getVdef6() != null) {
|
||||||
|
BigDecimal vdef6 = goodsRertunSonDetailsDto.getVdef6();
|
||||||
|
if (vdef6.compareTo(BigDecimal.ZERO) > 0) {
|
||||||
|
//发货运费-存货基本档案
|
||||||
|
BdInvbasdocEntity bdInvbasdocEntity1 = mapBdInvbasdocEntity.get("FY02");
|
||||||
|
//存货管理档案
|
||||||
|
BdInvmandocEntity bdInvmandocEntity1 = stringBdInvmandocEntityMap.get(bdInvbasdocEntity1.getInvcode() + deliverGoodsCorp.getPkCorp());
|
||||||
|
//存货对应的税率
|
||||||
|
BdTaxitemsEntity bdTaxitemsEntity = stringBdTaxitemsEntityMap.get("FY02");
|
||||||
|
//补充:达人优惠-存货
|
||||||
|
BigDecimal absAccumulatedPostage = vdef6.abs();
|
||||||
|
BigDecimal negativeValue = absAccumulatedPostage.negate();
|
||||||
|
queryAdditionUtil.additional(saleorderRequestChildrenDtoList, bdInvmandocEntity1, bdInvbasdocEntity1, negativeValue, "-1", bdTaxitemsEntity);
|
||||||
|
// queryAdditionUtil.additionalV3(childrennArrayList, bdInvmandocEntity1, bdInvbasdocEntity1, negativeValue, bdTaxitemsEntity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//支付优惠
|
||||||
|
if (goodsRertunSonDetailsDto.getVdef5() != null) {
|
||||||
|
BigDecimal vdef5 = goodsRertunSonDetailsDto.getVdef5();
|
||||||
|
if (vdef5.compareTo(BigDecimal.ZERO) > 0) {
|
||||||
|
//发货运费-存货基本档案
|
||||||
|
BdInvbasdocEntity bdInvbasdocEntity1 = mapBdInvbasdocEntity.get("FY04");
|
||||||
|
//存货管理档案
|
||||||
|
BdInvmandocEntity bdInvmandocEntity1 = stringBdInvmandocEntityMap.get(bdInvbasdocEntity1.getInvcode() + deliverGoodsCorp.getPkCorp());
|
||||||
|
//存货对应的税率
|
||||||
|
BdTaxitemsEntity bdTaxitemsEntity = stringBdTaxitemsEntityMap.get("FY04");
|
||||||
|
//补充:支付优惠-存货
|
||||||
|
BigDecimal absAccumulatedPostage = vdef5.abs();
|
||||||
|
BigDecimal negativeValue = absAccumulatedPostage.negate();// 符号取反(转为负数)
|
||||||
|
queryAdditionUtil.additional(saleorderRequestChildrenDtoList, bdInvmandocEntity1, bdInvbasdocEntity1, negativeValue, "-1", bdTaxitemsEntity);
|
||||||
|
// queryAdditionUtil.additionalV3(childrennArrayList, bdInvmandocEntity1, bdInvbasdocEntity1, negativeValue, bdTaxitemsEntity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//推送第一笔红字销售订单
|
boolean oneSuccess = false;
|
||||||
|
if (!"Y".equals(newstate4)) {
|
||||||
|
if (ProfilesActiveConstant.PUSH_SCENE_TYPE_1.equals(pushScenarioType) || ProfilesActiveConstant.PUSH_SCENE_TYPE_2.equals(pushScenarioType)) {
|
||||||
|
//推送U8C红字销售订单,如果推送失败,抛出异常,那么就会外围的try catch捕获,代码不会往下执行
|
||||||
|
List<SaleorderRequestDto> saleorderRequestDtoList = new ArrayList<>();
|
||||||
|
saleorderRequestDtoList.add(saleorderRequestDto);
|
||||||
|
Map<String, List<SaleorderRequestDto>> stringStringMap = new HashMap<>();
|
||||||
|
stringStringMap.put("saleorder", saleorderRequestDtoList);
|
||||||
|
SoSaleResultRootDto soSaleResultRootDto = sendU8CTOCOrder(JSON.toJSONString(stringStringMap));
|
||||||
|
String vreceiptcode = null;
|
||||||
|
String pk_corp = null;
|
||||||
|
String csaleid = null;
|
||||||
|
if (soSaleResultRootDto != null && soSaleResultRootDto.getParentvo() != null) {
|
||||||
|
vreceiptcode = soSaleResultRootDto.getParentvo().getVreceiptcode();
|
||||||
|
pk_corp = soSaleResultRootDto.getParentvo().getPk_corp();
|
||||||
|
csaleid = soSaleResultRootDto.getParentvo().getCsaleid();
|
||||||
|
}
|
||||||
|
logger.info("TOC红字销售订单编号:{} 销售订单主键:{} 销售公司:{} 公司:{}", vreceiptcode, csaleid, pk_corp, bdCorpEntity.getUnitname());
|
||||||
|
updateSuccessOrFail2(oldValue, "Y", "success", vreceiptcode, csaleid, oldValue.get(0).getStorageTimeStamp());
|
||||||
|
oneSuccess = true;
|
||||||
|
|
||||||
|
//推送第一笔红字销售订单
|
||||||
// List<ArapDjzbVO> arapDjzbVOList = new ArrayList<>();
|
// List<ArapDjzbVO> arapDjzbVOList = new ArrayList<>();
|
||||||
// ArapDjzbVO arapDjzbVO = new ArapDjzbVO();
|
// ArapDjzbVO arapDjzbVO = new ArapDjzbVO();
|
||||||
// arapDjzbVO.setParentvo(parentVo);
|
// arapDjzbVO.setParentvo(parentVo);
|
||||||
|
@ -1372,74 +1529,75 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
|
||||||
// vouchid = arapDjzb.getParentvo().getVouchid();
|
// vouchid = arapDjzb.getParentvo().getVouchid();
|
||||||
// }
|
// }
|
||||||
// logger.info("TOC红字应收单:{} 销售订单主键:{} 销售公司:{}", djbh, vouchid, dwbm);
|
// logger.info("TOC红字应收单:{} 销售订单主键:{} 销售公司:{}", djbh, vouchid, dwbm);
|
||||||
} else if (ProfilesActiveConstant.PUSH_SCENE_TYPE_0.equals(pushScenarioType)) {
|
|
||||||
//不推送U8C,单据暂存
|
|
||||||
String vreceiptcode = "暂存";
|
|
||||||
String csaleid = "暂存";
|
|
||||||
String newstate = "S";
|
|
||||||
String newTransmitInfo = "暂存";
|
|
||||||
updateSuccessOrFail2(oldValue, newstate, newTransmitInfo, vreceiptcode, csaleid, oldValue.get(0).getStorageTimeStamp());
|
|
||||||
oneSuccess = true;
|
|
||||||
} else {
|
|
||||||
Assert.state(false, "未知的场景类型 pushScenarioType={}", pushScenarioType);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
oneSuccess = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
//判断入库时间(关单时间)与交易成功时间,推送u8c生成蓝字销售订单,仅满足情况二的条件才生成这张蓝字销售订单
|
|
||||||
try {
|
|
||||||
if (!"Y".equals(def15) && oneSuccess && "2".equals(oldValue.get(0).getStorageTimeStamp())) {
|
|
||||||
if (ProfilesActiveConstant.PUSH_SCENE_TYPE_1.equals(pushScenarioType) || ProfilesActiveConstant.PUSH_SCENE_TYPE_2.equals(pushScenarioType)) {
|
|
||||||
if ("2".equals(oldValue.get(0).getStorageTimeStamp())) {
|
|
||||||
SaleorderRequestDto saleorderRequestDto1 = transformRedSalesOrderToBlueSalesOrder(saleorderRequestDto, bdBusitypeEntity2);
|
|
||||||
|
|
||||||
List<SaleorderRequestDto> saleorderRequestDtoList2 = new ArrayList<>();
|
|
||||||
saleorderRequestDtoList2.add(saleorderRequestDto1);
|
|
||||||
Map<String, List<SaleorderRequestDto>> stringStringMap2 = new HashMap<>();
|
|
||||||
stringStringMap2.put("saleorder", saleorderRequestDtoList2);
|
|
||||||
SoSaleResultRootDto soSaleResultRootDto2 = sendU8CTOCOrder(JSON.toJSONString(stringStringMap2));
|
|
||||||
|
|
||||||
String vreceiptcode2 = null;
|
|
||||||
String pk_corp2 = null;
|
|
||||||
String csaleid2 = null;
|
|
||||||
if (soSaleResultRootDto2 != null && soSaleResultRootDto2.getParentvo() != null) {
|
|
||||||
vreceiptcode2 = soSaleResultRootDto2.getParentvo().getVreceiptcode();
|
|
||||||
pk_corp2 = soSaleResultRootDto2.getParentvo().getPk_corp();
|
|
||||||
csaleid2 = soSaleResultRootDto2.getParentvo().getCsaleid();
|
|
||||||
}
|
|
||||||
|
|
||||||
logger.info("TOC蓝字销售订单编号:{} 销售订单主键:{} 销售公司:{}", vreceiptcode2, csaleid2, pk_corp2);
|
|
||||||
updateSuccessOrFail3(oldValue, "Y", "success", vreceiptcode2, csaleid2, oldValue.get(0).getStorageTimeStamp());
|
|
||||||
}
|
|
||||||
} else if (ProfilesActiveConstant.PUSH_SCENE_TYPE_0.equals(pushScenarioType)) {
|
} else if (ProfilesActiveConstant.PUSH_SCENE_TYPE_0.equals(pushScenarioType)) {
|
||||||
//不推送U8C,单据暂存
|
//不推送U8C,单据暂存
|
||||||
String vreceiptcode = "暂存";
|
String vreceiptcode = "暂存";
|
||||||
String csaleid = "暂存";
|
String csaleid = "暂存";
|
||||||
String newstate = "S";
|
String newstate = "S";
|
||||||
String newTransmitInfo = "暂存";
|
String newTransmitInfo = "暂存";
|
||||||
updateSuccessOrFail3(oldValue, newstate, newTransmitInfo, vreceiptcode, csaleid, oldValue.get(0).getStorageTimeStamp());
|
updateSuccessOrFail2(oldValue, newstate, newTransmitInfo, vreceiptcode, csaleid, oldValue.get(0).getStorageTimeStamp());
|
||||||
|
oneSuccess = true;
|
||||||
} else {
|
} else {
|
||||||
Assert.state(false, "未知的场景类型 pushScenarioType={}", pushScenarioType);
|
Assert.state(false, "未知的场景类型 pushScenarioType={}", pushScenarioType);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
oneSuccess = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//判断入库时间(关单时间)与交易成功时间,推送u8c生成蓝字销售订单,仅满足情况二的条件才生成这张蓝字销售订单
|
||||||
|
try {
|
||||||
|
if (!"Y".equals(def15) && oneSuccess && "2".equals(oldValue.get(0).getStorageTimeStamp())) {
|
||||||
|
if (ProfilesActiveConstant.PUSH_SCENE_TYPE_1.equals(pushScenarioType) || ProfilesActiveConstant.PUSH_SCENE_TYPE_2.equals(pushScenarioType)) {
|
||||||
|
if ("2".equals(oldValue.get(0).getStorageTimeStamp())) {
|
||||||
|
SaleorderRequestDto saleorderRequestDto1 = transformRedSalesOrderToBlueSalesOrder(saleorderRequestDto, bdBusitypeEntity2);
|
||||||
|
|
||||||
|
List<SaleorderRequestDto> saleorderRequestDtoList2 = new ArrayList<>();
|
||||||
|
saleorderRequestDtoList2.add(saleorderRequestDto1);
|
||||||
|
Map<String, List<SaleorderRequestDto>> stringStringMap2 = new HashMap<>();
|
||||||
|
stringStringMap2.put("saleorder", saleorderRequestDtoList2);
|
||||||
|
SoSaleResultRootDto soSaleResultRootDto2 = sendU8CTOCOrder(JSON.toJSONString(stringStringMap2));
|
||||||
|
|
||||||
|
String vreceiptcode2 = null;
|
||||||
|
String pk_corp2 = null;
|
||||||
|
String csaleid2 = null;
|
||||||
|
if (soSaleResultRootDto2 != null && soSaleResultRootDto2.getParentvo() != null) {
|
||||||
|
vreceiptcode2 = soSaleResultRootDto2.getParentvo().getVreceiptcode();
|
||||||
|
pk_corp2 = soSaleResultRootDto2.getParentvo().getPk_corp();
|
||||||
|
csaleid2 = soSaleResultRootDto2.getParentvo().getCsaleid();
|
||||||
|
}
|
||||||
|
|
||||||
|
logger.info("TOC蓝字销售订单编号:{} 销售订单主键:{} 销售公司:{}", vreceiptcode2, csaleid2, pk_corp2);
|
||||||
|
updateSuccessOrFail3(oldValue, "Y", "success", vreceiptcode2, csaleid2, oldValue.get(0).getStorageTimeStamp());
|
||||||
|
}
|
||||||
|
} else if (ProfilesActiveConstant.PUSH_SCENE_TYPE_0.equals(pushScenarioType)) {
|
||||||
|
//不推送U8C,单据暂存
|
||||||
|
String vreceiptcode = "暂存";
|
||||||
|
String csaleid = "暂存";
|
||||||
|
String newstate = "S";
|
||||||
|
String newTransmitInfo = "暂存";
|
||||||
|
updateSuccessOrFail3(oldValue, newstate, newTransmitInfo, vreceiptcode, csaleid, oldValue.get(0).getStorageTimeStamp());
|
||||||
|
} else {
|
||||||
|
Assert.state(false, "未知的场景类型 pushScenarioType={}", pushScenarioType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
//记录蓝字销售订单异常失败
|
||||||
|
logger.error("推送蓝字销售订单抛出异常!", e);
|
||||||
|
String message = e.getMessage();
|
||||||
|
if (message == null) {
|
||||||
|
message = "未知错误";
|
||||||
|
}
|
||||||
|
updateSuccessOrFail3(oldValue, "N", message, null, null, oldValue.get(0).getStorageTimeStamp());
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
//记录蓝字销售订单异常失败
|
//记录红字销售订单异常失败
|
||||||
logger.error("推送蓝字销售订单抛出异常!", e);
|
logger.error("TOC退货业务转换成U8C对象过程中、或者单据推送到U8C出现异常!", e);
|
||||||
String message = e.getMessage();
|
String message = e.getMessage();
|
||||||
if (message == null) {
|
if (message == null) {
|
||||||
message = "未知错误";
|
message = "未知错误";
|
||||||
}
|
}
|
||||||
updateSuccessOrFail3(oldValue, "N", message, null, null, oldValue.get(0).getStorageTimeStamp());
|
updateSuccessOrFail2(oldValue, "N", message, null, null, oldValue.get(0).getStorageTimeStamp());
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
|
||||||
//记录红字销售订单异常失败
|
|
||||||
logger.error("TOC退货业务转换成U8C对象过程中、或者单据推送到U8C出现异常!", e);
|
|
||||||
String message = e.getMessage();
|
|
||||||
if (message == null) {
|
|
||||||
message = "未知错误";
|
|
||||||
}
|
|
||||||
updateSuccessOrFail2(oldValue, "N", message, null, null, oldValue.get(0).getStorageTimeStamp());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -1656,6 +1814,8 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
|
||||||
// StockinOrderSearchResponse.StockinOrder.StockinB stockinB = details2.get(i);
|
// StockinOrderSearchResponse.StockinOrder.StockinB stockinB = details2.get(i);
|
||||||
// stockinB.setReceivedQty(stockinB.getRequestQty());
|
// stockinB.setReceivedQty(stockinB.getRequestQty());
|
||||||
// }
|
// }
|
||||||
|
// headerDetailsDtos.get(0).getHeader().setTradeSuccessAt("2025-08-18 17:20:00");
|
||||||
|
|
||||||
markTimeInMorningEvening(returnGoodHeaderDetailsDataDtoList1);
|
markTimeInMorningEvening(returnGoodHeaderDetailsDataDtoList1);
|
||||||
if ("stock".equals(sceneType)) {
|
if ("stock".equals(sceneType)) {
|
||||||
returnGoodHeaderDetailsDataDtoList1 = filtrationTransactionSuccessTime(returnGoodHeaderDetailsDataDtoList1);
|
returnGoodHeaderDetailsDataDtoList1 = filtrationTransactionSuccessTime(returnGoodHeaderDetailsDataDtoList1);
|
||||||
|
@ -2085,6 +2245,20 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
|
||||||
// return bdBusitypeEntity;
|
// return bdBusitypeEntity;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 2025年8月15日15:58:55 查询U8C业务流程
|
||||||
|
*
|
||||||
|
* @author liuyang
|
||||||
|
*/
|
||||||
|
private BdBusitypeEntity u8cOperationFlowV4() throws Exception {
|
||||||
|
//查询业务流程
|
||||||
|
//2024年8月6日 11:33:07 具体的业务流程名称,还需要实施提供
|
||||||
|
String processName = "TOC销售退款";
|
||||||
|
BdBusitypeEntity bdBusitypeEntity = queryBdBusitypeUtil.queryBdBusitype(processName);
|
||||||
|
Assert.notNull(bdBusitypeEntity, "根据业务流程名称({})没有查询到业务流程", processName);
|
||||||
|
return bdBusitypeEntity;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 检查参数是否为空
|
* 检查参数是否为空
|
||||||
* 2024年8月6日 11:40:19 保险的做法,最好还是验证一下
|
* 2024年8月6日 11:40:19 保险的做法,最好还是验证一下
|
||||||
|
@ -2182,6 +2356,9 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
|
||||||
//测试
|
//测试
|
||||||
// goodsRertunSonDetailsDto.setReceivedQty("1");
|
// goodsRertunSonDetailsDto.setReceivedQty("1");
|
||||||
|
|
||||||
|
//2025年8月18日16:13:12 如果
|
||||||
|
|
||||||
|
|
||||||
Assert.notNull(totalAmount, "实退金额不能为空 明细行主键:{}", goodsRertunSonDetailsDto.getId());
|
Assert.notNull(totalAmount, "实退金额不能为空 明细行主键:{}", goodsRertunSonDetailsDto.getId());
|
||||||
Assert.notNull(goodsRertunSonDetailsDto.getReceivedQty(), "实收数量不能为空 明细行主键:{}", goodsRertunSonDetailsDto.getId());
|
Assert.notNull(goodsRertunSonDetailsDto.getReceivedQty(), "实收数量不能为空 明细行主键:{}", goodsRertunSonDetailsDto.getId());
|
||||||
|
|
||||||
|
@ -2325,6 +2502,20 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
|
||||||
// if (returnGoodSearchHeaderDto.getRefundedAt() != null) {
|
// if (returnGoodSearchHeaderDto.getRefundedAt() != null) {
|
||||||
// tocofsReturngoodsDetailedEntity.setRefundedat(returnGoodSearchHeaderDto.getRefundedAt());
|
// tocofsReturngoodsDetailedEntity.setRefundedat(returnGoodSearchHeaderDto.getRefundedAt());
|
||||||
// }
|
// }
|
||||||
|
com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDetailsDto headerDetailsDto = returnGoodSearchHeaderDto.getHeaderDetailsDto();
|
||||||
|
if (headerDetailsDto != null && headerDetailsDto.getHeader() != null) {
|
||||||
|
com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDto header = headerDetailsDto.getHeader();
|
||||||
|
if (header != null && header.getTradeSuccessAt() != null) {
|
||||||
|
tocofsReturngoodsDetailedEntity.setDef23(header.getTradeSuccessAt());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//入库类型标记
|
||||||
|
String storageTimeStamp = returnGoodSearchHeaderDto.getStorageTimeStamp();
|
||||||
|
if (storageTimeStamp != null && !"".equals(storageTimeStamp)) {
|
||||||
|
tocofsReturngoodsDetailedEntity.setDef24(storageTimeStamp);
|
||||||
|
}
|
||||||
|
|
||||||
//业务类型
|
//业务类型
|
||||||
tocofsReturngoodsDetailedEntity.setBusinesstype("TOC_RETURN");
|
tocofsReturngoodsDetailedEntity.setBusinesstype("TOC_RETURN");
|
||||||
}
|
}
|
||||||
|
@ -2667,6 +2858,7 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
|
||||||
com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDto header2 = headerDetailsDto.getHeader();
|
com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDto header2 = headerDetailsDto.getHeader();
|
||||||
tradeSuccessAt = header2.getTradeSuccessAt();
|
tradeSuccessAt = header2.getTradeSuccessAt();
|
||||||
}
|
}
|
||||||
|
// tradeSuccessAt = "2025-08-18 17:13:35";
|
||||||
|
|
||||||
//如果报错内容太长了,则仅保留500个长度
|
//如果报错内容太长了,则仅保留500个长度
|
||||||
if (newTransmitInfo != null && !"".equals(newTransmitInfo.trim()) && newTransmitInfo.length() >= 400) {
|
if (newTransmitInfo != null && !"".equals(newTransmitInfo.trim()) && newTransmitInfo.length() >= 400) {
|
||||||
|
@ -2793,6 +2985,7 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
|
||||||
tocofsReturngoodsDetailedEntity.setNewsystemprimary3(newsystemprimary);
|
tocofsReturngoodsDetailedEntity.setNewsystemprimary3(newsystemprimary);
|
||||||
}
|
}
|
||||||
tocofsReturngoodsDetailedEntity.setDef23(tradeSuccessAt);
|
tocofsReturngoodsDetailedEntity.setDef23(tradeSuccessAt);
|
||||||
|
tocofsReturngoodsDetailedEntity.setDef24(goodsRertunSonDetailsDto.getStorageTimeStamp());
|
||||||
tocofsReturngoodsDetailedEntityArrayList.add(tocofsReturngoodsDetailedEntity);
|
tocofsReturngoodsDetailedEntityArrayList.add(tocofsReturngoodsDetailedEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,9 @@ spring:
|
||||||
url: jdbc:mysql://ufidahz.com.cn:9014/businesscenter?useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowLoadLocalInfile=false&autoReconnect=true&failOverReadOnly=false&connectTimeout=600000000&socketTimeout=600000000&autoReconnectForPools=true&keepAlive=true
|
url: jdbc:mysql://ufidahz.com.cn:9014/businesscenter?useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowLoadLocalInfile=false&autoReconnect=true&failOverReadOnly=false&connectTimeout=600000000&socketTimeout=600000000&autoReconnectForPools=true&keepAlive=true
|
||||||
username: root
|
username: root
|
||||||
password: bd993088e8a7c3dc5f44441617f9b4bf
|
password: bd993088e8a7c3dc5f44441617f9b4bf
|
||||||
|
#url: jdbc:mysql://127.0.0.1:3307/businesscenter?useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowLoadLocalInfile=false&autoReconnect=true&failOverReadOnly=false&connectTimeout=600000000&socketTimeout=600000000&autoReconnectForPools=true&keepAlive=true
|
||||||
|
#username: root
|
||||||
|
#password: a0d71920b8d3e5cf376fcecc2a23012f
|
||||||
driver-class-name: com.mysql.jdbc.Driver # 3.2.0开始支持SPI可省略此配置
|
driver-class-name: com.mysql.jdbc.Driver # 3.2.0开始支持SPI可省略此配置
|
||||||
savefile:
|
savefile:
|
||||||
# 文件保存路径
|
# 文件保存路径
|
||||||
|
|
|
@ -37,7 +37,7 @@ public class PassiveWarehouseReceiptToCTest {
|
||||||
//情况二
|
//情况二
|
||||||
// passiveWarehouseReceiptToC.startImplementByCode("RH20250731000423", "tran");
|
// passiveWarehouseReceiptToC.startImplementByCode("RH20250731000423", "tran");
|
||||||
//情况三
|
//情况三
|
||||||
passiveWarehouseReceiptToC.startImplementByCode("RH20250722000231", "stock");
|
passiveWarehouseReceiptToC.startImplementByCode("RH20250731000613", "tran");
|
||||||
// passiveWarehouseReceiptToC.startImplementByCode("RH20250723000754", "tran");
|
// passiveWarehouseReceiptToC.startImplementByCode("RH20250723000754", "tran");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
|
@ -69,7 +69,14 @@ public class SoSaleReturnPluginInitializerToCTest {
|
||||||
try {
|
try {
|
||||||
// soSaleReturnPluginInitializerToC.startImplementByTradeTime("2025-04-28 00:00:00", "2025-04-28 23:59:59", "0");
|
// soSaleReturnPluginInitializerToC.startImplementByTradeTime("2025-04-28 00:00:00", "2025-04-28 23:59:59", "0");
|
||||||
|
|
||||||
soSaleReturnPluginInitializerToC.startImplementByCode("LETS-RE2025072800003381", "tran");
|
//满足红字应收单
|
||||||
|
// soSaleReturnPluginInitializerToC.startImplementByCode("LETS-RE2025072200001324", "tran");
|
||||||
|
//情况一
|
||||||
|
soSaleReturnPluginInitializerToC.startImplementByCode("LETS-RE2025072900000460", "stock");
|
||||||
|
//情况二
|
||||||
|
// soSaleReturnPluginInitializerToC.startImplementByCode("LETS-RE2025072800000594", "tran");
|
||||||
|
//情况三
|
||||||
|
// soSaleReturnPluginInitializerToC.startImplementByCode("LETS-RE2025080200002257", "tran");
|
||||||
|
|
||||||
// soSaleReturnPluginInitializerToC.startImplementStockByTime("2025-01-31 00:00:00", "2025-01-31 23:59:59", "0");
|
// soSaleReturnPluginInitializerToC.startImplementStockByTime("2025-01-31 00:00:00", "2025-01-31 23:59:59", "0");
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue