|
|
@@ -15,12 +15,12 @@ import com.dk.mdm.infrastructure.convert.ivt.InboundConvert;
|
|
|
import com.dk.mdm.infrastructure.convert.ivt.InboundItemConvert;
|
|
|
import com.dk.mdm.mapper.ivt.InboundItemMapper;
|
|
|
import com.dk.mdm.mapper.ivt.InboundMapper;
|
|
|
-import com.dk.mdm.mapper.sale.OutReturnItemMapper;
|
|
|
-import com.dk.mdm.mapper.sale.OutReturnMapper;
|
|
|
+import com.dk.mdm.mapper.ivt.IntoReturnItemMapper;
|
|
|
+import com.dk.mdm.mapper.ivt.IntoReturnMapper;
|
|
|
import com.dk.mdm.model.pojo.ivt.Inbound;
|
|
|
import com.dk.mdm.model.pojo.ivt.InboundItem;
|
|
|
-import com.dk.mdm.model.pojo.sale.OutReturn;
|
|
|
-import com.dk.mdm.model.pojo.sale.OutReturnItem;
|
|
|
+import com.dk.mdm.model.pojo.ivt.IntoReturn;
|
|
|
+import com.dk.mdm.model.pojo.ivt.IntoReturnItem;
|
|
|
import com.dk.mdm.model.query.ivt.InboundItemQuery;
|
|
|
import com.dk.mdm.model.query.ivt.InboundQuery;
|
|
|
import com.dk.mdm.model.response.ivt.InboundItemResponse;
|
|
|
@@ -41,11 +41,11 @@ import java.util.UUID;
|
|
|
|
|
|
/**
|
|
|
* @author : 寇珊珊
|
|
|
- * @desc : 销售退货入库业务层
|
|
|
+ * @desc : 采购退货入库业务层
|
|
|
* @date : 2024/3/7 14:11
|
|
|
*/
|
|
|
@Service
|
|
|
-public class InboundSaleReturnService extends BaseService<Inbound> {
|
|
|
+public class InboundPurchaseReturnService extends BaseService<Inbound> {
|
|
|
|
|
|
@Override
|
|
|
public BaseMapper<Inbound> getRepository() {
|
|
|
@@ -65,10 +65,10 @@ public class InboundSaleReturnService extends BaseService<Inbound> {
|
|
|
private InboundItemConvert inboundItemConvert;
|
|
|
|
|
|
@Autowired
|
|
|
- private OutReturnMapper outReturnMapper;
|
|
|
+ private IntoReturnMapper intoReturnMapper;
|
|
|
|
|
|
@Autowired
|
|
|
- private OutReturnItemMapper outReturnItemMapper;
|
|
|
+ private IntoReturnItemMapper intoReturnItemMapper;
|
|
|
|
|
|
@Autowired
|
|
|
private CommonService commonService;
|
|
|
@@ -91,7 +91,7 @@ public class InboundSaleReturnService extends BaseService<Inbound> {
|
|
|
* @author : 寇珊珊
|
|
|
*/
|
|
|
@Pagination
|
|
|
- public ResponseResultVO<Map<String, Object>> selectOtherInboundItemInfoById(String id) {
|
|
|
+ public ResponseResultVO<Map<String, Object>> selectIntoReturnItemInfoById(String id) {
|
|
|
Map<String, Object> result = new HashMap<>();
|
|
|
// 商品明细
|
|
|
List<InboundItemResponse> inboundItemResponses = inboundItemMapper.selectByCond(new InboundItemQuery().setIntoId(id));
|
|
|
@@ -104,12 +104,12 @@ public class InboundSaleReturnService extends BaseService<Inbound> {
|
|
|
|
|
|
|
|
|
/**
|
|
|
- * @desc : 销售退货入库新建
|
|
|
+ * @desc : 采购退货入库新建
|
|
|
* @date : 2024/3/7 14:13
|
|
|
* @author : 寇珊珊
|
|
|
*/
|
|
|
@Transactional(rollbackFor = {Exception.class})
|
|
|
- public ResponseResultVO<?> saleReturnInboundInsert(InboundVO inboundVO) {
|
|
|
+ public ResponseResultVO<?> purchaseReturnInboundInsert(InboundVO inboundVO) {
|
|
|
//region 总单
|
|
|
//获取 id/单号
|
|
|
Map<String, Object> codeMap = commonService.getUniqueNoteCode(Constant.docNameConstant.SALERETURN.getName(), false);
|
|
|
@@ -147,24 +147,20 @@ public class InboundSaleReturnService extends BaseService<Inbound> {
|
|
|
inboundMapper.insert(inbound);
|
|
|
//endregion
|
|
|
|
|
|
- //region 销售退货
|
|
|
+ //region 采购退货
|
|
|
if (inboundVO.getFromId() != null) {
|
|
|
- OutReturn outReturn = new OutReturn();
|
|
|
-// IntoReturnResponse intoReturnResponse = intoReturnMapper.selectById(inboundVO.getFromId());
|
|
|
-// intoReturn.setOutingQty(intoReturnResponse.getOutingQty().subtract(inboundVO.getIntoingQty()));
|
|
|
-// intoReturn.setOutingAmt(intoReturnResponse.getOutingAmt().subtract(inboundVO.getIntoingAmt()));
|
|
|
-// intoReturn.setOutQty(intoReturnResponse.getOutQty().add(inboundVO.getIntoAmt()));
|
|
|
-// intoReturn.setOutAmt(intoReturnResponse.getOutAmt().add(inboundVO.getIntoQty()));
|
|
|
- outReturn.setReturnId(inboundVO.getFromId());
|
|
|
- outReturn.setIntoingQty(inboundVO.getIntoingQty().negate());
|
|
|
- outReturn.setIntoingAmt(inboundVO.getIntoingAmt().negate());
|
|
|
- outReturn.setIntoQty(inboundVO.getIntoAmt());
|
|
|
- outReturn.setIntoAmt(inboundVO.getIntoQty());
|
|
|
+ //赋值(这里重写了更新方法,数量在更新方法中有数据库院士数量+本次数量)
|
|
|
+ IntoReturn intoReturn = new IntoReturn();
|
|
|
+ intoReturn.setReturnId(inboundVO.getFromId());
|
|
|
+ intoReturn.setOutingQty(inboundVO.getIntoingQty().negate());
|
|
|
+ intoReturn.setOutingAmt(inboundVO.getIntoingAmt().negate());
|
|
|
+ intoReturn.setOutQty(inboundVO.getIntoQty());
|
|
|
+ intoReturn.setOutAmt(inboundVO.getIntoQty());
|
|
|
//入库状态
|
|
|
- String intoStatus = this.setIntoStatus(outReturn.getIntoingQty(), outReturn.getIntoQty());
|
|
|
- outReturn.setIntoStatus(intoStatus);
|
|
|
+ String outStatus = this.setOutStatus(intoReturn.getOutingQty(), intoReturn.getOutQty());
|
|
|
+ intoReturn.setOutStatus(outStatus);
|
|
|
//修改
|
|
|
- int countRow = outReturnMapper.updateById(outReturn);
|
|
|
+ int countRow = intoReturnMapper.updateById(intoReturn);
|
|
|
//数量超出
|
|
|
if (countRow == 0) {
|
|
|
throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.INVENTORY_QUANTITY_EXCEEDED.getMessage());
|
|
|
@@ -199,59 +195,30 @@ public class InboundSaleReturnService extends BaseService<Inbound> {
|
|
|
//成本单价
|
|
|
inboundItemVO.setCostPrice(inboundItemVO.getPriceInto());
|
|
|
//成本金额
|
|
|
- inboundItemVO.setCostAmt(inboundItemVO.getIntoingQty().multiply(inboundItemVO.getPriceInto()).setScale(2, BigDecimal.ROUND_HALF_UP));
|
|
|
+ inboundItemVO.setCostAmt((inboundItemVO.getIntoingQty().add(inboundItemVO.getIntoQty())).multiply(inboundItemVO.getPriceInto()).setScale(2, BigDecimal.ROUND_HALF_UP));
|
|
|
//库存数量 已入库-出库
|
|
|
- inboundItemVO.setInvQty(inboundItemVO.getIntoQty().subtract(inboundItemVO.getOutQty()));
|
|
|
+ inboundItemVO.setInvQty(inboundItemVO.getIntoQty().abs().subtract(inboundItemVO.getOutQty()));
|
|
|
//入库状态
|
|
|
inboundItemVO.setIntoStatus(inboundVO.getIntoStatus());
|
|
|
- //退货数量
|
|
|
- inboundItemVO.setReturnQty(inboundItemVO.getIntoingQty());
|
|
|
- //退货金额
|
|
|
- inboundItemVO.setReturnAmt(inboundItemVO.getIntoingAmt());
|
|
|
//实体转换
|
|
|
InboundItem inboundItem = inboundItemConvert.convertToPo(inboundItemVO);
|
|
|
inboundItemMapper.insert(inboundItem);
|
|
|
//endregion
|
|
|
|
|
|
- //region 销售退货明细
|
|
|
+ //region 采购退货明细
|
|
|
if (inboundItemVO.getFromItemId() != null) {
|
|
|
- //region todo 可能无用代码
|
|
|
- // IntoReturnItemResponse intoReturnItemResponse = intoReturnItemMapper.selectById(inboundItemVO.getFromItemId());
|
|
|
-// intoReturnItem.setOutQty(intoReturnItemResponse.getOutQty().add(inboundItemVO.getIntoQty()));
|
|
|
-// intoReturnItem.setOutAmt(intoReturnItemResponse.getOutAmt().add(inboundItemVO.getIntoAmt()));
|
|
|
-// intoReturnItem.setOutingQty(intoReturnItemResponse.getOutingQty().add(inboundItemVO.getIntoingQty()));
|
|
|
-// intoReturnItem.setOutingAmt(intoReturnItemResponse.getOutingAmt().add(inboundItemVO.getIntoingAmt()));
|
|
|
- //endregion
|
|
|
-
|
|
|
- //region todo 出库可能用到 用不到记得删掉
|
|
|
-// IntoReturnItem intoReturnItem = new IntoReturnItem();
|
|
|
-// intoReturnItem.setItemId(inboundItemVO.getFromItemId());
|
|
|
-// intoReturnItem.setOutQty(inboundItemVO.getIntoQty());
|
|
|
-// intoReturnItem.setOutAmt(inboundItemVO.getIntoAmt());
|
|
|
-// intoReturnItem.setOutingQty(inboundItemVO.getIntoingQty());
|
|
|
-// intoReturnItem.setOutingAmt(inboundItemVO.getIntoingAmt());
|
|
|
-// //出库状态
|
|
|
-// String outStatus = this.setOutStatus(intoReturnItem.getOutingQty(), intoReturnItem.getOutQty());
|
|
|
-// intoReturnItem.setOutStatus(outStatus);
|
|
|
-// //修改
|
|
|
-// int countRow = intoReturnItemMapper.updateById(intoReturnItem);
|
|
|
-// //数量超出
|
|
|
-// if (countRow == 0) {
|
|
|
-// throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.INVENTORY_QUANTITY_EXCEEDED.getMessage());
|
|
|
-// }
|
|
|
- //endregion
|
|
|
-
|
|
|
- OutReturnItem outReturnItem = new OutReturnItem();
|
|
|
- outReturnItem.setItemId(inboundItemVO.getFromItemId());
|
|
|
- outReturnItem.setIntoQty(inboundItemVO.getIntoQty());
|
|
|
- outReturnItem.setIntoAmt(inboundItemVO.getIntoAmt());
|
|
|
- outReturnItem.setIntoingQty(inboundItemVO.getIntoingQty());
|
|
|
- outReturnItem.setIntoingAmt(inboundItemVO.getIntoingAmt());
|
|
|
- //入库状态
|
|
|
- String intoStatus = this.setIntoStatus(outReturnItem.getIntoingQty(), outReturnItem.getIntoQty());
|
|
|
- outReturnItem.setIntoStatus(intoStatus);
|
|
|
+ //赋值 (这里重写了更新方法,数量在更新方法中有数据库院士数量+本次数量)
|
|
|
+ IntoReturnItem intoReturnItem = new IntoReturnItem();
|
|
|
+ intoReturnItem.setItemId(inboundItemVO.getFromItemId());
|
|
|
+ intoReturnItem.setOutQty(inboundItemVO.getIntoQty().abs());
|
|
|
+ intoReturnItem.setOutAmt(inboundItemVO.getIntoAmt().abs());
|
|
|
+ intoReturnItem.setOutingQty(inboundItemVO.getIntoingQty().abs());
|
|
|
+ intoReturnItem.setOutingAmt(inboundItemVO.getIntoingAmt().abs());
|
|
|
+ //出库状态
|
|
|
+ String outStatus = this.setOutStatus(intoReturnItem.getOutingQty(), intoReturnItem.getOutQty());
|
|
|
+ intoReturnItem.setOutStatus(outStatus);
|
|
|
//修改
|
|
|
- int countRow = outReturnItemMapper.updateById(outReturnItem);
|
|
|
+ int countRow = intoReturnItemMapper.updateById(intoReturnItem);
|
|
|
//数量超出
|
|
|
if (countRow == 0) {
|
|
|
throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.INVENTORY_QUANTITY_EXCEEDED.getMessage());
|
|
|
@@ -274,7 +241,7 @@ public class InboundSaleReturnService extends BaseService<Inbound> {
|
|
|
|
|
|
|
|
|
/**
|
|
|
- * @desc : 销售退货入库办理
|
|
|
+ * @desc : 采购退货入库办理
|
|
|
* @date : 2024/3/7 15:47
|
|
|
* @author : 寇珊珊
|
|
|
*/
|
|
|
@@ -288,11 +255,15 @@ public class InboundSaleReturnService extends BaseService<Inbound> {
|
|
|
}
|
|
|
for (InboundItemVO inboundItemVO : inboundVO.getItemList()) {
|
|
|
if (inboundItemVO.getIntoId() != null) {
|
|
|
+ //查询原单
|
|
|
+ InboundItemResponse inboundItemResponse = inboundItemMapper.selectById(inboundItemVO.getItemId());
|
|
|
//编辑明细
|
|
|
inboundItemVO.setCostPrice(inboundItemVO.getPriceInto())
|
|
|
- .setCostAmt(inboundItemVO.getIntoingQty().multiply(inboundItemVO.getPriceInto()).setScale(2, BigDecimal.ROUND_HALF_UP))
|
|
|
- .setIntoQty(inboundItemVO.getIntoingQty())
|
|
|
- .setIntoAmt(inboundItemVO.getIntoingAmt());
|
|
|
+ .setCostAmt((inboundItemVO.getIntoingQty().add(inboundItemVO.getIntoQty())).multiply(inboundItemVO.getPriceInto()).setScale(2, BigDecimal.ROUND_HALF_UP))
|
|
|
+ .setIntoingQty(inboundItemResponse.getIntoingQty().subtract(inboundItemVO.getIntoingQty()))
|
|
|
+ .setIntoingAmt(inboundItemResponse.getIntoingAmt().subtract(inboundItemVO.getIntoingAmt()))
|
|
|
+ .setIntoQty(inboundItemResponse.getIntoingQty().add(inboundItemVO.getIntoingQty()))
|
|
|
+ .setIntoAmt(inboundItemResponse.getIntoAmt().add(inboundItemVO.getIntoingAmt()));
|
|
|
//入库状态
|
|
|
String intoStatus = this.setIntoStatus(inboundItemVO.getIntoingQty(), inboundItemVO.getIntoQty());
|
|
|
inboundItemVO.setIntoStatus(intoStatus);
|
|
|
@@ -324,45 +295,20 @@ public class InboundSaleReturnService extends BaseService<Inbound> {
|
|
|
}
|
|
|
//endregion
|
|
|
|
|
|
- //region 销售退货明细
|
|
|
+ //region 采购退货明细
|
|
|
if (inboundItemVO.getFromItemId() != null) {
|
|
|
- //endregion todo 可能无用的代码
|
|
|
-// IntoReturnItemResponse intoReturnItemResponse = intoReturnItemMapper.selectById(inboundItemVO.getFromItemId());
|
|
|
-// intoReturnItem.setOutQty(intoReturnItemResponse.getOutQty().add(inboundItemVO.getIntoQty()));
|
|
|
-// intoReturnItem.setOutAmt(intoReturnItemResponse.getOutAmt().add(inboundItemVO.getIntoAmt()));
|
|
|
-// intoReturnItem.setOutingQty(intoReturnItemResponse.getOutingQty().add(inboundItemVO.getIntoingQty()));
|
|
|
-// intoReturnItem.setOutingAmt(intoReturnItemResponse.getOutingAmt().add(inboundItemVO.getIntoingAmt()));
|
|
|
- //endregion
|
|
|
-
|
|
|
- //region todo 出库可能用到的代码 用不到记得删掉
|
|
|
-// IntoReturnItem intoReturnItem = new IntoReturnItem();
|
|
|
-// intoReturnItem.setItemId(inboundItemVO.getFromItemId());
|
|
|
-//
|
|
|
-// intoReturnItem.setOutQty(inboundItemVO.getIntoQty());
|
|
|
-// intoReturnItem.setOutAmt(inboundItemVO.getIntoAmt());
|
|
|
-// intoReturnItem.setOutingQty(inboundItemVO.getIntoingQty());
|
|
|
-// intoReturnItem.setOutingAmt(inboundItemVO.getIntoingAmt());
|
|
|
-// //出库状态
|
|
|
-// String outStatus = this.setOutStatus(intoReturnItem.getOutingQty(), intoReturnItem.getOutQty());
|
|
|
-// intoReturnItem.setOutStatus(outStatus);
|
|
|
-// //修改
|
|
|
-// int countRow = intoReturnItemMapper.updateById(intoReturnItem);
|
|
|
-// //数量超出
|
|
|
-// if (countRow == 0) {
|
|
|
-// throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.INVENTORY_QUANTITY_EXCEEDED.getMessage());
|
|
|
-// }
|
|
|
- //endregion
|
|
|
- OutReturnItem outReturnItem = new OutReturnItem();
|
|
|
- outReturnItem.setItemId(inboundItemVO.getFromItemId());
|
|
|
- outReturnItem.setIntoQty(inboundItemVO.getIntoQty());
|
|
|
- outReturnItem.setIntoAmt(inboundItemVO.getIntoAmt());
|
|
|
- outReturnItem.setIntoingQty(inboundItemVO.getIntoingQty());
|
|
|
- outReturnItem.setIntoingAmt(inboundItemVO.getIntoingAmt());
|
|
|
- //入库状态
|
|
|
- String intoStatus = this.setIntoStatus(outReturnItem.getIntoingQty(), outReturnItem.getIntoQty());
|
|
|
- outReturnItem.setIntoStatus(intoStatus);
|
|
|
+ //赋值(这里重写了更新方法,数量在更新方法中有数据库院士数量+本次数量)
|
|
|
+ IntoReturnItem intoReturnItem = new IntoReturnItem();
|
|
|
+ intoReturnItem.setItemId(inboundItemVO.getFromItemId());
|
|
|
+ intoReturnItem.setOutQty(inboundItemVO.getIntoQty().abs());
|
|
|
+ intoReturnItem.setOutAmt(inboundItemVO.getIntoAmt().abs());
|
|
|
+ intoReturnItem.setOutingQty(inboundItemVO.getIntoingQty());
|
|
|
+ intoReturnItem.setOutingAmt(inboundItemVO.getIntoingAmt());
|
|
|
+ //出库状态
|
|
|
+ String outStatus = this.setOutStatus(intoReturnItem.getOutingQty(), intoReturnItem.getOutQty());
|
|
|
+ intoReturnItem.setOutStatus(outStatus);
|
|
|
//修改
|
|
|
- int countRow = outReturnItemMapper.updateById(outReturnItem);
|
|
|
+ int countRow = intoReturnItemMapper.updateById(intoReturnItem);
|
|
|
//数量超出
|
|
|
if (countRow == 0) {
|
|
|
throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.INVENTORY_QUANTITY_EXCEEDED.getMessage());
|
|
|
@@ -392,51 +338,26 @@ public class InboundSaleReturnService extends BaseService<Inbound> {
|
|
|
.eq(InboundItem::getItemId, UUID.fromString(inboundItem.getItemId()))
|
|
|
);
|
|
|
}
|
|
|
- //region 销售退货明细
|
|
|
+ //region 采购退货明细
|
|
|
if (inboundItemVO.getFromItemId() != null) {
|
|
|
- //region todo 可能无用的代码
|
|
|
-// IntoReturnItemResponse intoReturnItemResponse = intoReturnItemMapper.selectById(inboundItemVO.getFromItemId());
|
|
|
-// intoReturnItem.setOutQty(intoReturnItemResponse.getOutQty().subtract(inboundItemVO.getIntoQty()));
|
|
|
-// intoReturnItem.setOutAmt(intoReturnItemResponse.getOutAmt().subtract(inboundItemVO.getIntoAmt()));
|
|
|
-// intoReturnItem.setOutingQty(intoReturnItemResponse.getOutingQty().subtract(inboundItemVO.getIntoingQty()));
|
|
|
-// intoReturnItem.setOutingAmt(intoReturnItemResponse.getOutingAmt().subtract(inboundItemVO.getIntoingAmt()));
|
|
|
- //endregion
|
|
|
-
|
|
|
- //region todo 出库可能用到的代码 用过后记得删除
|
|
|
-// IntoReturnItem intoReturnItem = new IntoReturnItem();
|
|
|
-// intoReturnItem.setItemId(inboundItemVO.getFromItemId());
|
|
|
-// intoReturnItem.setOutQty(inboundItemVO.getIntoQty().negate());
|
|
|
-// intoReturnItem.setOutAmt(inboundItemVO.getIntoAmt().negate());
|
|
|
-// intoReturnItem.setOutingQty(inboundItemVO.getIntoingQty().negate());
|
|
|
-// intoReturnItem.setOutingAmt(inboundItemVO.getIntoingAmt().negate());
|
|
|
-// //出库状态
|
|
|
-// String outStatus = this.setOutStatus(intoReturnItem.getOutingQty(), intoReturnItem.getOutQty());
|
|
|
-// intoReturnItem.setOutStatus(outStatus);
|
|
|
-// //修改
|
|
|
-// int countRow = intoReturnItemMapper.updateById(intoReturnItem);
|
|
|
-// //数量超出
|
|
|
-// if (countRow == 0) {
|
|
|
-// throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.INVENTORY_QUANTITY_EXCEEDED.getMessage());
|
|
|
-// }
|
|
|
- //endregion
|
|
|
-
|
|
|
- //region 销售退货订单明细
|
|
|
- OutReturnItem outReturnItem = new OutReturnItem();
|
|
|
- outReturnItem.setItemId(inboundItemVO.getFromItemId());
|
|
|
- outReturnItem.setIntoQty(inboundItemVO.getIntoQty().negate());
|
|
|
- outReturnItem.setIntoAmt(inboundItemVO.getIntoAmt().negate());
|
|
|
- outReturnItem.setIntoingQty(inboundItemVO.getIntoingQty().negate());
|
|
|
- outReturnItem.setIntoingAmt(inboundItemVO.getIntoingAmt().negate());
|
|
|
- //入库状态
|
|
|
- String intoStatus = this.setIntoStatus(outReturnItem.getIntoingQty(), outReturnItem.getIntoQty());
|
|
|
- outReturnItem.setIntoStatus(intoStatus);
|
|
|
+ //采购退货单明细
|
|
|
+ //赋值(这里重写了更新方法,数量在更新方法中有数据库院士数量+本次数量)
|
|
|
+ IntoReturnItem intoReturnItem = new IntoReturnItem();
|
|
|
+ intoReturnItem.setItemId(inboundItemVO.getFromItemId());
|
|
|
+ intoReturnItem.setOutQty(inboundItemVO.getIntoQty());
|
|
|
+ intoReturnItem.setOutAmt(inboundItemVO.getIntoAmt());
|
|
|
+ intoReturnItem.setOutingQty(inboundItemVO.getIntoingQty());
|
|
|
+ intoReturnItem.setOutingAmt(inboundItemVO.getIntoingAmt());
|
|
|
+ //出库状态
|
|
|
+ String outStatus = this.setOutStatus(intoReturnItem.getOutingQty(), intoReturnItem.getOutQty());
|
|
|
+ intoReturnItem.setOutStatus(outStatus);
|
|
|
//修改
|
|
|
- int countRow = outReturnItemMapper.updateById(outReturnItem);
|
|
|
+ int countRow = intoReturnItemMapper.updateById(intoReturnItem);
|
|
|
//数量超出
|
|
|
if (countRow == 0) {
|
|
|
throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.INVENTORY_QUANTITY_EXCEEDED.getMessage());
|
|
|
}
|
|
|
- //endregion
|
|
|
+
|
|
|
}
|
|
|
//endregion
|
|
|
|
|
|
@@ -466,52 +387,24 @@ public class InboundSaleReturnService extends BaseService<Inbound> {
|
|
|
);
|
|
|
//endregion
|
|
|
|
|
|
- //region 修改销售退货订单
|
|
|
+ //region 修改采购退货订单
|
|
|
if (inboundVO.getFromId() != null) {
|
|
|
- //region todo 可能无用的代码
|
|
|
- //查询
|
|
|
-// IntoReturnResponse intoReturnResponse = intoReturnMapper.selectById(inboundVO.getFromId());
|
|
|
-// intoReturn.setOutQty(intoReturnResponse.getOutQty().add(sumIntoQty).subtract(sumDelIntoQty));
|
|
|
-// intoReturn.setOutAmt(intoReturnResponse.getOutAmt().add(sumIntoAmt).subtract(sumDelIntoAmt));
|
|
|
-// intoReturn.setOutingQty(intoReturnResponse.getOutingQty().subtract(sumIntoQty).subtract(sumDelIntoingQty));
|
|
|
-// intoReturn.setOutingAmt(intoReturnResponse.getOutingAmt().subtract(sumIntoAmt).subtract(sumDelIntoingAmt));
|
|
|
- //endregion
|
|
|
-
|
|
|
- //region todo 出库可能用到的代码 用完记得删除
|
|
|
-// IntoReturn intoReturn = new IntoReturn();
|
|
|
-// intoReturn.setReturnId(inboundVO.getFromId());
|
|
|
-// intoReturn.setOutQty(sumIntoQty.subtract(sumDelIntoQty));
|
|
|
-// intoReturn.setOutAmt(sumIntoAmt.subtract(sumDelIntoAmt));
|
|
|
-// intoReturn.setOutingQty((sumIntoQty.add(sumDelIntoingQty)).negate());
|
|
|
-// intoReturn.setOutingAmt((sumIntoAmt.add(sumDelIntoingAmt)).negate());
|
|
|
-// //入库状态
|
|
|
-// String outStatus = this.setOutStatus(intoReturn.getOutingQty(), intoReturn.getOutQty());
|
|
|
-// intoReturn.setOutStatus(outStatus);
|
|
|
-// //修改
|
|
|
-// int countRow = intoReturnMapper.updateById(intoReturn);
|
|
|
-// //数量超出
|
|
|
-// if (countRow == 0) {
|
|
|
-// throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.INVENTORY_QUANTITY_EXCEEDED.getMessage());
|
|
|
-// }
|
|
|
- //endregion
|
|
|
-
|
|
|
- OutReturn outReturn = new OutReturn();
|
|
|
- outReturn.setReturnId(inboundVO.getFromId());
|
|
|
- outReturn.setIntoQty(sumIntoQty.subtract(sumDelIntoQty));
|
|
|
- outReturn.setIntoAmt(sumIntoAmt.subtract(sumDelIntoAmt));
|
|
|
- outReturn.setIntoingQty((sumIntoQty.add(sumDelIntoingQty)).negate());
|
|
|
- outReturn.setIntoingAmt((sumIntoAmt.add(sumDelIntoingAmt)).negate());
|
|
|
+ //赋值(这里重写了更新方法,数量在更新方法中有数据库院士数量+本次数量)
|
|
|
+ IntoReturn intoReturn = new IntoReturn();
|
|
|
+ intoReturn.setReturnId(inboundVO.getFromId());
|
|
|
+ intoReturn.setOutQty((sumIntoQty.subtract(sumDelIntoQty)).abs());
|
|
|
+ intoReturn.setOutAmt((sumIntoAmt.subtract(sumDelIntoAmt)).abs());
|
|
|
+ intoReturn.setOutingQty(sumIntoQty.add(sumDelIntoingQty));
|
|
|
+ intoReturn.setOutingAmt(sumIntoAmt.add(sumDelIntoingAmt));
|
|
|
//入库状态
|
|
|
- String outReturnIntoStatus = this.setIntoStatus(outReturn.getIntoingQty(), outReturn.getIntoQty());
|
|
|
- outReturn.setIntoStatus(outReturnIntoStatus);
|
|
|
+ String outStatus = this.setOutStatus(intoReturn.getOutingQty(), intoReturn.getOutQty());
|
|
|
+ intoReturn.setOutStatus(outStatus);
|
|
|
//修改
|
|
|
- int countRow = outReturnMapper.updateById(outReturn);
|
|
|
+ int countRow = intoReturnMapper.updateById(intoReturn);
|
|
|
//数量超出
|
|
|
if (countRow == 0) {
|
|
|
throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.INVENTORY_QUANTITY_EXCEEDED.getMessage());
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
//endregion
|
|
|
|
|
|
@@ -524,7 +417,7 @@ public class InboundSaleReturnService extends BaseService<Inbound> {
|
|
|
|
|
|
|
|
|
/**
|
|
|
- * @desc : 销售退货入库撤销
|
|
|
+ * @desc : 采购退货入库撤销
|
|
|
* @date : 2024/3/7 17:06
|
|
|
* @author : 寇珊珊
|
|
|
*/
|
|
|
@@ -536,51 +429,22 @@ public class InboundSaleReturnService extends BaseService<Inbound> {
|
|
|
|
|
|
//region 修改订单数据信息
|
|
|
if (inboundVO.getFromId() != null) {
|
|
|
- //region todo 可能无用的代码
|
|
|
- //查询
|
|
|
-// IntoReturnResponse intoReturnResponse = intoReturnMapper.selectById(inboundVO.getFromId());
|
|
|
-// intoReturn.setOutQty(intoReturnResponse.getOutQty().add(inboundResponse.getIntoQty()));
|
|
|
-// intoReturn.setOutAmt(intoReturnResponse.getOutAmt().add(inboundResponse.getIntoAmt()));
|
|
|
-// intoReturn.setOutingQty(intoReturnResponse.getOutingQty().subtract(inboundResponse.getIntoQty()));
|
|
|
-// intoReturn.setOutingAmt(intoReturnResponse.getOutingAmt().subtract(inboundResponse.getIntoAmt()));
|
|
|
- //endregion
|
|
|
-
|
|
|
- //region todo 出库可能用到的代码 用完记得删除
|
|
|
- //赋值
|
|
|
-// IntoReturn intoReturn = new IntoReturn();
|
|
|
-// intoReturn.setReturnId(inboundVO.getFromId());
|
|
|
-// intoReturn.setOutQty(inboundResponse.getIntoQty());
|
|
|
-// intoReturn.setOutAmt(inboundResponse.getIntoAmt());
|
|
|
-// intoReturn.setOutingQty(inboundResponse.getIntoQty().negate());
|
|
|
-// intoReturn.setOutingAmt(inboundResponse.getIntoAmt().negate());
|
|
|
-// //入库状态
|
|
|
-// String outStatus = this.setOutStatus(intoReturn.getOutingQty(), intoReturn.getOutQty());
|
|
|
-// intoReturn.setOutStatus(outStatus);
|
|
|
-// //修改
|
|
|
-// int countRow = intoReturnMapper.updateById(intoReturn);
|
|
|
-// //数量超出
|
|
|
-// if (countRow == 0) {
|
|
|
-// throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.INVENTORY_QUANTITY_EXCEEDED.getMessage());
|
|
|
-// }
|
|
|
- //endregion
|
|
|
-
|
|
|
- //赋值
|
|
|
- OutReturn outReturn = new OutReturn();
|
|
|
- outReturn.setReturnId(inboundVO.getFromId());
|
|
|
- outReturn.setIntoQty(inboundResponse.getIntoQty());
|
|
|
- outReturn.setIntoAmt(inboundResponse.getIntoAmt());
|
|
|
- outReturn.setIntoingQty(inboundResponse.getIntoQty().negate());
|
|
|
- outReturn.setIntoingAmt(inboundResponse.getIntoAmt().negate());
|
|
|
+ //赋值 (这里重写了更新方法,数量在更新方法中有数据库院士数量+本次数量)
|
|
|
+ IntoReturn intoReturn = new IntoReturn();
|
|
|
+ intoReturn.setReturnId(inboundVO.getFromId());
|
|
|
+ intoReturn.setOutQty(inboundResponse.getIntoQty());
|
|
|
+ intoReturn.setOutAmt(inboundResponse.getIntoAmt());
|
|
|
+ intoReturn.setOutingQty(inboundResponse.getIntoQty().abs());
|
|
|
+ intoReturn.setOutingAmt(inboundResponse.getIntoAmt().abs());
|
|
|
//入库状态
|
|
|
- String intoStatus = this.setIntoStatus(outReturn.getIntoingQty(), outReturn.getIntoQty());
|
|
|
- outReturn.setIntoStatus(intoStatus);
|
|
|
+ String outStatus = this.setOutStatus(intoReturn.getOutingQty(), intoReturn.getOutQty());
|
|
|
+ intoReturn.setOutStatus(outStatus);
|
|
|
//修改
|
|
|
- int countRow = outReturnMapper.updateById(outReturn);
|
|
|
+ int countRow = intoReturnMapper.updateById(intoReturn);
|
|
|
//数量超出
|
|
|
if (countRow == 0) {
|
|
|
throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.INVENTORY_QUANTITY_EXCEEDED.getMessage());
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
//endregion
|
|
|
|
|
|
@@ -602,53 +466,24 @@ public class InboundSaleReturnService extends BaseService<Inbound> {
|
|
|
//根据总单id查明细
|
|
|
List<InboundItemResponse> orderEntryItemResponsesList = inboundItemMapper.selectByCond(new InboundItemQuery().setIntoId(inbound.getIntoId()));
|
|
|
for (InboundItemResponse inboundItemResponse : orderEntryItemResponsesList) {
|
|
|
- //region 修改销售退货明细数据信息
|
|
|
+ //region 修改采购退货明细数据信息
|
|
|
if (inboundItemResponse.getFromItemId() != null) {
|
|
|
- //region todo 可能无用的代码
|
|
|
- //查询
|
|
|
-// IntoReturnItemResponse intoReturnItemResponse = intoReturnItemMapper.selectById(inboundItemResponse.getFromItemId());
|
|
|
-// intoReturnItem.setOutQty(intoReturnItemResponse.getOutQty().subtract(inboundItemResponse.getIntoQty()));
|
|
|
-// intoReturnItem.setOutAmt(intoReturnItemResponse.getOutAmt().subtract(inboundItemResponse.getIntoAmt()));
|
|
|
-// intoReturnItem.setOutingQty(intoReturnItemResponse.getOutingQty().add(inboundItemResponse.getIntoQty()));
|
|
|
-// intoReturnItem.setOutingAmt(intoReturnItemResponse.getOutingAmt().add(inboundItemResponse.getIntoAmt()));
|
|
|
- //endregion
|
|
|
-
|
|
|
- //region todo 出库可能用到的代码 用完记得删除
|
|
|
-// IntoReturnItem intoReturnItem = new IntoReturnItem();
|
|
|
-// intoReturnItem.setItemId(inboundItemResponse.getFromItemId());
|
|
|
-// intoReturnItem.setOutQty(inboundItemResponse.getIntoQty().negate());
|
|
|
-// intoReturnItem.setOutAmt(inboundItemResponse.getIntoAmt().negate());
|
|
|
-// intoReturnItem.setOutingQty(inboundItemResponse.getIntoQty());
|
|
|
-// intoReturnItem.setOutingAmt(inboundItemResponse.getIntoAmt());
|
|
|
-// //入库状态
|
|
|
-// String outStatus = this.setOutStatus(intoReturnItem.getOutingQty(), intoReturnItem.getOutQty());
|
|
|
-// intoReturnItem.setOutStatus(outStatus);
|
|
|
-// //修改
|
|
|
-// int countRow = intoReturnItemMapper.updateById(intoReturnItem);
|
|
|
-// //数量超出
|
|
|
-// if (countRow == 0) {
|
|
|
-// throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.INVENTORY_QUANTITY_EXCEEDED.getMessage());
|
|
|
-// }
|
|
|
- //endregion
|
|
|
-
|
|
|
-
|
|
|
- OutReturnItem outReturnItem = new OutReturnItem();
|
|
|
- outReturnItem.setItemId(inboundItemResponse.getFromItemId());
|
|
|
- outReturnItem.setIntoQty(inboundItemResponse.getIntoQty().negate());
|
|
|
- outReturnItem.setIntoAmt(inboundItemResponse.getIntoAmt().negate());
|
|
|
- outReturnItem.setIntoingQty(inboundItemResponse.getIntoQty());
|
|
|
- outReturnItem.setIntoingAmt(inboundItemResponse.getIntoAmt());
|
|
|
+ //赋值 (这里重写了更新方法,数量在更新方法中有数据库院士数量+本次数量)
|
|
|
+ IntoReturnItem intoReturnItem = new IntoReturnItem();
|
|
|
+ intoReturnItem.setItemId(inboundItemResponse.getFromItemId());
|
|
|
+ intoReturnItem.setOutQty(inboundItemResponse.getIntoQty());
|
|
|
+ intoReturnItem.setOutAmt(inboundItemResponse.getIntoAmt());
|
|
|
+ intoReturnItem.setOutingQty(inboundItemResponse.getIntoQty().abs());
|
|
|
+ intoReturnItem.setOutingAmt(inboundItemResponse.getIntoAmt().abs());
|
|
|
//入库状态
|
|
|
- String intoStatus = this.setIntoStatus(outReturnItem.getIntoingQty(), outReturnItem.getIntoQty());
|
|
|
- outReturnItem.setIntoStatus(intoStatus);
|
|
|
+ String outStatus = this.setOutStatus(intoReturnItem.getOutingQty(), intoReturnItem.getOutQty());
|
|
|
+ intoReturnItem.setOutStatus(outStatus);
|
|
|
//修改
|
|
|
- int countRow = outReturnItemMapper.updateById(outReturnItem);
|
|
|
+ int countRow = intoReturnItemMapper.updateById(intoReturnItem);
|
|
|
//数量超出
|
|
|
if (countRow == 0) {
|
|
|
throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.INVENTORY_QUANTITY_EXCEEDED.getMessage());
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
//endregion
|
|
|
|