Merge branch 'master' of http://8.130.121.29:3000/yuyubo/Pilot_KD_Parino_yuyubo
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -57,3 +57,4 @@
|
|||||||
/Pilot_KD_Parino/obj/Debug/Pilot_KD_Parino.dll
|
/Pilot_KD_Parino/obj/Debug/Pilot_KD_Parino.dll
|
||||||
/Pilot_KD_Parino/obj/Debug/Pilot_KD_Parino.pdb
|
/Pilot_KD_Parino/obj/Debug/Pilot_KD_Parino.pdb
|
||||||
/Pilot_KD_Parino/packages.config
|
/Pilot_KD_Parino/packages.config
|
||||||
|
/.vs
|
||||||
|
|||||||
@@ -108,9 +108,6 @@
|
|||||||
<Reference Include="ICSharpCode.SharpZipLib">
|
<Reference Include="ICSharpCode.SharpZipLib">
|
||||||
<HintPath>..\..\..\派诺-裴豪\派诺功能\代码\Pilot_KD_Parino (2)\Pilot_KD_Parino\Pilot_KD_Parino\bin\Debug\ICSharpCode.SharpZipLib.dll</HintPath>
|
<HintPath>..\..\..\派诺-裴豪\派诺功能\代码\Pilot_KD_Parino (2)\Pilot_KD_Parino\Pilot_KD_Parino\bin\Debug\ICSharpCode.SharpZipLib.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="IronPython">
|
|
||||||
<HintPath>..\..\..\派诺-裴豪\派诺功能\代码\Pilot_KD_Parino (2)\Pilot_KD_Parino\Pilot_KD_Parino\bin\Debug\IronPython.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="JWT">
|
<Reference Include="JWT">
|
||||||
<HintPath>..\..\..\派诺-裴豪\派诺功能\代码\Pilot_KD_Parino (2)\Pilot_KD_Parino\Pilot_KD_Parino\bin\Debug\JWT.dll</HintPath>
|
<HintPath>..\..\..\派诺-裴豪\派诺功能\代码\Pilot_KD_Parino (2)\Pilot_KD_Parino\Pilot_KD_Parino\bin\Debug\JWT.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
@@ -222,6 +219,9 @@
|
|||||||
<Reference Include="Kingdee.BOS.WebApi.ServicesStub">
|
<Reference Include="Kingdee.BOS.WebApi.ServicesStub">
|
||||||
<HintPath>..\..\派诺(1)\派诺\git\6、程序\GZ_KD_Parino\bin\Debug\Kingdee.BOS.WebApi.ServicesStub.dll</HintPath>
|
<HintPath>..\..\派诺(1)\派诺\git\6、程序\GZ_KD_Parino\bin\Debug\Kingdee.BOS.WebApi.ServicesStub.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="Kingdee.K3.BD.NewCode.Core">
|
||||||
|
<HintPath>..\..\..\..\..\..\..\Program Files (x86)\Kingdee\K3Cloud\WebSite\bin\Kingdee.K3.BD.NewCode.Core.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="Kingdee.K3.Core">
|
<Reference Include="Kingdee.K3.Core">
|
||||||
<HintPath>..\..\派诺(1)\派诺\git\6、程序\GZ_KD_Parino\bin\Debug\Kingdee.K3.Core.dll</HintPath>
|
<HintPath>..\..\派诺(1)\派诺\git\6、程序\GZ_KD_Parino\bin\Debug\Kingdee.K3.Core.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
@@ -348,6 +348,7 @@
|
|||||||
<Compile Include="QPHY_AutoWrire\SearchWriteRecord.cs" />
|
<Compile Include="QPHY_AutoWrire\SearchWriteRecord.cs" />
|
||||||
<Compile Include="ReceivablesDetails\ReceivablesPlugIn.cs" />
|
<Compile Include="ReceivablesDetails\ReceivablesPlugIn.cs" />
|
||||||
<Compile Include="Sal_Order\Bill.cs" />
|
<Compile Include="Sal_Order\Bill.cs" />
|
||||||
|
<Compile Include="Sal_Order\ConvertPlugIn\SalOrder2DeliveryConvert.cs" />
|
||||||
<Compile Include="Sal_Order\PushSaleBillPlugIn.cs" />
|
<Compile Include="Sal_Order\PushSaleBillPlugIn.cs" />
|
||||||
<Compile Include="Sal_Order\PushSaleOutBillPlugIn.cs" />
|
<Compile Include="Sal_Order\PushSaleOutBillPlugIn.cs" />
|
||||||
<Compile Include="Sal_Order\SalDeliveryNoticeAudit.cs" />
|
<Compile Include="Sal_Order\SalDeliveryNoticeAudit.cs" />
|
||||||
@@ -361,6 +362,10 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Content Include="Sal_Order\ConvertPlugIn\SalOrder2DeliveryConvert.py" />
|
||||||
|
<Content Include="SAL_DELIVERYNOTICE\ServicePlugIn\Save.py" />
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<PostBuildEvent>
|
<PostBuildEvent>
|
||||||
|
|||||||
6
Pilot_KD_Parino/Pilot_KD_Parino.csproj.user
Normal file
6
Pilot_KD_Parino/Pilot_KD_Parino.csproj.user
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup>
|
||||||
|
<ProjectView>ProjectFiles</ProjectView>
|
||||||
|
</PropertyGroup>
|
||||||
|
</Project>
|
||||||
95
Pilot_KD_Parino/SAL_DELIVERYNOTICE/ServicePlugIn/Save.py
Normal file
95
Pilot_KD_Parino/SAL_DELIVERYNOTICE/ServicePlugIn/Save.py
Normal file
@@ -0,0 +1,95 @@
|
|||||||
|
#引入clr运行库
|
||||||
|
import clr
|
||||||
|
#添加对cloud插件开发的常用组件引用
|
||||||
|
clr.AddReference('System')
|
||||||
|
clr.AddReference('System.Data')
|
||||||
|
clr.AddReference('Kingdee.BOS')
|
||||||
|
clr.AddReference('Kingdee.BOS.Core')
|
||||||
|
clr.AddReference('Kingdee.BOS.App')
|
||||||
|
clr.AddReference('Kingdee.BOS.App.Core')
|
||||||
|
clr.AddReference('Kingdee.BOS.Contracts')
|
||||||
|
clr.AddReference('Kingdee.BOS.DataEntity')
|
||||||
|
clr.AddReference('Kingdee.BOS.ServiceHelper')
|
||||||
|
#dairycloud基础库中的常用实体对象(分命名空间导入,不会递归导入)
|
||||||
|
from Kingdee.BOS.Core import *
|
||||||
|
from Kingdee.BOS.Util import *
|
||||||
|
from Kingdee.BOS.Core.Bill import *
|
||||||
|
from Kingdee.BOS.Core.List import *
|
||||||
|
from Kingdee.BOS.Core.Bill.PlugIn import *
|
||||||
|
from Kingdee.BOS.Orm.DataEntity import *
|
||||||
|
from Kingdee.BOS.Core.DynamicForm.PlugIn import *
|
||||||
|
from Kingdee.BOS.Core.DynamicForm.PlugIn.Args import *
|
||||||
|
from Kingdee.BOS.Core.DynamicForm.PlugIn.ControlModel import *
|
||||||
|
from Kingdee.BOS.Core.Metadata.ConvertElement.ServiceArgs import *
|
||||||
|
from System import *
|
||||||
|
from System.Data import *
|
||||||
|
from Kingdee.BOS.App.Data import *
|
||||||
|
from Kingdee.BOS.App import *
|
||||||
|
from Kingdee.BOS.Orm import *
|
||||||
|
from Kingdee.BOS.Contracts import *
|
||||||
|
from System.Collections.Generic import List
|
||||||
|
from Kingdee.BOS.ServiceHelper import *
|
||||||
|
from Kingdee.BOS.App.Core import *
|
||||||
|
|
||||||
|
def OnPreparePropertys(e):
|
||||||
|
e.FieldKeys.Add("FAllAmount");
|
||||||
|
e.FieldKeys.Add("FBillAllAmount");
|
||||||
|
e.FieldKeys.Add("F_SFYFH");
|
||||||
|
e.FieldKeys.Add("FSaleOrgId");
|
||||||
|
e.FieldKeys.Add("FDocumentStatus");
|
||||||
|
|
||||||
|
def BeforeDoSaveExecute(e):
|
||||||
|
# if this.FormOperation.OperationId == 8:
|
||||||
|
for entity in e.DataEntities:
|
||||||
|
if entity["SaleOrgId_Id"] != 100303:
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if entity["DocumentStatus"] != "Z" and entity["DocumentStatus"] != "C":
|
||||||
|
continue;
|
||||||
|
|
||||||
|
billId = entity["Id"]
|
||||||
|
# raise Exception(JsonUtil.Serialize(entity))
|
||||||
|
entries = entity["SAL_DELIVERYNOTICEENTRY"]
|
||||||
|
idList = List[str]()
|
||||||
|
for idx,entry in enumerate(entries):
|
||||||
|
|
||||||
|
entityLink = entry["FEntity_Link"]
|
||||||
|
if entityLink != None and entityLink.Count > 0:
|
||||||
|
link = entityLink[0]
|
||||||
|
idList.Add(link["SBillId"])
|
||||||
|
|
||||||
|
if idList is None or len(idList) == 0:
|
||||||
|
continue;
|
||||||
|
|
||||||
|
sql = """/*dialect*/
|
||||||
|
SELECT SUM(t0.F_Amount) '累计核销金额',SUM(t0p.FRECADVANCEAMOUNT) '款到发货应收金额',SUM(t0p.CountTotal) '收款计划条数',SUM(ISNULL(t1.FALLAMOUNT,0)) '累计已发货金额'
|
||||||
|
FROM T_SAL_ORDER t0
|
||||||
|
CROSS APPLY (
|
||||||
|
SELECT SUM(t0p.FRECADVANCEAMOUNT) 'FRECADVANCEAMOUNT',COUNT(1) 'CountTotal'
|
||||||
|
FROM T_SAL_ORDERPLAN t0p
|
||||||
|
INNER JOIN T_BD_RECCONDITION_L t1_l on t1_l.FID = t0p.F_RECCONDITIONID
|
||||||
|
AND t1_l.FLOCALEID = 2052 AND CHARINDEX('款到发货',t1_l.FNAME) = 1
|
||||||
|
WHERE t0.FID = t0p.FID
|
||||||
|
) t0p
|
||||||
|
OUTER APPLY (
|
||||||
|
SELECT SUM(t1e_f.FALLAMOUNT) FALLAMOUNT
|
||||||
|
FROM T_SAL_DELIVERYNOTICEENTRY_LK t1e_lk
|
||||||
|
INNER JOIN T_SAL_DELIVERYNOTICEENTRY_F t1e_f on t1e_f.FENTRYID = t1e_lk.FENTRYID
|
||||||
|
WHERE t1e_lk .FSID = t0.FID AND t1e_f.FID != {1}
|
||||||
|
) t1
|
||||||
|
WHERE t0.FID IN ({0})
|
||||||
|
""".format(",".join(set(idList)), billId)
|
||||||
|
res = DBServiceHelper.ExecuteDynamicObject(this.Context, sql)
|
||||||
|
if res != None and res.Count > 0:
|
||||||
|
# raise Exception(JsonUtil.Serialize(res))
|
||||||
|
item = res[0]
|
||||||
|
|
||||||
|
if entity["SAL_DELIVERYNOTICEFIN"] != None and entity["SAL_DELIVERYNOTICEFIN"].Count > 0:
|
||||||
|
currAmount = entity["SAL_DELIVERYNOTICEFIN"][0]["BillAllAmount"]
|
||||||
|
# raise Exception(str(currAmount))
|
||||||
|
isYFHFlag = item["累计核销金额"] < item["款到发货应收金额"]
|
||||||
|
isYFHFlag1 = isYFHFlag == True and (item["收款计划条数"] == 1)
|
||||||
|
isYFHFlag2 = isYFHFlag == True and (True if isYFHFlag1 else ((item["累计核销金额"] - item["累计已发货金额"]) < currAmount))
|
||||||
|
entity["F_SFYFH"] = '是' if isYFHFlag2 == True else '否'
|
||||||
|
|
||||||
|
return;
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
using Kingdee.BOS.Core.Metadata.ConvertElement.PlugIn;
|
||||||
|
using Kingdee.BOS.Core.Metadata.ConvertElement.PlugIn.Args;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Kingdee.BOS.Util;
|
||||||
|
|
||||||
|
namespace Pilot_KD_Parino.Sal_Order.ConvertPlugIn
|
||||||
|
{
|
||||||
|
public class SalOrder2DeliveryConvert : AbstractConvertPlugIn
|
||||||
|
{
|
||||||
|
public override void AfterConvert(AfterConvertEventArgs e)
|
||||||
|
{
|
||||||
|
base.AfterConvert(e);
|
||||||
|
if (e.Result.FindByEntityKey("FBillHead").Any())
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnGetSourceData(GetSourceDataEventArgs e)
|
||||||
|
{
|
||||||
|
base.OnGetSourceData(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnBeforeFieldMapping(BeforeFieldMappingEventArgs e)
|
||||||
|
{
|
||||||
|
base.OnBeforeFieldMapping(e);
|
||||||
|
e.FireFieldMappingEvent = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnFieldMapping(FieldMappingEventArgs e)
|
||||||
|
{
|
||||||
|
base.OnFieldMapping(e);
|
||||||
|
if (e.TargetField.Key.EqualsIgnoreCase("F_SFYFH"))
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,112 @@
|
|||||||
|
import clr
|
||||||
|
clr.AddReference("System")
|
||||||
|
clr.AddReference('System.Data')
|
||||||
|
clr.AddReference("Kingdee.BOS")
|
||||||
|
clr.AddReference("Kingdee.BOS.DataEntity")
|
||||||
|
clr.AddReference("Kingdee.BOS.Core")
|
||||||
|
clr.AddReference('Kingdee.BOS.App')
|
||||||
|
clr.AddReference("Kingdee.BOS.ServiceHelper")
|
||||||
|
|
||||||
|
from Kingdee.BOS.Core import *
|
||||||
|
from Kingdee.BOS.Util import *
|
||||||
|
from Kingdee.BOS.Orm.DataEntity import *
|
||||||
|
from Kingdee.BOS.Core.Metadata.ConvertElement.PlugIn import *
|
||||||
|
from Kingdee.BOS.Core.Metadata.ConvertElement.PlugIn.Args import *
|
||||||
|
from System import *
|
||||||
|
from System.Data import *
|
||||||
|
from System.Collections.Generic import *
|
||||||
|
from Kingdee.BOS.ServiceHelper import *
|
||||||
|
|
||||||
|
|
||||||
|
def FirstOrDefault(collection, func):
|
||||||
|
"""仿Linq的FirstOrDefault
|
||||||
|
|
||||||
|
Args:
|
||||||
|
collection (_type_): 数据集
|
||||||
|
func (_type_): lambda公式
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
_type_: 获取数据集第一个或null
|
||||||
|
"""
|
||||||
|
result = filter(func, collection)
|
||||||
|
|
||||||
|
if len(result) == 0: return None
|
||||||
|
|
||||||
|
return result[0]
|
||||||
|
|
||||||
|
def AfterConvert(e):
|
||||||
|
billHeadEntites = e.Result.FindByEntityKey("FBillHead")
|
||||||
|
if billHeadEntites !=None and billHeadEntites.Count > 0:
|
||||||
|
for billHeadEntity in billHeadEntites:
|
||||||
|
billHead = billHeadEntity.DataEntity;
|
||||||
|
# raise Exception(JsonUtil.Serialize(billHead));
|
||||||
|
entrys = billHead["SAL_DELIVERYNOTICEENTRY"]
|
||||||
|
idList = List[str]()
|
||||||
|
for entry in entrys:
|
||||||
|
entityLink = entry["FEntity_Link"]
|
||||||
|
if entityLink != None and entityLink.Count > 0:
|
||||||
|
link = entityLink[0]
|
||||||
|
idList.Add(link["SBillId"])
|
||||||
|
|
||||||
|
if idList is None or len(idList) == 0:
|
||||||
|
continue;
|
||||||
|
sql = """/*dialect*/
|
||||||
|
SELECT t0.FID,t0.F_Amount '累计核销金额',t0p.FRECADVANCEAMOUNT '款到发货应收金额',t0p.CountTotal
|
||||||
|
FROM T_SAL_ORDER t0
|
||||||
|
CROSS APPLY (
|
||||||
|
SELECT SUM(t0p.FRECADVANCEAMOUNT) 'FRECADVANCEAMOUNT',COUNT(1) 'CountTotal'
|
||||||
|
FROM T_SAL_ORDERPLAN t0p
|
||||||
|
INNER JOIN T_BD_RECCONDITION_L t1_l on t1_l.FID = t0p.F_RECCONDITIONID
|
||||||
|
AND t1_l.FLOCALEID = 2052 AND CHARINDEX('款到发货',t1_l.FNAME) = 1
|
||||||
|
WHERE t0.FID = t0p.FID
|
||||||
|
GROUP BY t0p.FID
|
||||||
|
) t0p
|
||||||
|
WHERE t0.FID IN ({0})
|
||||||
|
""".format(",".join(set(idList)))
|
||||||
|
dataList = DBServiceHelper.ExecuteDynamicObject(this.Context, sql);
|
||||||
|
if dataList != None and len(dataList) > 0:
|
||||||
|
data = dataList[0]
|
||||||
|
isPreShipment = False;
|
||||||
|
if data["累计核销金额"] >= data["款到发货应收金额"]:
|
||||||
|
isPreShipment = False;
|
||||||
|
else:
|
||||||
|
isPreShipment = True;
|
||||||
|
|
||||||
|
return;
|
||||||
|
|
||||||
|
# 数据转换完毕后触发事件
|
||||||
|
def OnBeforeFieldMapping(e):
|
||||||
|
e.FireFieldMappingEvent = True;
|
||||||
|
return
|
||||||
|
|
||||||
|
def OnFieldMapping(e):
|
||||||
|
if e.TargetField.Key == "F_SFYFH":
|
||||||
|
return;
|
||||||
|
sourceData = e.ConvertSource
|
||||||
|
idList = set(map((lambda x:x["FID"]) ,filter((lambda x:x["FSaleOrgId"] == 100303) ,sourceData)))
|
||||||
|
if idList is None or len(idList) == 0:
|
||||||
|
return
|
||||||
|
# raise Exception(JsonUtil.Serialize(srcDBDatas))
|
||||||
|
sql = """/*dialect*/
|
||||||
|
SELECT t0.FID,t0.F_Amount '累计核销金额',t0p.FRECADVANCEAMOUNT '款到发货应收金额',t0p.CountTotal
|
||||||
|
FROM T_SAL_ORDER t0
|
||||||
|
CROSS APPLY (
|
||||||
|
SELECT SUM(t0p.FRECADVANCEAMOUNT) 'FRECADVANCEAMOUNT',COUNT(1) 'CountTotal'
|
||||||
|
FROM T_SAL_ORDERPLAN t0p
|
||||||
|
INNER JOIN T_BD_RECCONDITION_L t1_l on t1_l.FID = t0p.F_RECCONDITIONID
|
||||||
|
AND t1_l.FLOCALEID = 2052 AND CHARINDEX('款到发货',t1_l.FNAME) = 1
|
||||||
|
WHERE t0.FID = t0p.FID
|
||||||
|
GROUP BY t0p.FID
|
||||||
|
) t0p
|
||||||
|
WHERE t0.FID IN ({0})
|
||||||
|
""".format(",".join(idList))
|
||||||
|
dataList = DBServiceHelper.ExecuteDynamicObject(this.Context, sql);
|
||||||
|
if dataList != None and len(dataList) > 0:
|
||||||
|
data = dataList[0]
|
||||||
|
isPreShipment = False;
|
||||||
|
if data["累计核销金额"] >= data["款到发货应收金额"]:
|
||||||
|
isPreShipment = False;
|
||||||
|
else:
|
||||||
|
isPreShipment = True;
|
||||||
|
return;
|
||||||
|
|
||||||
@@ -49,6 +49,9 @@ namespace Pilot_KD_Parino.Sal_Order
|
|||||||
|
|
||||||
var FEntity = this.View.Model.DataObject;
|
var FEntity = this.View.Model.DataObject;
|
||||||
BillObj = FEntity;
|
BillObj = FEntity;
|
||||||
|
//var sdsas = JsonHelper.ToJson(BillObj);
|
||||||
|
//Logger.Error("销售出库单对象", sdsas, new Exception());
|
||||||
|
|
||||||
var id = FEntity["id"];
|
var id = FEntity["id"];
|
||||||
fid = Convert.ToString(id);
|
fid = Convert.ToString(id);
|
||||||
string formid = FEntity["FFormId"].ToString();
|
string formid = FEntity["FFormId"].ToString();
|
||||||
@@ -147,6 +150,7 @@ namespace Pilot_KD_Parino.Sal_Order
|
|||||||
result = Invoke("PUR_PurchaseOrder", "PUR_ReceiveBill", tempFid.ToString(), "7cd93c259999489c97798063f2f7bd70", ref stockId,"收料通知单");
|
result = Invoke("PUR_PurchaseOrder", "PUR_ReceiveBill", tempFid.ToString(), "7cd93c259999489c97798063f2f7bd70", ref stockId,"收料通知单");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
if (result != null)
|
if (result != null)
|
||||||
{
|
{
|
||||||
sheet = result.SuccessDataEnity.FirstOrDefault();
|
sheet = result.SuccessDataEnity.FirstOrDefault();
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user