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Q_{eN&rcm}>b-JW9IpK_uM`dk0z!T~
zCF|GM8~6owLT>nsku2=h^Ft?7nm8Cu%p#58)kPw|IEb&7D7r!kM-&NkqePMN0VwwJ
zld)J&R}Vg~-z3q--t?!Y)5)H6=P@na)!DnPySHSw2)Ts;5KXnHw|pDvtw>w)v&wRrydw;ntzy1anNk@fHF?(XctFB8_a?Tyu6
zi9a9sFF$8{YTPmDjG`_)MG59<3L82hhFJKl^aENSA?Q=h@XcxnVE
z>cosTb#UBn^1@RqxN1tDzH3UAjpCD?bzR*AHcQpAk)N<9f9oN_FX;H^o6?-$eW1VM$obtnGQomvu<_(bkQlqVjox{T~6p-B@=<
zaAM08pf_tYL$i>cgtgpbF?tdkCx-8lUAU1;`4?XoAJcQLpfco6l0uEcMF{F=qf;vfp!vwk)g|
hL!`Ssx^$i$SHIO00bPxW346o+R!shX(kImd{{tHl7_tBW
literal 0
HcmV?d00001
diff --git a/UseGetFmaterialData/BeforeSaveEventBillPlugIn.cs b/UseGetFmaterialData/BeforeSaveEventBillPlugIn.cs
new file mode 100644
index 0000000..b5d97f9
--- /dev/null
+++ b/UseGetFmaterialData/BeforeSaveEventBillPlugIn.cs
@@ -0,0 +1,195 @@
+using ExtensionMethods;
+using Kingdee.BOS.App.Data;
+using Kingdee.BOS.Core.Bill.PlugIn;
+using Kingdee.BOS.Core.Bill.PlugIn.Args;
+using Kingdee.BOS.Core.DynamicForm.PlugIn.Args;
+using Kingdee.BOS.Core.Metadata.EntityElement;
+using Kingdee.BOS.Orm.DataEntity;
+using Kingdee.BOS.Util;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+
+namespace UseGetFmaterialData
+{
+ ///
+ /// 【单据插件】保存前事件
+ /// 触发顺序:BeforeDoOperation->BeforeSave
+ ///
+ [Description("【单据插件】保存前事件"), HotUpdate]
+ public class BeforeSaveEventBillPlugIn : AbstractBillPlugIn
+ {
+
+ public override void BeforeSave(BeforeSaveEventArgs e)
+ {
+ base.BeforeSave(e);
+ this.View.ShowMessage("插件触发了保存前事件:BeforeSave");
+
+ if (this.Model.DataObject["Id"].Long2Int() == 0)
+ if (OrgIdCheck())
+ {
+ Entity details = null;
+
+ //其他出库单 明细表
+ if (this.View.UserParameterKey.Equals("STK_MisDelivery"))
+ details = this.View.BusinessInfo.GetEntity("FEntity");
+
+ //直接调拨单 明细表
+ if (this.View.UserParameterKey.Equals("STK_TransferDirect"))
+ details = this.View.BusinessInfo.GetEntity("FBillEntry");
+
+ if (details != null)
+ {
+ var entrys = this.View.Model.GetEntityDataObject(details);
+
+ if (entrys != null && entrys.Any())
+ {
+ var tempValue2 = this.View.Model.GetValue("FDATE");
+ var dateValue = tempValue2.IsNullOrEmptyOrWhiteSpace() ? string.Empty : tempValue2.ToString();
+ foreach (var entry in entrys)
+ {
+ var rowIndex = this.View.Model.GetRowIndex(details, entry);
+ var tempValue = entry["MaterialId_Id"];
+ var rowValue = tempValue.IsNullOrEmptyOrWhiteSpace() ? string.Empty : tempValue.ToString();
+ UpdReferPriceAndExplain(dateValue, rowValue, rowIndex);
+ }
+ TotalReferAmount(entrys, details);
+ }
+ }
+ }
+ }
+
+
+ ///
+ /// 参考金额汇总
+ ///
+ ///
+ public void TotalReferAmount(DynamicObjectCollection entrys, Entity details)
+ {
+ if (entrys == null)
+ {
+ //其他出库单 明细表
+ if (this.View.UserParameterKey.Equals("STK_MisDelivery"))
+ details = this.View.BusinessInfo.GetEntity("FEntity");
+
+ //直接调拨单 明细表
+ if (this.View.UserParameterKey.Equals("STK_TransferDirect"))
+ details = this.View.BusinessInfo.GetEntity("FBillEntry");
+
+ if (details != null)
+ entrys = this.View.Model.GetEntityDataObject(details);
+ }
+
+ var total = 0M;
+
+ if (entrys != null && entrys.Any())
+ {
+ foreach (var entry in entrys)
+ {
+ var rowIndex = this.View.Model.GetRowIndex(details, entry);
+ var tAmount = this.View.Model.GetValue("FReferAmount", rowIndex).ToDecimal();
+ total += tAmount;
+ }
+ }
+
+ try
+ {
+ this.View.Model.SetValue("F_GAT_Decimal1", total);
+ this.View.Model.SetValue("FTotalReferAmount", total);
+ }
+ catch
+ {
+ try
+ {
+ this.View.Model.SetValue("FTotalReferAmount", total);
+ this.View.Model.SetValue("F_GAT_Decimal1", total);
+ }
+ catch { }
+ finally { }
+ }
+ finally { }
+ }
+
+ ///
+ /// 检测组织
+ ///
+ ///
+ public bool OrgIdCheck()
+ {
+ //直接调拨单 调出库存组织
+ var org = this.View.Model.GetValue("FStockOutOrgId") as DynamicObject;
+ //其他出库单 库存组织
+ if (org == null)
+ org = this.View.Model.GetValue("FStockOrgId") as DynamicObject;
+
+ return org != null && Convert.ToInt32(org["Id"]) != 101542;
+ }
+
+ ///
+ /// 更新对应行数的参考单价与取价方向
+ ///
+ /// 表头日期
+ /// 子表物料id(物料编码)
+ ///
+ private void UpdReferPriceAndExplain(string date, string materialId, int row)
+ {
+ var returnFlag = false;
+
+ if (date.IsNullOrEmptyOrWhiteSpace())
+ returnFlag = true;
+
+ if (!returnFlag && (materialId.IsNullOrEmptyOrWhiteSpace() || materialId.Equals("0")))
+ returnFlag = true;
+
+ if (returnFlag)
+ {
+ //参考单价
+ this.View.Model.SetValue("FReferPrice", "", row);
+ //参考金额
+ this.View.Model.SetValue("FReferAmount", "", row);
+ ////小数类型参考金额控件
+ //this.View.Model.SetValue("FReferAmountM", 0, row);
+ //参考方向
+ this.View.Model.SetValue("FExplain", "", row);
+ }
+ else
+ {
+ var sqlL = $"EXEC GetFmaterialData {materialId},'{date}'";
+
+ var dataSet = DBUtils.ExecuteDynamicObject(this.Context, $"/*dialect*/{sqlL}");
+
+ if (dataSet != null && dataSet.Any())
+ {
+ var price = dataSet[0]["Fprice"].ToDecimalR();
+ //数量
+ var qty = this.View.Model.GetValue("FQty", row).ToDecimal();
+
+ var amount = (qty * price).ToDecimalR();
+ //参考单价
+ this.View.Model.SetValue("FReferPrice", (price == 0 ? "" : price.ToString()), row);
+
+ //参考金额
+ this.View.Model.SetValue("FReferAmount", (amount == 0 ? "" : amount.ToString()), row);
+ //小数类型参考金额控件
+ //this.View.Model.SetValue("FReferAmountM", amount, row);
+
+ //参考方向
+ this.View.Model.SetValue("FExplain", dataSet[0]["FNOTE"], row);
+ }
+ else
+ {
+ //参考单价
+ this.View.Model.SetValue("FReferPrice", "", row);
+ //参考金额
+ this.View.Model.SetValue("FReferAmount", "", row);
+ //小数类型参考金额控件
+ //this.View.Model.SetValue("FReferAmountM", 0, row);
+ //参考方向
+ this.View.Model.SetValue("FExplain", "", row);
+ }
+ }
+ }
+ }
+}
diff --git a/UseGetFmaterialData/DataChangedEventFormPlugIn.cs b/UseGetFmaterialData/DataChangedEventFormPlugIn.cs
new file mode 100644
index 0000000..d161ca8
--- /dev/null
+++ b/UseGetFmaterialData/DataChangedEventFormPlugIn.cs
@@ -0,0 +1,261 @@
+using ExtensionMethods;
+using Kingdee.BOS.App.Data;
+using Kingdee.BOS.Core.DynamicForm.PlugIn;
+using Kingdee.BOS.Core.DynamicForm.PlugIn.Args;
+using Kingdee.BOS.Core.Metadata.EntityElement;
+using Kingdee.BOS.Core.Metadata.Util;
+using Kingdee.BOS.Orm.DataEntity;
+using Kingdee.BOS.Util;
+using System;
+using System.ComponentModel;
+using System.Linq;
+using static System.Net.WebRequestMethods;
+
+namespace UseGetFmaterialData
+{
+ [Description("根据日期,物料Id更新参考单价、取价方向、参考金额-控件触发、新增加载触发"), HotUpdate]
+
+ public class DataChangedEventFormPlugIn : AbstractDynamicFormPlugIn
+
+ {
+ //对应控件数值改变时触发
+ public override void DataChanged(DataChangedEventArgs e)
+ {
+
+ base.DataChanged(e);
+
+ //表头日期
+ if (e.Field.Key.EqualsIgnoreCase("FDATE"))
+ {
+ if (OrgIdCheck())
+ {
+ Entity details = null;
+
+ //其他出库单 明细表
+ if (this.View.UserParameterKey.Equals("STK_MisDelivery"))
+ details = this.View.BusinessInfo.GetEntity("FEntity");
+
+ //直接调拨单 明细表
+ if (this.View.UserParameterKey.Equals("STK_TransferDirect"))
+ details = this.View.BusinessInfo.GetEntity("FBillEntry");
+
+ if (details != null)
+ {
+ var entrys = this.View.Model.GetEntityDataObject(details);
+
+ if (entrys != null && entrys.Any())
+ {
+ var dateValue = e.NewValue == null ? string.Empty : e.NewValue.ToString();
+ foreach (var entry in entrys)
+ {
+ var rowIndex = this.View.Model.GetRowIndex(details, entry);
+ var tempValue = entry["MaterialId_Id"];
+ var rowValue = tempValue == null ? string.Empty : tempValue.ToString();
+ UpdReferPriceAndExplain(dateValue, rowValue, rowIndex);
+ }
+ TotalReferAmount(entrys, details);
+ }
+ }
+ }
+ }
+
+ //子表物料id
+ if (e.Field.Key.EqualsIgnoreCase("FMaterialId"))
+ {
+ if (OrgIdCheck())
+ {
+ var rowValue = e.NewValue == null ? string.Empty : e.NewValue.ToString();
+ var tempValue = this.View.Model.GetValue("FDATE");
+ var dateValue = tempValue == null ? string.Empty : tempValue.ToString();
+ UpdReferPriceAndExplain(dateValue, rowValue, e.Row);
+ TotalReferAmount(null, null);
+ }
+ }
+
+ //数量
+ if (e.Field.Key.EqualsIgnoreCase("FQty"))
+ {
+
+ if (OrgIdCheck())
+ {
+ //参考单价
+ var referPrice = this.View.Model.GetValue("FReferPrice", e.Row).ToDecimalR();
+ var amount = (e.NewValue.ToDecimal() * referPrice).ToDecimalR();
+ //参考金额
+ this.View.Model.SetValue("FReferAmount", amount, e.Row);
+ //小数类型参考金额控件
+ //this.View.Model.SetValue("FReferAmountM", amount, e.Row);
+ TotalReferAmount(null, null);
+ }
+ }
+ }
+
+ //新增加载时触发
+ public override void AfterCreateNewData(EventArgs e)
+ {
+ base.AfterCreateNewData(e);
+
+ if (OrgIdCheck())
+ {
+ Entity details = null;
+
+ //其他出库单 明细表
+ if (this.View.UserParameterKey.Equals("STK_MisDelivery"))
+ details = this.View.BusinessInfo.GetEntity("FEntity");
+
+ //直接调拨单 明细表
+ if (this.View.UserParameterKey.Equals("STK_TransferDirect"))
+ details = this.View.BusinessInfo.GetEntity("FBillEntry");
+
+ if (details != null)
+ {
+ var entrys = this.View.Model.GetEntityDataObject(details);
+
+ if (entrys != null && entrys.Any())
+ {
+ var tempValue2 = this.View.Model.GetValue("FDATE");
+ var dateValue = tempValue2.IsNullOrEmptyOrWhiteSpace() ? string.Empty : tempValue2.ToString();
+ foreach (var entry in entrys)
+ {
+ var rowIndex = this.View.Model.GetRowIndex(details, entry);
+ var tempValue = entry["MaterialId_Id"];
+ var rowValue = tempValue.IsNullOrEmptyOrWhiteSpace() ? string.Empty : tempValue.ToString();
+ UpdReferPriceAndExplain(dateValue, rowValue, rowIndex);
+ }
+ TotalReferAmount(entrys, details);
+ }
+ }
+ }
+
+ }
+
+
+ ///
+ /// 参考金额汇总
+ ///
+ ///
+ public void TotalReferAmount(DynamicObjectCollection entrys, Entity details)
+ {
+ if (entrys == null)
+ {
+ //其他出库单 明细表
+ if (this.View.UserParameterKey.Equals("STK_MisDelivery"))
+ details = this.View.BusinessInfo.GetEntity("FEntity");
+
+ //直接调拨单 明细表
+ if (this.View.UserParameterKey.Equals("STK_TransferDirect"))
+ details = this.View.BusinessInfo.GetEntity("FBillEntry");
+
+ if (details != null)
+ entrys = this.View.Model.GetEntityDataObject(details);
+ }
+
+ var total = 0M;
+
+ if (entrys != null && entrys.Any())
+ {
+ foreach (var entry in entrys)
+ {
+ var rowIndex = this.View.Model.GetRowIndex(details, entry);
+ var tAmount = this.View.Model.GetValue("FReferAmount", rowIndex).ToDecimal();
+ total += tAmount;
+ }
+ }
+
+ try
+ {
+ this.View.Model.SetValue("F_GAT_Decimal1", total);
+ }
+ catch
+ {
+ try
+ {
+ this.View.Model.SetValue("FTotalReferAmount", total);
+ }
+ catch { }
+ finally { }
+ }
+ finally { }
+ }
+
+ ///
+ /// 检测组织
+ ///
+ ///
+ public bool OrgIdCheck()
+ {
+ //直接调拨单 调出库存组织
+ var org = this.View.Model.GetValue("FStockOutOrgId") as DynamicObject;
+ //其他出库单 库存组织
+ if (org == null)
+ org = this.View.Model.GetValue("FStockOrgId") as DynamicObject;
+
+ return org != null && Convert.ToInt32(org["Id"]) == 101542;
+ }
+
+ ///
+ /// 更新对应行数的参考单价与取价方向
+ ///
+ /// 表头日期
+ /// 子表物料id(物料编码)
+ ///
+ private void UpdReferPriceAndExplain(string date, string materialId, int row)
+ {
+ var returnFlag = false;
+
+ if (date.IsNullOrEmptyOrWhiteSpace())
+ returnFlag = true;
+
+ if (!returnFlag && (materialId.IsNullOrEmptyOrWhiteSpace() || materialId.Equals("0")))
+ returnFlag = true;
+
+ if (returnFlag)
+ {
+ //参考单价
+ this.View.Model.SetValue("FReferPrice", "", row);
+ //参考金额
+ this.View.Model.SetValue("FReferAmount", "", row);
+ ////小数类型参考金额控件
+ //this.View.Model.SetValue("FReferAmountM", 0, row);
+ //参考方向
+ this.View.Model.SetValue("FExplain", "", row);
+ }
+ else
+ {
+ var sqlL = $"EXEC GetFmaterialData {materialId},'{date}'";
+
+ var dataSet = DBUtils.ExecuteDynamicObject(this.Context, $"/*dialect*/{sqlL}");
+
+ if (dataSet != null && dataSet.Any())
+ {
+ var price = dataSet[0]["Fprice"].ToDecimalR();
+ //数量
+ var qty = this.View.Model.GetValue("FQty", row).ToDecimal();
+
+ var amount = (qty * price).ToDecimalR();
+ //参考单价
+ this.View.Model.SetValue("FReferPrice", (price == 0 ? "" : price.ToString()), row);
+
+ //参考金额
+ this.View.Model.SetValue("FReferAmount", (amount == 0 ? "" : amount.ToString()), row);
+ //小数类型参考金额控件
+ //this.View.Model.SetValue("FReferAmountM", amount, row);
+
+ //参考方向
+ this.View.Model.SetValue("FExplain", dataSet[0]["FNOTE"], row);
+ }
+ else
+ {
+ //参考单价
+ this.View.Model.SetValue("FReferPrice", "", row);
+ //参考金额
+ this.View.Model.SetValue("FReferAmount", "", row);
+ //小数类型参考金额控件
+ //this.View.Model.SetValue("FReferAmountM", 0, row);
+ //参考方向
+ this.View.Model.SetValue("FExplain", "", row);
+ }
+ }
+ }
+ }
+}
diff --git a/UseGetFmaterialData/Properties/AssemblyInfo.cs b/UseGetFmaterialData/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..af07156
--- /dev/null
+++ b/UseGetFmaterialData/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// 有关程序集的一般信息由以下
+// 控制。更改这些特性值可修改
+// 与程序集关联的信息。
+[assembly: AssemblyTitle("UseGetFmaterialData")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("UseGetFmaterialData")]
+[assembly: AssemblyCopyright("Copyright © 2023")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// 将 ComVisible 设置为 false 会使此程序集中的类型
+//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
+//请将此类型的 ComVisible 特性设置为 true。
+[assembly: ComVisible(false)]
+
+// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
+[assembly: Guid("4d6bda2d-fed0-4514-b4cd-ff32c5389247")]
+
+// 程序集的版本信息由下列四个值组成:
+//
+// 主版本
+// 次版本
+// 生成号
+// 修订号
+//
+//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
+//通过使用 "*",如下所示:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/UseGetFmaterialData/UseGetFmaterialData.csproj b/UseGetFmaterialData/UseGetFmaterialData.csproj
new file mode 100644
index 0000000..3e12908
--- /dev/null
+++ b/UseGetFmaterialData/UseGetFmaterialData.csproj
@@ -0,0 +1,70 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {4D6BDA2D-FED0-4514-B4CD-FF32C5389247}
+ Library
+ Properties
+ UseGetFmaterialData
+ UseGetFmaterialData
+ v4.0
+ 512
+ true
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+ ..\..\..\..\..\Program Files (x86)\Kingdee\K3Cloud\WebSite\bin\Kingdee.BOS.dll
+
+
+ ..\..\..\..\..\Program Files (x86)\Kingdee\K3Cloud\WebSite\bin\Kingdee.BOS.App.dll
+
+
+ ..\..\..\..\..\Program Files (x86)\Kingdee\K3Cloud\WebSite\bin\Kingdee.BOS.Core.dll
+
+
+ ..\..\..\..\..\Program Files (x86)\Kingdee\K3Cloud\WebSite\bin\Kingdee.BOS.DataEntity.dll
+
+
+ False
+ ..\..\..\..\..\Program Files (x86)\Kingdee\K3Cloud\WebSite\bin\Newtonsoft.Json.dll
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {50532462-8f7f-455c-b4b3-732ed764e2fa}
+ ExtensionMethods
+
+
+
+
\ No newline at end of file
diff --git a/月度生产计划表-预测单.sql b/月度生产计划表-预测单.sql
new file mode 100644
index 0000000..7300218
--- /dev/null
+++ b/月度生产计划表-预测单.sql
@@ -0,0 +1,48 @@
+declare @LCID int
+set @LCID = 2052
+SELECT
+ A.FBILLNO
+ ,ae.FMATERIALID
+ ,b.FBILLNO
+ --,'' AS 'Ʒ'
+ --,(CASE
+ -- FEXPUNIT
+ -- WHEN 'Y' THEN
+ -- CONVERT ( VARCHAR, BA.FEXPPERIOD ) + ''
+ -- WHEN 'M' THEN
+ -- CONVERT ( VARCHAR, ba.FEXPPERIOD) + ''
+ -- WHEN 'D' THEN
+ -- CONVERT ( VARCHAR, ba.FEXPPERIOD ) + '' ELSE ''
+ --END) as 'Ч'
+ --,'' as ''
+ --,'' as 'ÿ'
+ --,'' as 'װ'
+ --,'' as 'װ-ֵ'
+ --,a.FUNITID
+ --,'' as 'λ'
+ --,'' as 'ȫ'
+ --,BA.FSAFESTOCK AS 'ȫ'
+ ,AE.m01 as 'Ԥ'
+ ,AE.s01 as 'ǰ·'
+ ,AE.s02 as 'ǰ·'
+ ,AE.s03 as 'ǰһ·'
+ --,EE_A.FSTOCKINQUAAUXQTY as ''
+ --,'' as ''
+ --,(EE_A.FSTOCKINQUAAUXQTY + 0) as 'ϼƿ'
+ --,'' as 'ƻ'
+ --,DE.FQTY AS 'ƻ'
+ --,DE.FREMARK AS 'ע'
+FROM
+ T_PLN_FORECAST A --Ԥⵥ
+ left join T_PLN_FORECASTENTRY AE on a.FID = ae.FID
+ left join T_PLN_PLANORDER_B B_b on ae.FENTRYID = b_b.FSALEORDERENTRYID and a.FID = b_b.FSALEORDERID
+ left join T_PLN_PLANORDER B on b.FID = b_b.FID
+ --T_PLN_PLANORDER A --ƻ
+ --LEFT JOIN T_BD_MATERIAL B ON A.FMATERIALID = B.FMATERIALID --
+ --LEFT JOIN T_BD_MATERIALSTOCK BA ON BA.FMATERIALID = B.FMATERIALID
+ --LEFT JOIN T_PLN_FORECASTENTRY DE ON DE.FMATERIALID = B.FMATERIALID --Ԥⵥ
+ --left join T_PLN_FORECAST d on de.FID = d.FID
+ --LEFT JOIN T_PRD_MOENTRY EE ON EE.FMATERIALID = B.FMATERIALID --
+ --LEFT JOIN T_PRD_MOENTRY_A EE_A ON EE_A.FENTRYID = EE.FENTRYID AND EE.FID =EE_A.FID --
+where a.fdate ='2023-12-01'
+-- A.FRELEASETYPE = 1
\ No newline at end of file
diff --git a/月度生产计划表.sql b/月度生产计划表.sql
new file mode 100644
index 0000000..46a1eb8
--- /dev/null
+++ b/月度生产计划表.sql
@@ -0,0 +1,60 @@
+--DECLARE @date date,@startDate datetime ,@endDate datetime
+--set @date = '2023-07-15'
+--select
+-- @startDate = dateadd(month, datediff(month, 0, @date), 0)
+-- ,@endDate = dateadd(ms,-3, dateadd(month, datediff(month, 0, dateadd(month, 1, @date)), 0))
+--select
+--@startDate,@endDate
+
+declare @LCID int
+set @LCID = 2052
+SELECT
+ A.FMATERIALID
+ ,a.FBILLNO
+ ,ee.FSRCBILLNO
+ --,B_L.FNAME AS '产品名称'
+ ,(CASE
+ FEXPUNIT
+ WHEN 'Y' THEN
+ CONVERT ( VARCHAR, BA.FEXPPERIOD ) + '年'
+ WHEN 'M' THEN
+ CONVERT ( VARCHAR, ba.FEXPPERIOD) + '月'
+ WHEN 'D' THEN
+ CONVERT ( VARCHAR, ba.FEXPPERIOD ) + '日' ELSE ''
+ END) as '有效期'
+
+ ,'' as '有效期'
+ ,'' as '标准批量'
+ ,'' as '每批产量(件)'
+ ,'' as '包装规格'
+ ,'' as '包装规格'
+ ,a.FUNITID
+ ,'' as '单位'
+ --,C_L.FNAME AS '单位'
+ ,'' as '安全库存量(件)'
+ ,BA.FSAFESTOCK AS '安全库存数量'
+ --,DE.M01 AS '本月预计需求量'
+ --,DE.S01 AS '前三月发货量'
+ --,DE.S02 AS '前二月发货量'
+ --,DE.S03 AS '前一月发货量'
+ ,EE_A.FSTOCKINQUAAUXQTY as '已入库量'
+ ,'' as '在生产量'
+ ,(EE_A.FSTOCKINQUAAUXQTY + 0) as '合计库存量'
+ ,'' as '计划生产批数'
+ ,DE.FQTY AS '计划生产量'
+ ,DE.FREMARK AS '备注'
+FROM
+ T_PLN_PLANORDER A --计划订单
+ LEFT JOIN T_BD_MATERIAL B ON A.FMATERIALID = B.FMATERIALID --物料
+-- LEFT JOIN T_BD_MATERIAL_L B_L ON B_L.FMATERIALID = B.FMATERIALID
+ LEFT JOIN T_BD_MATERIALSTOCK BA ON BA.FMATERIALID = B.FMATERIALID
+-- LEFT JOIN T_BD_MATERIALBASE BB ON BB.FMATERIALID = B.FMATERIALID
+ --LEFT JOIN T_BD_UNIT_L C_L ON C_L.FUNITID = a.FUNITID
+ LEFT JOIN T_PLN_FORECASTENTRY DE ON DE.FMATERIALID = B.FMATERIALID --预测单
+ left join T_PLN_FORECAST d on de.FID = d.FID
+ LEFT JOIN T_PRD_MOENTRY EE ON EE.FMATERIALID = B.FMATERIALID --生产订单
+ LEFT JOIN T_PRD_MOENTRY_A EE_A ON EE_A.FENTRYID = EE.FENTRYID AND EE.FID =EE_A.FID --生产订单
+WHERE
+ A.FRELEASETYPE = 1
+ --AND B_L.FLOCALEID = @LCID
+ --AND C_L.FLOCALEID = @LCID
\ No newline at end of file
diff --git a/销售出库单财务信息.sql b/销售出库单财务信息.sql
new file mode 100644
index 0000000..0ffb684
--- /dev/null
+++ b/销售出库单财务信息.sql
@@ -0,0 +1,11 @@
+SELECT
+ A.FBILLNO,
+ A.FID,
+ A.FSTOCKORGID,
+ A.FDOCUMENTSTATUS,
+ AF.FBILLALLAMOUNT,
+ AF.FBILLAMOUNT,
+ AF.FBILLTAXAMOUNT
+FROM
+ T_SAL_OUTSTOCK A
+ LEFT JOIN T_SAL_OUTSTOCKFIN AF ON A.FID = AF.FID
\ No newline at end of file