Files
GateDge2023_ljy/14.宝锐/GZ.LJY000.Biori/UHIK_PRD_PACKAGE_INSTOCK/BillEventPlugInEx.py
PastSaid 9725ab5376 a
2024-12-05 15:39:19 +08:00

99 lines
4.4 KiB
Python

import clr
clr.AddReference("System")
clr.AddReference("System.Xml")
clr.AddReference("Kingdee.BOS")
clr.AddReference("Kingdee.BOS.Core")
clr.AddReference("Kingdee.BOS.DataEntity")
clr.AddReference("Kingdee.BOS.App")
clr.AddReference("Kingdee.BOS.Contracts")
clr.AddReference("Kingdee.BOS.ServiceHelper")
from Kingdee.BOS import *
from Kingdee.BOS.Contracts import *
from Kingdee.BOS.Core import *
from Kingdee.BOS.Core.List import *
from Kingdee.BOS.Core.DynamicForm.PlugIn import *
from Kingdee.BOS.Core.DynamicForm.PlugIn.Args import *
from Kingdee.BOS.Core.Metadata.EntityElement import *
from Kingdee.BOS.Core.Bill import *
from Kingdee.BOS.Core.Metadata import *
from Kingdee.BOS.Orm.DataEntity import *
from Kingdee.BOS.Util import *
from Kingdee.BOS.Core.Util import *
from System import *
from System.Xml import *
from System.ComponentModel import *
from System.Collections.Generic import *
from System.Text import*
from Kingdee.BOS.ServiceHelper import *
def BarItemClick(e):
# 扫码校验
if e.BarItemKey.Equals("tbScanVerify"):
# dynamicFormShowParameter = DynamicFormShowParameter();
# dynamicFormShowParameter.FormId = "sfsf_SCJHZQLKUAIZHANTIE";#动态表单标识
# this.View.ShowForm(dynamicFormShowParameter,lambda x: SetModel(x));
billObj = this.View.Model.DataObject;
# raise Exception(JsonUtil.Serialize(billObj))
billId = billObj["Id"]
FFormId = billObj["FFormId"]
BillType_Id = billObj["FBillTypeID_Id"]
DocumentStatus = billObj["DocumentStatus"]
#扫码校验表单
billShowParameter = DynamicFormShowParameter();
billShowParameter.FormId = "k00200f2a265c40829466f120ef3accd6";
billShowParameter.ParentPageId =this.View.PageId;
# billShowParameter.OpenStyle.ShowType = ShowType.Modal;
billShowParameter.CustomParams.Add("isFromBill", "1");
billShowParameter.CustomParams.Add("FFormId", FFormId);
billShowParameter.CustomParams.Add("billId", str(billId));
billShowParameter.CustomParams.Add("billTypeId", BillType_Id);
allRowCollection = ListSelectedRowCollection()
entity = billObj["FEntity"]
if entity != None and entity.Count > 0:
for item in entity:
row = ListSelectedRow(str(billId) , str(item["Id"]), item["Seq"] , "")
row.FieldValues.Add("FMaterialId_Id",str(item["FMaterialId_Id"]))
row.FieldValues.Add("FLot_Id",str(item["FLot_Id"]))
row.FieldValues.Add("FQty",str(item["FQty"]))
row.FieldValues.Add("FUnitID_Id",str(item["FUnitID_Id"]))
row.FieldValues.Add("FStockId_Id",str(item["FStockId_Id"]))
row.FieldValues.Add("FStockLocId_Id",str(item["FStockLocId_Id"]))
allRowCollection.Add(row)
billShowParameter.CustomComplexParams.Add("SelectedRows", allRowCollection);
this.View.ShowForm(billShowParameter);
return;
# 条码打印
if e.BarItemKey.Equals("tbBarCodePrintEx"):
# dynamicFormShowParameter = DynamicFormShowParameter();
# dynamicFormShowParameter.FormId = "sfsf_SCJHZQLKUAIZHANTIE";#动态表单标识
# this.View.ShowForm(dynamicFormShowParameter,lambda x: SetModel(x));
billObj = this.View.Model.DataObject;
billId = billObj["Id"]
FFormId = billObj["FFormId"]
allRowCollection = ListSelectedRowCollection()
allRowCollection.Add(ListSelectedRow(str(billId),None,0,FFormId))
# raise Exception(JsonUtil.Serialize(allRowCollection))
billShowParameter = BillShowParameter();
billShowParameter.FormId = "UHIK_BAR_BarCodePrint";
billShowParameter.ParentPageId = this.View.PageId;
# billShowParameter.OpenStyle.ShowType = ShowType.Modal;
billShowParameter.CustomParams.Add("isFromBill", "1");
billShowParameter.CustomParams.Add("SourceFormId", FFormId);
billShowParameter.CustomParams.Add("SourceId", str(billId));
billShowParameter.CustomParams.Add("RuleId", str(1004002));
billShowParameter.CustomParams.Add("SelectedRows", JsonUtil.Serialize(allRowCollection))
#单据内码
# billShowParameter.PKey = str(this.View.Model.DataObject["Id"])
billShowParameter.Status = OperationStatus.ADDNEW
this.View.ShowForm(billShowParameter);
return;