|
@@ -1,17 +1,24 @@
|
|
|
package com.zkqy.business.service.impl;
|
|
|
|
|
|
+import java.text.DecimalFormat;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
|
|
|
+import com.zkqy.business.domain.ProductHandsetOutboundRecord;
|
|
|
+import com.zkqy.business.domain.ProductInventory;
|
|
|
import com.zkqy.business.domain.ProductInvoice;
|
|
|
import com.zkqy.business.domain.vo.ProductCodeListVO;
|
|
|
+import com.zkqy.business.mapper.ProductHandsetOutboundRecordMapper;
|
|
|
+import com.zkqy.business.mapper.ProductInventoryMapper;
|
|
|
import com.zkqy.business.mapper.ProductInvoiceMapper;
|
|
|
import com.zkqy.common.utils.DateUtils;
|
|
|
+import com.zkqy.common.utils.SecurityUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import com.zkqy.business.mapper.ProductOutboundRecordMapper;
|
|
|
import com.zkqy.business.domain.ProductOutboundRecord;
|
|
|
import com.zkqy.business.service.IProductOutboundRecordService;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
/**
|
|
|
* 成品出库记录Service业务层处理
|
|
@@ -27,6 +34,12 @@ public class ProductOutboundRecordServiceImpl implements IProductOutboundRecordS
|
|
|
@Autowired
|
|
|
private ProductInvoiceMapper productInvoiceMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ProductInventoryMapper productInventoryMapper;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ProductHandsetOutboundRecordMapper productHandsetOutboundRecordMapper;
|
|
|
+
|
|
|
/**
|
|
|
* 查询成品出库记录
|
|
|
*
|
|
@@ -105,6 +118,53 @@ public class ProductOutboundRecordServiceImpl implements IProductOutboundRecordS
|
|
|
return productOutboundRecordMapper.deleteProductOutboundRecordByUUID(qrCodeId);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * //码单号-货品编号-批号-等级--产品色则
|
|
|
+ * //筒数-箱数-净重-毛重-筒重-箱子重-管色
|
|
|
+ * @param id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ @Transactional
|
|
|
+ public int removeErrorOutboundRecord(Long id) {
|
|
|
+ //查询出库日志信息记录表
|
|
|
+ ProductOutboundRecord productOutboundRecord = productOutboundRecordMapper.selectProductOutboundRecordById(id);
|
|
|
+ //计算合计箱数、筒数、净重、毛重
|
|
|
+ ProductInventory productInventory = productInventoryMapper.selectProductInventoryByQrCode(productOutboundRecord.getQrCode());
|
|
|
+ ProductInventory editProductInventory = new ProductInventory();
|
|
|
+ editProductInventory.setId(productInventory.getId());
|
|
|
+ //合计筒数:if 总的通俗等于null 那么就是当前筒数,如果不是空就累加
|
|
|
+ editProductInventory.setTotalCanisterNum(productInventory.getTotalCanisterNum() == null ? productOutboundRecord.getCanisterNum() : productInventory.getTotalCanisterNum() + productOutboundRecord.getCanisterNum());//合计筒数数
|
|
|
+ //合计箱数: 原箱数加出库日志中的箱数
|
|
|
+ editProductInventory.setTotalBoxNum(productInventory.getTotalBoxNum() + productOutboundRecord.getBoxNum());
|
|
|
+ //合计净重
|
|
|
+ Double suttle = productInventory.getTotalSuttle() == null ? productOutboundRecord.getSuttle() : productInventory.getTotalSuttle() + productOutboundRecord.getSuttle();
|
|
|
+ DecimalFormat df = new DecimalFormat("0.00");
|
|
|
+ String suttle1 = df.format(suttle);
|
|
|
+ editProductInventory.setTotalSuttle(Double.parseDouble(suttle1));
|
|
|
+ //合计毛重
|
|
|
+ Double grossWeight = productInventory.getTotalGrossWeight() == null ? productOutboundRecord.getGrossWeight() : productInventory.getTotalGrossWeight() + productOutboundRecord.getGrossWeight();
|
|
|
+ String grossWeight1 = df.format(grossWeight);
|
|
|
+ editProductInventory.setTotalGrossWeight(Double.parseDouble(grossWeight1));
|
|
|
+ //更新库存信息
|
|
|
+ editProductInventory.setUpdateById(SecurityUtils.getUserId());
|
|
|
+ editProductInventory.setUpdateBy(SecurityUtils.getUsername());
|
|
|
+ editProductInventory.setUpdateTime(DateUtils.getNowDate());
|
|
|
+ productInventoryMapper.updateProductInventory(editProductInventory);
|
|
|
+
|
|
|
+ //手持机日志记录-逻辑删
|
|
|
+ ProductHandsetOutboundRecord productHandsetOutboundRecord=new ProductHandsetOutboundRecord();
|
|
|
+ productHandsetOutboundRecord.setQrCode(productOutboundRecord.getQrCode());
|
|
|
+ productHandsetOutboundRecord.setDelFlag("2");
|
|
|
+ productHandsetOutboundRecordMapper.updateProductHandsetOutboundRecord(productHandsetOutboundRecord);
|
|
|
+ //pc端日志记录-逻辑删
|
|
|
+ ProductOutboundRecord productOutboundRecordUpdate=new ProductOutboundRecord();
|
|
|
+ productOutboundRecordUpdate.setId(id);
|
|
|
+ productOutboundRecordUpdate.setDelFlag("2");
|
|
|
+ productOutboundRecordMapper.updateProductOutboundRecord(productOutboundRecordUpdate);
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public List<ProductCodeListVO> outboundDetails(String noticeNumber) {
|
|
|
return productOutboundRecordMapper.selectOutboundDetails(noticeNumber);
|