|
|
@ -11,11 +11,15 @@ import com.ruoyi.common.utils.ShiroUtils; |
|
|
|
import com.ruoyi.common.utils.StringUtils; |
|
|
|
import com.ruoyi.erp.domain.ErpMaterial; |
|
|
|
import com.ruoyi.erp.domain.ErpMaterialVo; |
|
|
|
import com.ruoyi.erp.domain.vo.ErpMaterialSalesHistoryVo; |
|
|
|
import com.ruoyi.erp.mapper.ErpMaterialMapper; |
|
|
|
import com.ruoyi.erp.service.IErpMaterialService; |
|
|
|
import com.ruoyi.process.general.service.IProcessService; |
|
|
|
import com.ruoyi.process.todoitem.mapper.BizTodoItemMapper; |
|
|
|
import com.ruoyi.system.domain.SysAttach; |
|
|
|
import com.ruoyi.system.domain.*; |
|
|
|
import com.ruoyi.system.domain.Vo.ExportCustomerQuoteChildVo; |
|
|
|
import com.ruoyi.system.mapper.SysSalesOrderChildMapper; |
|
|
|
import com.ruoyi.system.mapper.SysSalesOrderMapper; |
|
|
|
import com.ruoyi.system.mapper.SysUserMapper; |
|
|
|
import com.ruoyi.system.service.ISysAttachFileService; |
|
|
|
import com.ruoyi.system.service.ISysAttachService; |
|
|
@ -34,6 +38,7 @@ import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
import org.springframework.util.CollectionUtils; |
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.util.*; |
|
|
|
|
|
|
|
/** |
|
|
@ -75,6 +80,14 @@ public class ErpMaterialServiceImpl implements IErpMaterialService |
|
|
|
private ISysRoleService roleService; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
private SysSalesOrderChildMapper sysSalesOrderChildMapper; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private SysSalesOrderMapper sysSalesOrderMapper; |
|
|
|
|
|
|
|
private final static String RMB = "1"; //RMB
|
|
|
|
|
|
|
|
/** |
|
|
|
* 查询物料信息 |
|
|
|
* |
|
|
@ -507,4 +520,58 @@ public class ErpMaterialServiceImpl implements IErpMaterialService |
|
|
|
public List<ErpMaterialVo> selectAllErpMaterialListByMaterialVo(ErpMaterialVo erpMaterialVo) { |
|
|
|
return erpMaterialMapper.selectAllErpMaterialListByMaterialVo(erpMaterialVo); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 查询物料销售价历史 |
|
|
|
* */ |
|
|
|
@Override |
|
|
|
public List<ErpMaterialSalesHistoryVo> selectErpMaterialSalesHistoryList(String materialNo) { |
|
|
|
|
|
|
|
List<ErpMaterialSalesHistoryVo> erpMaterialSalesHistoryVos = new ArrayList<>(); |
|
|
|
|
|
|
|
List<SysSalesOrderChild> salesOrderChildList = sysSalesOrderChildMapper.selectOrderChildListByMaterialNo(materialNo); |
|
|
|
|
|
|
|
for (SysSalesOrderChild sysSalesOrderChild : salesOrderChildList) { |
|
|
|
ErpMaterialSalesHistoryVo erpMaterialSalesHistoryVo = new ErpMaterialSalesHistoryVo(); |
|
|
|
String quoteId = sysSalesOrderChild.getQuoteId(); |
|
|
|
SysSalesOrderVo sysSalesOrderVo = sysSalesOrderMapper.selectSysSalesOrderBySalesOrderCode(quoteId); |
|
|
|
setMaterialPrice(erpMaterialSalesHistoryVo, sysSalesOrderVo, sysSalesOrderChild); |
|
|
|
erpMaterialSalesHistoryVo.setMaterialNum(sysSalesOrderChild.getMaterialNum()); |
|
|
|
erpMaterialSalesHistoryVo.setCommonCurrency(sysSalesOrderVo.getCommonCurrency()); |
|
|
|
erpMaterialSalesHistoryVo.setSalesTime(sysSalesOrderChild.getCreateTime()); |
|
|
|
erpMaterialSalesHistoryVo.setSalesUser(sysSalesOrderChild.getBusinessMembers()); |
|
|
|
erpMaterialSalesHistoryVo.setSalesOrderCode(sysSalesOrderChild.getQuoteId()); |
|
|
|
erpMaterialSalesHistoryVos.add(erpMaterialSalesHistoryVo); |
|
|
|
} |
|
|
|
return erpMaterialSalesHistoryVos; |
|
|
|
} |
|
|
|
|
|
|
|
//区分不同币种的金额
|
|
|
|
private void setMaterialPrice(ErpMaterialSalesHistoryVo vo, SysSalesOrderVo sysSalesOrderVo, SysSalesOrderChild child) { |
|
|
|
if (RMB.equals(sysSalesOrderVo.getCommonCurrency())) { |
|
|
|
// RMB
|
|
|
|
Double materialRmb = child.getMaterialRmb(); |
|
|
|
Double materialNoRmb = child.getMaterialNoRmb(); |
|
|
|
Double materialNoRmbSum = child.getMaterialNoRmbSum(); |
|
|
|
Double materialRmbSum = child.getMaterialRmbSum(); |
|
|
|
vo.setNoTaxPrice(materialNoRmb); |
|
|
|
vo.setTaxPrice(materialRmb); |
|
|
|
vo.setNoTaxSum(materialNoRmbSum); |
|
|
|
vo.setTaxSum(materialRmbSum); |
|
|
|
} else { |
|
|
|
//美元
|
|
|
|
Double materialUsd = child.getMaterialUsd(); |
|
|
|
Double materialNoUsd = child.getMaterialNoUsd(); |
|
|
|
Double materialNoUsdSum = child.getMaterialNoUsdSum(); |
|
|
|
Double materialUsdSum = child.getMaterialUsdSum(); |
|
|
|
vo.setNoTaxPrice(materialNoUsd); |
|
|
|
vo.setTaxPrice(materialUsd); |
|
|
|
vo.setNoTaxSum(materialNoUsdSum); |
|
|
|
vo.setTaxSum(materialUsdSum); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|