|
|
@ -19,6 +19,7 @@ using DSWeb.MvcShipping.DAL.MsBaseInfoDAL;
|
|
|
|
using DSWeb.Common.DB;
|
|
|
|
using DSWeb.Common.DB;
|
|
|
|
using System.Linq;
|
|
|
|
using System.Linq;
|
|
|
|
using DSWeb.SysMng.DAL.SysRoleTaskQuery;
|
|
|
|
using DSWeb.SysMng.DAL.SysRoleTaskQuery;
|
|
|
|
|
|
|
|
using System.Data.Entity.Migrations;
|
|
|
|
|
|
|
|
|
|
|
|
namespace DSWeb.Areas.Account.DAL.Chfee_Recvapplication
|
|
|
|
namespace DSWeb.Areas.Account.DAL.Chfee_Recvapplication
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -917,6 +918,58 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Recvapplication
|
|
|
|
return result;
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 2023-1-28
|
|
|
|
|
|
|
|
///如果此次选择的业务中,销售人员的所属公司分属不同,返回错误
|
|
|
|
|
|
|
|
///如果头表所属分部为空 将其设置为所选业务的销售人员所属的公司 并保存;
|
|
|
|
|
|
|
|
///如果头表所属分部不为空 判断所属分部与所选业务的销售人员所属的公司是否相同 如否则返回错误;
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <param name="billno"></param>
|
|
|
|
|
|
|
|
/// <param name="feesql"></param>
|
|
|
|
|
|
|
|
/// <param name="billcurr"></param>
|
|
|
|
|
|
|
|
/// <param name="companyid"></param>
|
|
|
|
|
|
|
|
/// <param name="userid"></param>
|
|
|
|
|
|
|
|
/// <param name="custgroup"></param>
|
|
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
|
|
public static DBResult SetSALECORP(string billno, string feesql, string billcurr, string companyid, string userid, bool custgroup = false)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var result = new DBResult();
|
|
|
|
|
|
|
|
if (!custgroup)
|
|
|
|
|
|
|
|
feesql = feesql + " AND CUSTOMERNAME='" + billcurr + "'";
|
|
|
|
|
|
|
|
var feelist = GetFeeDetailList(feesql, userid, "", companyid);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var bsnoList = feelist.Select(s => s.BSNO).Distinct().ToList();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var cdc = new CommonDataContext();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var SaleCorpList=cdc.v_op_bill.Where(x=>bsnoList.Contains(x.BSNO)).Select(s=>s.SALECORPID).Distinct().ToList();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (SaleCorpList == null || SaleCorpList.Count != 1) {
|
|
|
|
|
|
|
|
result.SetErrorInfo("所选业务的销售公司应当相同!");
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var head = cdc.ch_fee_recvapplication.FirstOrDefault(x => x.BILLNO == billno);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (head == null|| string.IsNullOrWhiteSpace(head.BILLNO)) {
|
|
|
|
|
|
|
|
result.SetErrorInfo("请先保存业务!");
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrWhiteSpace(head.SALECORPID))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
head.SALECORPID = SaleCorpList[0];
|
|
|
|
|
|
|
|
cdc.ch_fee_recvapplication.AddOrUpdate(head);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
if (head.SALECORPID != SaleCorpList[0]) {
|
|
|
|
|
|
|
|
result.SetErrorInfo("所选业务的所属分部应当与申请单当前的所属分部相同!");
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static DBResult AddBill(string billno, string billcust, string billcurr, string feesql, List<ChFeeExrate> exratelist, string companyid,string userid, bool custgroup = false)
|
|
|
|
public static DBResult AddBill(string billno, string billcust, string billcurr, string feesql, List<ChFeeExrate> exratelist, string companyid,string userid, bool custgroup = false)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -935,6 +988,9 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Recvapplication
|
|
|
|
feesql = feesql + " AND CUSTOMERNAME='" + billcust + "'";
|
|
|
|
feesql = feesql + " AND CUSTOMERNAME='" + billcust + "'";
|
|
|
|
var feelist = GetFeeDetailList(feesql,userid,"",companyid);
|
|
|
|
var feelist = GetFeeDetailList(feesql,userid,"",companyid);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//2023-1-28 如果头表所属分部为空 将其设置为所选业务的销售人员所属的公司
|
|
|
|
|
|
|
|
//如果此次选择的业务中,销售人员的所属公司分属不同
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var cmdInsert =
|
|
|
|
var cmdInsert =
|
|
|
|
db.GetSqlStringCommand(
|
|
|
|
db.GetSqlStringCommand(
|
|
|
|