|
|
|
@ -4,6 +4,7 @@ import cn.hutool.core.date.DateUtil; |
|
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
|
import cn.hutool.core.util.RandomUtil; |
|
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
|
import com.alibaba.nacos.common.utils.CollectionUtils; |
|
|
|
|
import com.dxhy.base.constant.OrderSeparationException; |
|
|
|
|
import com.dxhy.base.constant.TaxSeparateConfig; |
|
|
|
|
import com.dxhy.base.utils.PriceTaxSeparationUtilNew; |
|
|
|
@ -11,6 +12,9 @@ import com.dxhy.common.generatepdf.util.EwmUtil; |
|
|
|
|
import com.dxhy.order.baseservice.config.BaseServiceConfig; |
|
|
|
|
import com.dxhy.order.baseservice.module.buyer.model.BuyerEntity; |
|
|
|
|
import com.dxhy.order.baseservice.module.buyer.service.BuyerService; |
|
|
|
|
import com.dxhy.order.baseservice.module.commodity.model.CommodityCodeEntity; |
|
|
|
|
import com.dxhy.order.baseservice.module.taxclass.dao.TaxClassCodeMapper; |
|
|
|
|
import com.dxhy.order.baseservice.module.taxclass.model.TaxClassCodeEntity; |
|
|
|
|
import com.dxhy.order.baseservice.module.thirdservice.simsback.service.SimsBackService; |
|
|
|
|
import com.dxhy.order.baseservice.module.thirdservice.user.model.DeptEntity; |
|
|
|
|
import com.dxhy.order.baseservice.module.thirdservice.user.service.UserInfoService; |
|
|
|
@ -18,6 +22,7 @@ import com.dxhy.order.constant.ConfigureConstant; |
|
|
|
|
import com.dxhy.order.constant.OrderInfoContentEnum; |
|
|
|
|
import com.dxhy.order.constant.OrderInfoEnum; |
|
|
|
|
import com.dxhy.order.constant.OrderManagementConstant; |
|
|
|
|
import com.dxhy.order.consumer.dao.GroupCommodityCodeMapper; |
|
|
|
|
import com.dxhy.order.consumer.dao.OrderBatchRequestMapper; |
|
|
|
|
import com.dxhy.order.consumer.dao.OrderProcessInfoMapper; |
|
|
|
|
import com.dxhy.order.consumer.model.OderDetailInfo; |
|
|
|
@ -154,6 +159,12 @@ public class OrderInfoServiceImpl implements OrderInfoService { |
|
|
|
|
@Resource |
|
|
|
|
private SpecialInvoiceReversalMapper specialInvoiceReversalMapper; |
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
private GroupCommodityCodeMapper commodityCodeMapper; |
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
private TaxClassCodeMapper taxClassCodeMapper; |
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
private OrderBatchRequestMapper orderBatchRequestMapper; |
|
|
|
|
|
|
|
|
@ -1792,6 +1803,118 @@ public class OrderInfoServiceImpl implements OrderInfoService { |
|
|
|
|
return R.ok(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public R updateOrderItem(String orderInfoId,String entId){ |
|
|
|
|
//根据订单id查询明细数据
|
|
|
|
|
List<OrderItemInfo> orderItemInfos = orderItemInfoMapper.selectAllByOrderId(Arrays.asList(orderInfoId), null); |
|
|
|
|
List<OrderItemInfo> orderItemInfoList = new ArrayList<>(); |
|
|
|
|
for (OrderItemInfo orderItemInfo : orderItemInfos) { |
|
|
|
|
if(StringUtils.isNotBlank(orderItemInfo.getSpbm())){ |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
CommodityCodeEntity commodityCodeEntity = commodityCodeMapper.queryCommodityCodeByZxbmAndXhfNsrsbhAndEntId(orderItemInfo.getZxbm(), null, entId); |
|
|
|
|
// 如果公司物料库匹配失败,从集团物料库匹配
|
|
|
|
|
if (commodityCodeEntity == null) { |
|
|
|
|
// 如果匹配不到,则去集团物料库匹配
|
|
|
|
|
commodityCodeEntity = commodityCodeMapper.queryCommodityCodeByZxbmAndXhfNsrsbhAndEntId(orderItemInfo.getZxbm(), "-1",null); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if(commodityCodeEntity != null){ |
|
|
|
|
completeCommodityMessageBySpid(orderItemInfo, commodityCodeEntity); |
|
|
|
|
orderItemInfo.setZnfm(ConfigureConstant.STRING_1); |
|
|
|
|
orderItemInfo.setXmsl(null); |
|
|
|
|
orderItemInfo.setXmdj(null); |
|
|
|
|
} |
|
|
|
|
orderItemInfoList.add(orderItemInfo); |
|
|
|
|
} |
|
|
|
|
if(!orderItemInfoList.isEmpty()){ |
|
|
|
|
orderItemInfoMapper.updateOrderItemId(orderItemInfoList); |
|
|
|
|
} |
|
|
|
|
return R.ok(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void completeCommodityMessageBySpid(OrderItemInfo item, CommodityCodeEntity commodity) { |
|
|
|
|
//商品编码
|
|
|
|
|
if (StringUtils.isBlank(item.getSpbm()) && StringUtils.isNotBlank(commodity.getSpbm())) { |
|
|
|
|
item.setSpbm(commodity.getSpbm()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//自行编码
|
|
|
|
|
if (StringUtils.isBlank(item.getZxbm()) && StringUtils.isNotBlank(commodity.getZxbm())) { |
|
|
|
|
item.setZxbm(commodity.getZxbm()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//优惠政策标识
|
|
|
|
|
if (StringUtils.isBlank(item.getYhzcbs()) && StringUtils.isNotBlank(commodity.getYhzcbs())) { |
|
|
|
|
item.setYhzcbs(commodity.getYhzcbs()); |
|
|
|
|
}else if(StringUtils.isBlank(item.getYhzcbs()) && StringUtils.isBlank(commodity.getYhzcbs())){ |
|
|
|
|
item.setYhzcbs(ConfigureConstant.STRING_0); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//零税率标识
|
|
|
|
|
if (StringUtils.isBlank(item.getLslbs()) && StringUtils.isNotBlank(commodity.getLslbs())) { |
|
|
|
|
item.setLslbs(commodity.getLslbs()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//增值税特殊管理
|
|
|
|
|
if (StringUtils.isBlank(item.getZzstsgl()) && StringUtils.isNotBlank(commodity.getZzstsgl())) { |
|
|
|
|
item.setZzstsgl(commodity.getZzstsgl()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//如果项目名称为空,使用底层返回数据进行补全,如果不为空,并且需要补全,则进行补全
|
|
|
|
|
String spmc = item.getXmmc(); |
|
|
|
|
StringBuilder stringBuilder = new StringBuilder(); |
|
|
|
|
if (StringUtils.isBlank(spmc)) { |
|
|
|
|
if(StrUtil.isNotBlank(commodity.getInvoiceName())){ |
|
|
|
|
spmc = stringBuilder.append("*").append(commodity.getSpjc()).append("*").append(commodity.getInvoiceName()).toString(); |
|
|
|
|
}else{ |
|
|
|
|
spmc = stringBuilder.append("*").append(commodity.getSpjc()).append("*").append(commodity.getXmmc()).toString(); |
|
|
|
|
} |
|
|
|
|
} else if (StringUtil.checkStr(spmc, commodity.getSpjc())) { |
|
|
|
|
spmc = stringBuilder.append("*").append(commodity.getSpjc()).append("*").append(spmc).toString(); |
|
|
|
|
} |
|
|
|
|
item.setXmmc(spmc); |
|
|
|
|
|
|
|
|
|
//发票行性质为折扣行,不补全,单价,数量,单位,规格型号
|
|
|
|
|
if (!OrderInfoEnum.FPHXZ_CODE_1.getKey().equals(item.getFphxz())) { |
|
|
|
|
//规格型号
|
|
|
|
|
if (StringUtils.isBlank(item.getGgxh()) && StringUtils.isNotBlank(commodity.getGgxh())) { |
|
|
|
|
item.setGgxh(commodity.getGgxh()); |
|
|
|
|
} |
|
|
|
|
//单位
|
|
|
|
|
if (StringUtils.isBlank(item.getXmdw()) && StringUtils.isNotBlank(commodity.getXmdw())) { |
|
|
|
|
item.setXmdw(commodity.getXmdw()); |
|
|
|
|
} |
|
|
|
|
//商品数量
|
|
|
|
|
if (StringUtils.isBlank(item.getXmsl())) { |
|
|
|
|
item.setXmsl(""); |
|
|
|
|
} |
|
|
|
|
//单价
|
|
|
|
|
if (StringUtils.isBlank(item.getXmdj()) && StringUtils.isNotBlank(commodity.getXmdj())) { |
|
|
|
|
item.setXmdj(commodity.getXmdj()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//含税标志
|
|
|
|
|
if (StringUtils.isBlank(item.getHsbz()) && StringUtils.isNotBlank(commodity.getHsbz())) { |
|
|
|
|
item.setHsbz(commodity.getHsbz()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//如果税率为空使用查询到的税率否则使用原税率
|
|
|
|
|
if (StringUtils.isBlank(item.getSl()) && StringUtils.isNotBlank(commodity.getSl())) { |
|
|
|
|
item.setSl(CommonUtils.formatSl(commodity.getSl())); |
|
|
|
|
} |
|
|
|
|
if(StringUtils.isBlank(item.getTswl()) && StringUtils.isNotBlank(commodity.getTswl())){ |
|
|
|
|
item.setTswl(commodity.getTswl()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//税额
|
|
|
|
|
if (StringUtils.isBlank(item.getSe())) { |
|
|
|
|
item.setSe(""); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private PageKySlRsp getDefaultKySlList(OrderInfoEnum orderInfoEnum){ |
|
|
|
|
PageKySlRsp pageKySlRsp = new PageKySlRsp(); |
|
|
|
|
pageKySlRsp.setSl(orderInfoEnum.getKey()); |
|
|
|
|