代码拉取完成,页面将自动刷新
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.ComponentModel;
using Kingdee.BOS;
using Kingdee.BOS.Contracts;
using Kingdee.BOS.Util;
using Kingdee.BOS.Core;
using Kingdee.BOS.Core.List;
using Kingdee.BOS.Core.Metadata;
using Kingdee.BOS.Core.Metadata.ControlElement;
using Kingdee.BOS.Core.Metadata.FieldElement;
using Kingdee.BOS.Core.Metadata.EntityElement;
using Kingdee.BOS.Core.DynamicForm;
using Kingdee.BOS.Core.DynamicForm.PlugIn;
using Kingdee.BOS.Core.DynamicForm.PlugIn.Args;
using Kingdee.BOS.Core.DynamicForm.PlugIn.ControlModel;
using Kingdee.BOS.ServiceHelper;
using Kingdee.BOS.Business.Bill;
using Kingdee.BOS.Core.Bill.PlugIn;
using Kingdee.BOS.Core.DynamicForm.PlugIn.Args;
using Kingdee.BOS.Core.Bill;
using Kingdee.BOS.Orm.DataEntity;
using Kingdee.BOS.Core.Bill.PlugIn.Args;
using Kingdee.BOS.Core.Metadata.FormElement;
using Kingdee.BOS.Orm;
using Kingdee.BOS.Core.Interaction;
using Kingdee.BOS.App;
using Kingdee.BOS.App.Core;
/// <summary>
/// 多斯达
/// 宇祥 2019.04.12
/// </summary>
namespace DomuStar.Plugins
{
[Description("模拟报价单")]
public class SAL_SIMULATEQUOTEEdit : AbstractBillPlugIn
{
public override void BarItemClick(BarItemClickEventArgs e)
{
base.BarItemClick(e);
if (e.BarItemKey.EqualsIgnoreCase("tbCalPrice"))//计算单价
{
//////分录
//string sFid = "";
//sFid = this.View.Model.DataObject["Id"].ToString();
//double dPriceSum = 0;//单价汇总,用来放到表头父物单价
////按公式取价格
//string ls_sql = "/*dialect*/ SET NOCOUNT ON EXEC SP_KDZS_CALPRICE " + sFid + ",0,0,0";
//System.Data.IDataReader data3 = Kingdee.BOS.App.Data.DBUtils.ExecuteReader(this.Context, ls_sql);
//int i = 0;
//while (data3.Read())
//{
// View.Model.SetValue("FCMatPrice", Convert.ToDouble(data3["FPRICE"].ToString()), i);//材料单价
// ((IDynamicFormView)View).InvokeFieldUpdateService("FCMatPrice", i);
// i++;
//}
////分录
for (int i = 0; i < this.View.Model.GetEntryRowCount("FDetailEntity"); i++)
{
getPrice(i);
}
//设置表头父项编码
if (this.View.Model.GetEntryRowCount("FEntity") > 0)
{
if (View.Model.GetValue("FBomId", 0) != null)
{
string FBomId = (this.View.Model.GetValue("FBomId", 0) as DynamicObject)["id"].ToString();//
if (!FBomId.Equals(""))
{
string ls_sql = "/*dialect*/ SELECT T2.FNUMBER FROM T_ENG_BOM T1 JOIN T_BD_MATERIAL T2 ON T1.FMATERIALID=T2.FMATERIALID WHERE T1.FID= " + FBomId;
using (System.Data.IDataReader data3 = Kingdee.BOS.App.Data.DBUtils.ExecuteReader(this.Context, ls_sql))
{
while (data3.Read())
{
View.Model.SetValue("F_PAEZ_Text", data3["FNUMBER"].ToString(), 0);//
}
}
}
}
}
}
}
private void getPrice(int row)
{
//double dResult = 0, dQtyS = 0, dQtyE = 0, FTaxRate = 0, F_zskd_LVPrice = 0, FSupplierID = 0;
string sItemId = "", sCustId = "", FMaterialErpClsID = "";
if (View.Model.GetValue("FCMatlId", row) != null)
{
sItemId = (this.View.Model.GetValue("FCMatlId", row) as DynamicObject)["id"].ToString();//产品编码
FMaterialErpClsID = ((this.View.Model.GetValue("FCMatlId", row) as DynamicObject)["MaterialBase"] as DynamicObjectCollection)[0]["ErpClsID"].ToString();//
}
if (View.Model.GetValue("FCustomerID", 0) != null)
sCustId = (this.View.Model.GetValue("FCustomerID", 0) as DynamicObject)["id"].ToString();//客户编码
if (!sItemId.Equals("") && !sCustId.Equals(""))
{
int iCount = 0;
//按公式取价格
string ls_sql = "/*dialect*/ SET NOCOUNT ON EXEC SP_KDZS_SAL_SIMULATEQUOTE_GetPrice " + sItemId + "," + sCustId;
using (System.Data.IDataReader data3 = Kingdee.BOS.App.Data.DBUtils.ExecuteReader(this.Context, ls_sql))
{
//this.View.ShowErrMessage(ls_sql);
while (data3.Read())
{
iCount++;
if (FMaterialErpClsID.Equals("3"))//委外
{
View.Model.SetItemValueByNumber("FCSubPriceFrom", "CLDJLY13_SYS", row);
View.Model.SetValue("FCSubPrice", Convert.ToDouble(data3["FPRICE"].ToString()), row);//委外加工单价
View.Model.SetValue("F_kdzs_CSubPriceTAX", Convert.ToDouble(data3["TAXmtrlPrice"].ToString()), row);//含税委外加工单价
}
else
{
View.Model.SetItemValueByNumber("FCMatPriceFrom", "CLDJLY02_SYS", row); //材料单价来源
View.Model.SetValue("FCMatPrice", Convert.ToDouble(data3["FPRICE"].ToString()), row);//材料单价
View.Model.SetValue("F_zs_TAXmtrlPrice", Convert.ToDouble(data3["TAXmtrlPrice"].ToString()), row);//含税材料单价
View.Model.SetItemValueByID("F_PAEZ_SUPPLIERID", data3["FSUPPLIERID"].ToString(), row);//供应商
}
}
if (iCount == 0)//如果取不到值就清空
{
if (FMaterialErpClsID.Equals("3"))//委外
{
View.Model.SetItemValueByNumber("FCSubPriceFrom", "", row);
View.Model.SetValue("FCSubPrice", 0, row);//委外加工单价
View.Model.SetValue("F_kdzs_CSubPriceTAX", 0, row);//含税委外加工单价
((IDynamicFormView)View).InvokeFieldUpdateService("FCSubPrice", row);
((IDynamicFormView)View).InvokeFieldUpdateService("FCSubPriceFrom", row);
}
//else
//{
// View.Model.SetItemValueByNumber("FCMatPriceFrom", "", row); //材料单价来源
// View.Model.SetValue("FCMatPrice", 0, row);//材料单价
// View.Model.SetValue("F_zs_TAXmtrlPrice", 0, row);//含税材料单价
// View.Model.SetItemValueByID("F_PAEZ_SUPPLIERID", 0, row);//供应商
// ((IDynamicFormView)View).InvokeFieldUpdateService("FCMatPrice", row);
//}
}
}
}
((IDynamicFormView)View).InvokeFieldUpdateService("FCSubPrice", row);
((IDynamicFormView)View).InvokeFieldUpdateService("FCMatPrice", row);
}
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。