def BeforeF7Select(e):
if e.FieldKey.lower() == "FComContractNo".lower() :
showParam = ListShowParameter()
showParam.Context = this.Context
showParam.FormId = "BHD_IC_ImpContract"
showParam.IsShowApproved = True
showParam.ParentPageId = this.View.PageId
showParam.MultiSelect = False
showParam.PermissionItemId = PermissionConst.View
showParam.OpenStyle.ShowType = ShowType.Modal
showParam.IsLookUp = True
showParam.PageId = Guid.NewGuid().ToString()
this.View.ShowForm(showParam, lambda results: SetValue(results))
def SetValue(results):
if results.ReturnData != None:
billNo = results.ReturnData[0].BillNo
sql = """
SELECT HEAD.FID,
GOOD.FEntryID,
PAY.FEntryID,
HEAD.FORDERBILLNO,
GOOD.FMATERIALID,
PAY.FRAPSTYLEID,
HEAD.FBUYERID,
HEAD.FSUMAMT,
HEAD.FCURRENCYID
FROM TP_IS_ImpContract HEAD
INNER JOIN TP_IS_ImpGoodsEntry GOOD ON HEAD.FID = GOOD.FID
INNER JOIN TP_IS_ImpRapEntry PAY ON HEAD.FID = PAY.FID
WHERE HEAD.FBILLNO = '{0}'
""".format(billNo)
DynmObjClt = DBUtils.ExecuteDynamicObject(this.Context, sql)
this.Model.SetValue("FExContractId", DynmObjClt[0]["FORDERBILLNO"])
this.Model.SetValue("FPurPerson", DynmObjClt[0]["FBUYERID"])
this.Model.SetValue("FRapStyleId", DynmObjClt[0]["FRAPSTYLEID"])
this.Model.SetValue("FMeterialId", DynmObjClt[0]["FMATERIALID"])
this.Model.SetValue("FInvoiceAmount", DynmObjClt[0]["FSUMAMT"])
this.Model.SetValue("FDocumentAmount", DynmObjClt[0]["FSUMAMT"])
this.Model.SetValue("FInvoiceBillCurId", DynmObjClt[0]["FCURRENCYID"])
this.Model.SetValue("FComContractNo", results.ReturnData[0].BillNo)
else:
this.View.ShowMessage("请选择公司合同号")