收费申请修改:默认所属分部为空;选择业务或费用向上添加时添加所选业务的销售公司进所属分部

临时发布20240103
ddlucky 2 years ago
parent d2511ea0a9
commit 45b3945507

@ -238,11 +238,28 @@ namespace DSWeb.Areas.Account.Controllers
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) }; return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
} }
public ContentResult AddBill(string billno, string billcust, string billcurr, string feesql, string storeCurrExrate, bool custgroup = false) public ContentResult AddBill(string billno, string billcust, string billcurr, string feesql, string storeCurrExrate, bool custgroup = false)
{ {
var exrateList = JsonConvert.Deserialize<List<ChFeeExrate>>(storeCurrExrate); var exrateList = JsonConvert.Deserialize<List<ChFeeExrate>>(storeCurrExrate);
if ((exrateList == null) || (exrateList.Count == 0)) if (!custgroup)
feesql = feesql + " AND CUSTOMERNAME='" + billcust + "'";
var feelist = ChrecvapplicationDAL.GetFeeDetailList(feesql, Convert.ToString(Session["USERID"]), "", Convert.ToString(Session["COMPANYID"]));
//2023-1-28
//如果此次选择的业务中,销售人员的所属公司分属不同,返回错误
//如果头表所属分部为空 将其设置为所选业务的销售人员所属的公司 并保存;
//如果头表所属分部不为空 判断所属分部与所选业务的销售人员所属的公司是否相同 如否则返回错误;
var _r = ChrecvapplicationDAL.SetSALECORP(billno, feesql, billcurr, Convert.ToString(Session["COMPANYID"]), Convert.ToString(Session["USERID"]), custgroup);
if (!_r.Success) {
return BasicDataRefDAL.GetContentResult(_r);
}
if ((exrateList == null) || (exrateList.Count == 0))
{ {
if (billcurr != "") if (billcurr != "")
exrateList = ChrecvapplicationDAL.GetCurrExrateData(billcust, billcurr, feesql, custgroup); exrateList = ChrecvapplicationDAL.GetCurrExrateData(billcust, billcurr, feesql, custgroup);

@ -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(

@ -2672,14 +2672,14 @@ Ext.extend(Shipping.MsChRecvapplicationBLEdit, Ext.Panel, {
} }
} }
var SALECORPID = this.formEdit.getForm().findField('SALECORPID').getValue(); //var SALECORPID = this.formEdit.getForm().findField('SALECORPID').getValue();
if ((SALECORPID == '') || (SALECORPID == null)) { //if ((SALECORPID == '') || (SALECORPID == null)) {
var recs = DsStoreQueryBy(this.storeSaleCompany, 'NAME', SALECORP); // var recs = DsStoreQueryBy(this.storeSaleCompany, 'NAME', SALECORP);
if (recs.getCount() > 0) { // if (recs.getCount() > 0) {
var data = recs.getAt(0).data; // var data = recs.getAt(0).data;
this.formEdit.getForm().findField('SALECORPID').setValue(data.GID) // this.formEdit.getForm().findField('SALECORPID').setValue(data.GID)
} // }
} //}
if (!basicForm.isValid()) { if (!basicForm.isValid()) {
btnEAddDetail.enable(); btnEAddDetail.enable();
@ -2960,14 +2960,14 @@ Ext.extend(Shipping.MsChRecvapplicationBLEdit, Ext.Panel, {
} }
} }
var SALECORPID = this.formEdit.getForm().findField('SALECORPID').getValue(); //var SALECORPID = this.formEdit.getForm().findField('SALECORPID').getValue();
if ((SALECORPID == '') || (SALECORPID == null)) { //if ((SALECORPID == '') || (SALECORPID == null)) {
var recs = DsStoreQueryBy(this.storeSaleCompany, 'NAME', SALECORP); // var recs = DsStoreQueryBy(this.storeSaleCompany, 'NAME', SALECORP);
if (recs.getCount() > 0) { // if (recs.getCount() > 0) {
var data = recs.getAt(0).data; // var data = recs.getAt(0).data;
this.formEdit.getForm().findField('SALECORPID').setValue(data.GID) // this.formEdit.getForm().findField('SALECORPID').setValue(data.GID)
} // }
} //}
if (!basicForm.isValid()) { if (!basicForm.isValid()) {
btnEAddbill.enable(); btnEAddbill.enable();

Loading…
Cancel
Save