///<summary> ///修改含税单价 ///</summary> private DynamicObjectCollection GetSplitSourceData(BusinessInfo billInfo, DynamicObjectCollection sourceData) { // DynamicObjectCollection newSourceData = new DynamicObjectCollection(sourceData.DynamicCollectionItemPropertyType); foreach (var oneSourceData in sourceData) { string FentrtyID = oneSourceData["FEntityDetail_FEntryID"].ToString(); string sql = string.Format(@"select a.FTAXPRICE from T_AR_RECEIVABLEENTRY_LK b inner join T_AR_RECEIVABLEENTRY a on a.FENTRYID=b.FENTRYID where b.FSID='{0}'", FentrtyID); //含税单价 decimal FARFTAXPRICE = DBServiceHelper.ExecuteScalar <decimal>(this.Context, sql, 0, null); if (Math.Abs(FARFTAXPRICE) > 0) { oneSourceData["FTaxPrice"] = FARFTAXPRICE; } //判断是否第一次下推 sql = string.Format(@"select count(*) as zongshu from T_AR_RECEIVABLEENTRY_LK where FSID='{0}'", FentrtyID); decimal zongshu = DBServiceHelper.ExecuteScalar <decimal>(this.Context, sql, 0, null); if (zongshu > 0) { oneSourceData["FIsLockPrice"] = 1; //锁定所有财务应收单价 string upsql = string.Format(@"/*dialect*/ update T_AR_RECEIVABLEENTRY set FIsLockPrice=1 from T_AR_RECEIVABLEENTRY a inner join T_AR_RECEIVABLEENTRY_LK b on a.FENTRYID=b.FENTRYID where FSID='{0}'", FentrtyID); //更新锁库字段 DBServiceHelper.Execute(Context, upsql); } else { oneSourceData["FIsLockPrice"] = 0; } } return(sourceData); }
public override void EndOperationTransaction(EndOperationTransactionArgs e) { try { if (e.DataEntitys != null && e.DataEntitys.Count <DynamicObject>() > 0) { foreach (DynamicObject item in e.DataEntitys) { string FID = item["Id"].ToString(); string FSetAccountType = item["FSetAccountType"].ToString(); if (FSetAccountType == "2" || FSetAccountType == "1")//暂估 { string upsql = ""; string F_YBG_Assistant = item["F_YBG_Assistant_Id"].ToString(); string sql = string.Format(@"select FNUMBER From T_BAS_ASSISTANTDATAENTRY where FENTRYID='{0}'", F_YBG_Assistant); //编码 string FNUMBER = DBServiceHelper.ExecuteScalar <string>(this.Context, sql, "0", null); if (!FNUMBER.Contains("SN")) { //更新暂估应收 upsql = string.Format(@"/*dialect*/ update t_AR_receivableEntry set FIsLockPrice=1 where FID ='{0}'", FID); } else { //更新暂估应收 upsql = string.Format(@"/*dialect*/ update t_AR_receivableEntry set FIsLockPrice=0 where FID ='{0}'", FID); } //更新锁库字段 DBServiceHelper.Execute(Context, upsql); } //else //{ // string upsql = ""; // string sql = string.Format(@"select arel.FSID from t_AR_receivable ar inner join t_AR_receivableEntry arE on ar.FID=arE.FID // inner join T_AR_RECEIVABLEENTRY_LK arel on arel.FENTRYID=are.FENTRYID where ar.FID='{0}'", FID); // DataSet ds = DBServiceHelper.ExecuteDataSet(this.Context, sql); // DataTable dt = ds.Tables[0]; // if (dt.Rows.Count > 0) // { // for (int i = 0; i < dt.Rows.Count; i++) // { // string FSID = dt.Rows[i]["FSID"].ToString(); // //更新暂估应收 // upsql += string.Format(@"/*dialect*/ update t_AR_receivableEntry set FIsLockPrice=1 where FENTRYID ='{0}'", FSID); // } // } // //锁定价格 // DBServiceHelper.Execute(Context, upsql); //} } } } catch (Exception ex) { throw new KDException("", "保存失败:" + ex.ToString()); } }
///<summary> ///修改含税单价 ///</summary> private DynamicObjectCollection GetSplitSourceData(BusinessInfo billInfo, DynamicObjectCollection sourceData) { // DynamicObjectCollection newSourceData = new DynamicObjectCollection(sourceData.DynamicCollectionItemPropertyType); foreach (var oneSourceData in sourceData) { string FentrtyID = oneSourceData["FEntity_FEntryID"].ToString(); string sql = string.Format(@"select FARFTAXPRICE from T_SAL_OUTSTOCKENTRY where FENTRYID='{0}'", FentrtyID); //含税单价 decimal FARFTAXPRICE = DBServiceHelper.ExecuteScalar <decimal>(this.Context, sql, 0, null); if (FARFTAXPRICE > 0) { oneSourceData["FTaxPrice"] = FARFTAXPRICE; } } return(sourceData); }
public override void BeginOperationTransaction(BeginOperationTransactionArgs e) { try { string sql = string.Empty; if (e.DataEntitys != null && e.DataEntitys.Count <DynamicObject>() > 0) { foreach (DynamicObject item in e.DataEntitys) { string upsql = ""; string FID = item["Id"].ToString(); //供应商 string F_YBG_Supplier = item["SupplierId_Id"].ToString(); //仓库 string F_YBG_Warehouse = item["F_YBG_Warehouse_Id"].ToString(); //业务模式 string CRBusinessModel = item["F_YBG_BusinessModel"].ToString().Trim(); string F_YBG_BUSINESSMODEL = ""; //其他仓库默认01 if (string.IsNullOrEmpty(CRBusinessModel)) { if (F_YBG_Supplier == "0" || F_YBG_Warehouse == "0") { throw new Exception("提交失败:未填写仓库和供应商!"); } else { //仓库编码 sql = string.Format(@"select FNumber from t_BD_Stock where FSTOCKID='{0}'", F_YBG_Warehouse); string CKFNumber = DBServiceHelper.ExecuteScalar <string>(this.Context, sql, null, null); //供应商编码 ---自营VEN00057 VEN00099 VEN00256 sql = string.Format(@"select FNumber from t_BD_Supplier where FSUPPLIERID='{0}'", F_YBG_Supplier); string SPFNUMBER = DBServiceHelper.ExecuteScalar <string>(this.Context, sql, null, null); //珠海仓 if (CKFNumber.StartsWith("YBG001") || CKFNumber.StartsWith("YBG015") || CKFNumber.StartsWith("YBG017")) { F_YBG_BUSINESSMODEL = "07"; //珠海自营 07 upsql = string.Format(@"/*dialect*/ update t_PUR_POOrder set F_YBG_BUSINESSMODEL='{0}' where FID ={1}", F_YBG_BUSINESSMODEL, FID); } //自营 else { F_YBG_BUSINESSMODEL = "05"; //自营 05 upsql = string.Format(@"/*dialect*/ update t_PUR_POOrder set F_YBG_BUSINESSMODEL='{0}' where FID ={1}", F_YBG_BUSINESSMODEL, FID); } } //更新业务模式 DBServiceHelper.Execute(this.Context, upsql); } else { #region 注释 //if (F_YBG_Supplier == "0" || F_YBG_Warehouse == "0") //{ // throw new Exception("提交失败:未填写仓库和供应商!"); //} ////仓库编码 //sql = string.Format(@"select FNumber from t_BD_Stock where FSTOCKID='{0}'", F_YBG_Warehouse); //string CKFNumber = DBServiceHelper.ExecuteScalar<string>(this.Context, sql, null, null); ////供应商编码 ---自营VEN00057 VEN00099 VEN00256 //sql = string.Format(@"select FNumber from t_BD_Supplier where FSUPPLIERID='{0}'", F_YBG_Supplier); //string SPFNUMBER = DBServiceHelper.ExecuteScalar<string>(this.Context, sql, null, null); ////非嘉里开头的 //if (CKFNumber.StartsWith("ZF")) //挂靠01 //{ // F_YBG_BUSINESSMODEL = "01"; //} ////嘉里开头 //else if (CKFNumber.StartsWith("JLZF")) //04 挂靠自发 //{ // F_YBG_BUSINESSMODEL = "04"; //} ////嘉里物流主仓 嘉里苏宁移动仓 //else if (CKFNumber.StartsWith("JL002") || CKFNumber.StartsWith("JLSN001")) //{ // // 是壹办公供应商或者自营供应商 // if (SPFNUMBER.Contains("VEN00057") || SPFNUMBER.Contains("VEN00099")) //自营 05 // { // F_YBG_BUSINESSMODEL = "05"; // } // else //代采 06 // { // F_YBG_BUSINESSMODEL = "06"; // } //} ////珠海仓 //else if (CKFNumber.StartsWith("YBG001") || CKFNumber.StartsWith("YBG015") || CKFNumber.StartsWith("YBG017")) //{ // F_YBG_BUSINESSMODEL = "07"; //珠海自营 07 //} //// 观澜仓 车公庙仓 //else if (CKFNumber.StartsWith("YBG002") || CKFNumber.StartsWith("YBG003")) //{ // //壹办公供应商或者自营供应商 // if (SPFNUMBER.Contains("VEN00057") || SPFNUMBER.Contains("VEN00099")) //自营直发02 // { // F_YBG_BUSINESSMODEL = "02"; // } // else //代采直发 03 // { // F_YBG_BUSINESSMODEL = "03"; // } //} //else //其他仓库默认01 //{ // //壹办公供应商或者自营供应商 // if (SPFNUMBER.Contains("VEN00057") || SPFNUMBER.Contains("VEN00099")) //自营 05 // { // F_YBG_BUSINESSMODEL = "05"; //自营 // } // else // { // F_YBG_BUSINESSMODEL = "01"; // } //} //if (F_YBG_BUSINESSMODEL != CRBusinessModel) //{ // throw new Exception("采购订单业务模式改变了,不能提交!"); //} #endregion } } } } catch (Exception ex) { throw new Exception("提交失败:" + ex.ToString()); } }
public void Run(Kingdee.BOS.Context ctx, Schedule schedule) { try { string sql = string.Empty; #region sql = string.Format(@"select FID, F_YBG_WAREHOUSE ,F_YBG_SUPPLIER from T_SAL_ORDER where FDOCUMENTSTATUS='C' or FDOCUMENTSTATUS='B' "); DataSet ds = DBServiceHelper.ExecuteDataSet(ctx, sql); DataTable dt = ds.Tables[0]; if (dt.Rows.Count > 0) { string upsql = ""; for (int i = 0; i < dt.Rows.Count; i++) { string FID = dt.Rows[i]["FID"].ToString(); //供应商 string F_YBG_Supplier = dt.Rows[i]["F_YBG_SUPPLIER"].ToString(); //仓库 string F_YBG_Warehouse = dt.Rows[i]["F_YBG_WAREHOUSE"].ToString(); string F_YBG_BUSINESSMODEL = ""; //其他仓库默认01 //仓库编码 sql = string.Format(@"select FNumber from t_BD_Stock where FSTOCKID='{0}'", F_YBG_Warehouse); string CKFNumber = DBServiceHelper.ExecuteScalar <string>(ctx, sql, "0", null); //供应商编码 ---自营VEN00057 VEN00099 VEN00256 sql = string.Format(@"select FNumber from t_BD_Supplier where FSUPPLIERID='{0}'", F_YBG_Supplier); string SPFNUMBER = DBServiceHelper.ExecuteScalar <string>(ctx, sql, "0", null); if (CKFNumber == "0" || SPFNUMBER == "0") { } else { //非嘉里开头的 if (CKFNumber.StartsWith("ZF")) //挂靠01 { F_YBG_BUSINESSMODEL = "01"; upsql += string.Format(@"/*dialect*/ update T_SAL_ORDER set F_YBG_BUSINESSMODEL='{0}' where FID ={1}", F_YBG_BUSINESSMODEL, FID); } //嘉里开头 else if (CKFNumber.StartsWith("JLZF")) //04 挂靠自发 { F_YBG_BUSINESSMODEL = "04"; upsql += string.Format(@"/*dialect*/ update T_SAL_ORDER set F_YBG_BUSINESSMODEL='{0}' where FID ={1}", F_YBG_BUSINESSMODEL, FID); } //嘉里物流主仓 嘉里苏宁移动仓 else if (CKFNumber.StartsWith("JL002") || CKFNumber.StartsWith("JLSN001")) { // 是壹办公供应商或者自营供应商 if (SPFNUMBER.Contains("VEN00057") || SPFNUMBER.Contains("VEN00099") || SPFNUMBER.Contains("P451")) //自营 05 { F_YBG_BUSINESSMODEL = "05"; upsql += string.Format(@"/*dialect*/ update T_SAL_ORDER set F_YBG_BUSINESSMODEL='{0}' where FID ={1}", F_YBG_BUSINESSMODEL, FID); } else //代采 06 { F_YBG_BUSINESSMODEL = "06"; upsql += string.Format(@"/*dialect*/ update T_SAL_ORDER set F_YBG_BUSINESSMODEL='{0}' where FID ={1}", F_YBG_BUSINESSMODEL, FID); } } //珠海仓 else if (CKFNumber.StartsWith("YBG001") || CKFNumber.StartsWith("YBG015") || CKFNumber.StartsWith("YBG017")) { F_YBG_BUSINESSMODEL = "07"; //珠海自营 07 upsql += string.Format(@"/*dialect*/ update T_SAL_ORDER set F_YBG_BUSINESSMODEL='{0}' where FID ={1}", F_YBG_BUSINESSMODEL, FID); } // 观澜仓 车公庙仓 else if (CKFNumber.StartsWith("YBG002") || CKFNumber.StartsWith("YBG003")) { //壹办公供应商或者自营供应商 if (SPFNUMBER.Contains("VEN00057") || SPFNUMBER.Contains("VEN00099") || SPFNUMBER.Contains("P451")) //自营直发 05 { F_YBG_BUSINESSMODEL = "02"; upsql += string.Format(@"/*dialect*/ update T_SAL_ORDER set F_YBG_BUSINESSMODEL='{0}' where FID ={1}", F_YBG_BUSINESSMODEL, FID); } else //代采直发 03 { F_YBG_BUSINESSMODEL = "03"; upsql += string.Format(@"/*dialect*/ update T_SAL_ORDER set F_YBG_BUSINESSMODEL='{0}' where FID ={1}", F_YBG_BUSINESSMODEL, FID); } } else //其他仓库默认01 { //壹办公供应商或者自营供应商 if (SPFNUMBER.Contains("VEN00057") || SPFNUMBER.Contains("VEN00099") || SPFNUMBER.Contains("P451")) //自营 05 { F_YBG_BUSINESSMODEL = "05"; upsql += string.Format(@"/*dialect*/ update T_SAL_ORDER set F_YBG_BUSINESSMODEL='{0}' where FID ={1}", F_YBG_BUSINESSMODEL, FID); } else { F_YBG_BUSINESSMODEL = "01"; upsql += string.Format(@"/*dialect*/ update T_SAL_ORDER set F_YBG_BUSINESSMODEL='{0}' where FID ={1}", F_YBG_BUSINESSMODEL, FID); } } } } //更新业务模式 DBServiceHelper.Execute(ctx, upsql); } #endregion } catch (Exception ex) { throw new Exception("更新报错:" + ex.ToString()); } }
public override void BeginOperationTransaction(BeginOperationTransactionArgs e) { try { string sql = string.Empty; if (e.DataEntitys != null && e.DataEntitys.Count <DynamicObject>() > 0) { foreach (DynamicObject item in e.DataEntitys) { string upsql = ""; //string FID = item["Id"].ToString(); //供应商 string F_YBG_Supplier = item["SupplierId_Id"].ToString(); //仓库 string F_YBG_Warehouse = item["F_YBG_Warehouse_Id"].ToString(); //业务模式 string CRBusinessModel = item["F_YBG_BusinessModel"].ToString().Trim(); string F_YBG_BUSINESSMODEL = ""; //其他仓库默认01 if (!string.IsNullOrEmpty(CRBusinessModel)) { //销售订单号 string BillNo = item["BillNo"].ToString(); string[] sArray = BillNo.Split('_'); //如果已经下推采购订单订单变更的时候业务模式不能改变 sql = string.Format(@"select top 1 so.FBILLNO from t_PUR_POOrder a inner join t_PUR_POOrderEntry_R b on a.fid=b.fid inner join T_SAL_ORDER so on so.FBILLNO=b.FSRCBILLNO where a.FBILLNO='{0}'" , sArray[0]); string soFBILLNO = DBServiceHelper.ExecuteScalar <string>(this.Context, sql, null, null); if (!string.IsNullOrEmpty(soFBILLNO)) { //仓库编码 sql = string.Format(@"select FNumber from t_BD_Stock where FSTOCKID='{0}'", F_YBG_Warehouse); string CKFNumber = DBServiceHelper.ExecuteScalar <string>(this.Context, sql, null, null); //供应商编码 ---自营VEN00057 VEN00099 VEN00256 sql = string.Format(@"select FNumber from t_BD_Supplier where FSUPPLIERID='{0}'", F_YBG_Supplier); string SPFNUMBER = DBServiceHelper.ExecuteScalar <string>(this.Context, sql, null, null); //非嘉里开头的 if (CKFNumber.StartsWith("ZF")) //挂靠01 { F_YBG_BUSINESSMODEL = "01"; } //嘉里开头 else if (CKFNumber.StartsWith("JLZF")) //04 挂靠自发 { F_YBG_BUSINESSMODEL = "04"; } //嘉里物流主仓 嘉里苏宁移动仓 else if (CKFNumber.StartsWith("JL002") || CKFNumber.StartsWith("JLSN001")) { // 是壹办公供应商或者自营供应商 if (SPFNUMBER.Contains("VEN00057") || SPFNUMBER.Contains("VEN00099")) //自营 05 { F_YBG_BUSINESSMODEL = "05"; } else //代采 06 { F_YBG_BUSINESSMODEL = "06"; } } //珠海仓 else if (CKFNumber.StartsWith("YBG001") || CKFNumber.StartsWith("YBG015") || CKFNumber.StartsWith("YBG017")) { F_YBG_BUSINESSMODEL = "07"; //珠海自营 07 } // 观澜仓 车公庙仓 else if (CKFNumber.StartsWith("YBG002") || CKFNumber.StartsWith("YBG003")) { //壹办公供应商或者自营供应商 if (SPFNUMBER.Contains("VEN00057") || SPFNUMBER.Contains("VEN00099")) //自营直发02 { F_YBG_BUSINESSMODEL = "02"; } else //代采直发 03 { F_YBG_BUSINESSMODEL = "03"; } } else //其他仓库默认01 { //壹办公供应商或者自营供应商 if (SPFNUMBER.Contains("VEN00057") || SPFNUMBER.Contains("VEN00099")) //自营 05 { F_YBG_BUSINESSMODEL = "05"; //自营 } else { F_YBG_BUSINESSMODEL = "01"; } } if (F_YBG_BUSINESSMODEL != CRBusinessModel) { throw new Exception("采购变更单业务模式改变了,不能保存!"); } } } } } } catch (Exception ex) { throw new Exception("保存失败:" + ex.ToString()); } }