123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750 |
- <?xml version="1.0" encoding="utf-8" ?>
- <Forms>
- <Form Name="FrmProductOnTheWay">
- <Client>
- <Events>
- <Load>
- <![CDATA[
- @Title="在途库存";
- GetSchema();
- ChangeMode("Search");
- dgProduct.NoMember="No_OnShipProduct";
- ]]>
- </Load>
- <Closing>
- ;
- </Closing>
- <Closed>
- ;
- </Closed>
- </Events>
- <Mode>
- <Search>
- <Lable name="Search" />
- </Search>
- <New>
- <Lable name="New" />
- </New>
- <View>
- <Lable name="View" />
- </View>
- <Modify>
- <Lable name="Modify" />
- </Modify>
- </Mode>
- <Controls>
- <IKTextButton name="tbNo" DataSource="OnShip.EncasementNo_OnShip">
- <Events>
- <Enter>
- <![CDATA[
- if(tbNo.ReadOnly == false)
- {
- if(tbNo.CValue != StringEmpty())
- {
- UpdateForm(false, "");
- if(Search("SearchOnShipWithNo", tbNo.CValue))
- {
- ChangeMode("View");
- }
- else
- {
- if(GetRight(@Title,"新增"))
- ChangeMode("New");
- else
- MessageBox("您没有新增在途库存的权限!",@Title);
- }
- }
- else
- {
- MessageBox("请输入装箱单号!",@Title);
- }
- }
- ]]>
- </Enter>
- <Click>
- @Temp = ShowSearchBox("OnShipSearch","NODEPOT","tbNo", tbNo.CValue);
- if(@Temp != StringEmpty())
- {
- tbNo.CValue = @Temp;
- UpdateForm(false, "");
- if(Search("SearchOnShipWithNo", tbNo.CValue))
- {
- ChangeMode("View");
- }
- }
- </Click>
- </Events>
- </IKTextButton>
- <IKDataTimePicker name="dtDelivery" DataSource="OnShip.DeliveryDate_OnShip" />
- <IKDataTimePicker name="dtArrival" DataSource="OnShip.ArrivalDate_OnShip" />
- <IKTextBox name="txtInvoiceNo" DataSource="OnShip.InvoiceNo_OnShip"/>
- <IKDataGridEx name="dgProduct" DataSource="OnShipProduct" TableStyleIndex="0">
- <DataColumn Index="0" DataSource="OnShipProduct.No_OnShipProduct" />
- <DataColumn Index="1" DataSource="OnShipProduct.No_FromBill" />
- <DataColumn Index="2" DataSource="OnShipProduct.No_FromBillProduct" />
- <DataColumn Index="3" DataSource="OnShipProduct.No_Product" />
- <DataColumn Index="4" DataSource="OnShipProduct.Name_Product" />
- <DataColumn Index="5" DataSource="OnShipProduct.Quantity_OnShipProduct" />
- <DataColumn Index="6" DataSource="OnShipProduct.Quantity_Order" />
- <DataColumn Index="7" DataSource="OnShipProduct.Quantity_InDepotBillProduct" />
- <DataColumn Index="8" DataSource="OnShipProduct.Quantity_EndCase" />
- <DataColumn Index="9" DataSource="OnShipProduct.Quantity_OnShip" />
- </IKDataGridEx>
- <IKFormToolBar name="toolBar">
- <Events>
- <ClickFirst>
- <!--if(CreateThread("Search","SearchOnShipFirst", tbNo.CValue))
- {
- ChangeMode("View");
- }
- MessageBox("thread ok");-->
- if(Search("SearchOnShipFirst"))
- {
- ChangeMode("View");
- }
- </ClickFirst>
- <ClickPrev>
- if(Search("SearchOnShipPrevious", tbNo.CValue))
- {
- ChangeMode("View");
- }
- </ClickPrev>
- <ClickNext>
- if(Search("SearchOnShipNext", tbNo.CValue))
- {
- ChangeMode("View");
- }
- </ClickNext>
- <ClickLast>
- if(Search("SearchOnShipLast"))
- {
- ChangeMode("View");
- }
- </ClickLast>
- <ClickNew>
- ;
- </ClickNew>
- <ClickEmpty>
- ChangeMode("Search");
- </ClickEmpty>
- <ClickSubmit>
- <Lable name="SubmitButtonClick" />
- </ClickSubmit>
- <ClickModify>
- ChangeMode("Modify");
- </ClickModify>
- <ClickDelete>
- Delete(); ChangeMode("Search");
- </ClickDelete>
- <ClickPrint>
- PrintReport();
- </ClickPrint>
- <ClickAudit>
- ;
- </ClickAudit>
- <ClickUnAudit>
- ;
- </ClickUnAudit>
- <ClickImport>
- ;
- </ClickImport>
- <ClickExport>
- ;
- </ClickExport>
- <ClickClose>
- ;
- </ClickClose>
- <ClickExpand>
- if(toolBar.ExpandForm==true)
- {
- pnRight.Visible=true;<!--PanelRight is not existed-->
- }
- else
- {
- pnRight.Visible=false;
- }
- </ClickExpand>
- <ClickImportItem>
- <![CDATA[
- if((@Status == 1 || @Status == 3) && toolBar.MenuItemText=="采购订单")
- {
- if(Search("SearchContr"))
- {
- ShowSearchBox("ImportPurchaseOrderBillControl","BILLCONVERT","#OnShipProduct.No_FromBill","采购订单");
- }
- else
- {
- ShowSearchBox("ImportPurchaseOrderBillUnControl","BILLCONVERT");
- }
- }
- ]]>
- <!--使用前先访问ToolBar的MenuItemText属性以确定选中的是那一项-->
- </ClickImportItem>
- </Events>
- </IKFormToolBar>
- </Controls>
- <Tables>
- <Table name="OnShipProduct">
- <Events>
- <ColumnsChanged>
- <No_FromBill>
- if(!Equals(#OnShipProduct.No_FromBill,"")&&!Equals(#OnShipProduct.No_FromBillProduct,""))
- {
- if(Search("SearchPurchaseOrderBillProduct",#OnShipProduct.No_FromBill,#OnShipProduct.No_FromBillProduct))
- {
- #OnShipProduct.ID_Product=#PurchaseOrderBillProduct.ID_Product;
- #OnShipProduct.ID_PurchaseSourceBillProduct=#PurchaseOrderBillProduct.ID_PurchaseSourceBillProduct;
- #OnShipProduct.No_Product=#PurchaseOrderBillProduct.No_Product;
- #OnShipProduct.Name_Product=#PurchaseOrderBillProduct.Name_Product;
- #OnShipProduct.Quantity_OnShipProduct=#PurchaseOrderBillProduct.Quantity_Order-#PurchaseOrderBillProduct.Quantity_InDepot-#PurchaseOrderBillProduct.Quantity_EndCase-#PurchaseOrderBillProduct.Quantity_OnShip;
- #OnShipProduct.Quantity_Order=#PurchaseOrderBillProduct.Quantity_Order;
- #OnShipProduct.Quantity_InDepotBillProduct=#PurchaseOrderBillProduct.Quantity_InDepot;
- #OnShipProduct.Quantity_EndCase=#PurchaseOrderBillProduct.Quantity_EndCase;
- #OnShipProduct.Quantity_OnShip=#PurchaseOrderBillProduct.Quantity_OnShip;
- }
- else
- {
- #OnShipProduct.ID_Product=GuidEmpty();
- #OnShipProduct.ID_PurchaseSourceBillProduct=GuidEmpty();
- #OnShipProduct.No_Product="";
- #OnShipProduct.Name_Product="";
- #OnShipProduct.Quantity_OnShipProduct=0;
- #OnShipProduct.Quantity_Order=0;
- #OnShipProduct.Quantity_InDepotBillProduct=0;
- #OnShipProduct.Quantity_EndCase=0;
- #OnShipProduct.Quantity_OnShip=0;
- }
- }
- </No_FromBill>
- <No_FromBillProduct>
- if(!Equals(#OnShipProduct.No_FromBill,"")&&!Equals(#OnShipProduct.No_FromBillProduct,""))
- {
- if(Search("SearchPurchaseOrderBillProduct",#OnShipProduct.No_FromBill,#OnShipProduct.No_FromBillProduct))
- {
- #OnShipProduct.ID_Product=#PurchaseOrderBillProduct.ID_Product;
- #OnShipProduct.ID_PurchaseSourceBillProduct=#PurchaseOrderBillProduct.ID_PurchaseSourceBillProduct;
- #OnShipProduct.No_Product=#PurchaseOrderBillProduct.No_Product;
- #OnShipProduct.Name_Product=#PurchaseOrderBillProduct.Name_Product;
- #OnShipProduct.Quantity_OnShipProduct=#PurchaseOrderBillProduct.Quantity_Order-#PurchaseOrderBillProduct.Quantity_InDepot-#PurchaseOrderBillProduct.Quantity_EndCase-#PurchaseOrderBillProduct.Quantity_OnShip;
- #OnShipProduct.Quantity_Order=#PurchaseOrderBillProduct.Quantity_Order;
- #OnShipProduct.Quantity_InDepotBillProduct=#PurchaseOrderBillProduct.Quantity_InDepot;
- #OnShipProduct.Quantity_EndCase=#PurchaseOrderBillProduct.Quantity_EndCase;
- #OnShipProduct.Quantity_OnShip=#PurchaseOrderBillProduct.Quantity_OnShip;
- }
- else
- {
- #OnShipProduct.ID_Product=GuidEmpty();
- #OnShipProduct.ID_PurchaseSourceBillProduct=GuidEmpty();
- #OnShipProduct.No_Product="";
- #OnShipProduct.Name_Product="";
- #OnShipProduct.Quantity_OnShipProduct=0;
- #OnShipProduct.Quantity_Order=0;
- #OnShipProduct.Quantity_InDepotBillProduct=0;
- #OnShipProduct.Quantity_EndCase=0;
- #OnShipProduct.Quantity_OnShip=0;
- }
- }
- </No_FromBillProduct>
- </ColumnsChanged>
- </Events>
- </Table>
- </Tables>
- <LockInfomation LockID="ID_OnShip" LockNO="EncasementNo_OnShip" LockSearchFunction="SearchOnShipWithNo"/>
- <ChildForms>
- <ChildForm name="OnShipSearch" DataSource="OnShip" SearchFunction="SearchAllOnShip" SearchFunctionByNo="SearchOnShipWithNo" MappingName="装箱单号">
- <DataColumn Index="0" MappingName="#OnShip.EncasementNo_OnShip" HeaderText="装箱单号" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="1" MappingName="#OnShip.DeliveryDate_OnShip" HeaderText="发货日期" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
- </ChildForm>
- <ChildForm name="ImportPurchaseOrderBillControl" >
- <DataGridIndex DataSource="PurchaseOrderBill" SearchFunction="SearchAllPurchaseOrderBill" SearchFunctionByNo="" MappingName="" ReturnDataSource="OnShipProduct">
- <DataColumn Index="0" MappingName="#PurchaseOrderBill.No_PurchaseOrderBill" HeaderText="单据编号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" ReturnMappingName="#OnShipProduct.No_FromBill"/>
- <DataColumn Index="1" MappingName="#PurchaseOrderBill.Date_PurchaseOrderBill" HeaderText="制单日期" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
- <DataColumn Index="2" MappingName="#PurchaseOrderBill.No_Supplier" HeaderText="供应商编号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="parent"/>
- <DataColumn Index="3" MappingName="#PurchaseOrderBill.ShortName_Customer" HeaderText="供应商简称" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
- <DataColumn Index="4" MappingName="#PurchaseOrderBill.State_PurchaseOrderBill" HeaderText="单据状态" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
- <DataColumn Index="5" MappingName="#PurchaseOrderBill.Name_Location" HeaderText="到货仓库" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="parent" />
- </DataGridIndex>
- <DataGridIndex DataSource="PurchaseOrderBillProduct" SearchFunction="SearchAllPurchaseOrderBillProduct" SearchFunctionByNo="" MappingName="">
- <DataColumn Index="0" MappingName="#PurchaseOrderBillProduct.No_Product" HeaderText="产品编号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
- <DataColumn Index="1" MappingName="#PurchaseOrderBillProduct.No_PurchaseOrderBillProduct" HeaderText="产品序号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" ReturnMappingName="#OnShipProduct.No_FromBillProduct"/>
- <DataColumn Index="2" MappingName="#PurchaseOrderBillProduct.Name_Product" HeaderText="产品名称" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
- <DataColumn Index="3" MappingName="#PurchaseOrderBillProduct.Quantity_PurchaseOrderBillProduct" HeaderText="数量" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" Format="F2"/>
- </DataGridIndex>
- </ChildForm>
- <ChildForm name="ImportPurchaseOrderBillUnControl" >
- <DataGridIndex DataSource="PurchaseOrderBill" SearchFunction="SearchAllPurchaseOrderBill" SearchFunctionByNo="" MappingName="" ReturnDataSource="OnShipProduct">
- <DataColumn Index="0" MappingName="#PurchaseOrderBill.No_PurchaseOrderBill" HeaderText="单据编号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" ReturnMappingName="#OnShipProduct.No_FromBill"/>
- <DataColumn Index="1" MappingName="#PurchaseOrderBill.Date_PurchaseOrderBill" HeaderText="制单日期" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
- <DataColumn Index="2" MappingName="#PurchaseOrderBill.No_Supplier" HeaderText="供应商编号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="parent"/>
- <DataColumn Index="3" MappingName="#PurchaseOrderBill.ShortName_Customer" HeaderText="供应商简称" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
- <DataColumn Index="4" MappingName="#PurchaseOrderBill.State_PurchaseOrderBill" HeaderText="单据状态" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
- <DataColumn Index="5" MappingName="#PurchaseOrderBill.Name_Location" HeaderText="到货仓库" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="parent" />
- </DataGridIndex>
- <DataGridIndex DataSource="PurchaseOrderBillProduct" SearchFunction="SearchAllPurchaseOrderBillProduct" SearchFunctionByNo="" MappingName="">
- <DataColumn Index="0" MappingName="#PurchaseOrderBillProduct.No_Product" HeaderText="产品编号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
- <DataColumn Index="1" MappingName="#PurchaseOrderBillProduct.No_PurchaseOrderBillProduct" HeaderText="产品序号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" ReturnMappingName="#OnShipProduct.No_FromBillProduct"/>
- <DataColumn Index="2" MappingName="#PurchaseOrderBillProduct.Name_Product" HeaderText="产品名称" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
- <DataColumn Index="3" MappingName="#PurchaseOrderBillProduct.Quantity_PurchaseOrderBillProduct" HeaderText="数量" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" Format="F2"/>
- </DataGridIndex>
- </ChildForm>
- </ChildForms>
- </Client>
- <Server>
- <Tables>
- <Table name="OnShip" Type="Parent">
- <GetSchema CmdType="Text" CmdText=" SELECT TOP 0 * FROM OnShip "/>
- <New CmdType="Text" CmdText=" INSERT INTO OnShip(ID_OnShip,EncasementNo_OnShip,DeliveryDate_OnShip,InvoiceNo_OnShip,ArrivalDate_OnShip)
- VALUES(@ID_OnShip,@EncasementNo_OnShip,@DeliveryDate_OnShip,@InvoiceNo_OnShip,@ArrivalDate_OnShip)" >
- <Params>
- <Param name="@ID_OnShip" type="OnShip.ID_OnShip" sourceColumn="ID_OnShip" />
- <Param name="@EncasementNo_OnShip" type="OnShip.EncasementNo_OnShip" sourceColumn="EncasementNo_OnShip" />
- <Param name="@DeliveryDate_OnShip" type="OnShip.DeliveryDate_OnShip" sourceColumn="DeliveryDate_OnShip" />
- <Param name="@InvoiceNo_OnShip" type="OnShip.InvoiceNo_OnShip" sourceColumn="InvoiceNo_OnShip" />
- <Param name="@ArrivalDate_OnShip" type="OnShip.ArrivalDate_OnShip" sourceColumn="ArrivalDate_OnShip" />
- </Params>
- </New>
- <Update CmdType="Text" CmdText="UPDATE OnShip SET EncasementNo_OnShip=@EncasementNo_OnShip,DeliveryDate_OnShip=@DeliveryDate_OnShip,InvoiceNo_OnShip=@InvoiceNo_OnShip,ArrivalDate_OnShip=@ArrivalDate_OnShip
- WHERE ID_OnShip=@ID_OnShip">
- <Params>
- <Param name="@ID_OnShip" type="OnShip.ID_OnShip" sourceColumn="ID_OnShip" />
- <Param name="@EncasementNo_OnShip" type="OnShip.EncasementNo_OnShip" sourceColumn="EncasementNo_OnShip" />
- <Param name="@DeliveryDate_OnShip" type="OnShip.DeliveryDate_OnShip" sourceColumn="DeliveryDate_OnShip" />
- <Param name="@InvoiceNo_OnShip" type="OnShip.InvoiceNo_OnShip" sourceColumn="InvoiceNo_OnShip" />
- <Param name="@ArrivalDate_OnShip" type="OnShip.ArrivalDate_OnShip" sourceColumn="ArrivalDate_OnShip" />
- </Params>
- </Update>
- <Delete CmdType="Text" CmdText="
- DECLARE @ID_PurchaseSourceBillProduct UNIQUEIDENTIFIER
- DECLARE @Quantity_OnShipProduct DECIMAL(14,4)
- DECLARE cur CURSOR FOR SELECT ID_PurchaseSourceBillProduct,Quantity_OnShipProduct
- FROM OnShipProduct WHERE ID_OnShip=@ID_OnShip
- OPEN cur
- FETCH NEXT FROM cur INTO @ID_PurchaseSourceBillProduct,@Quantity_OnShipProduct
- WHILE @@FETCH_STATUS=0
- BEGIN
- UPDATE PurchaseSourceBillProduct SET Quantity_OnShip=Quantity_OnShip-@Quantity_OnShipProduct WHERE ID_PurchaseSourceBillProduct=@ID_PurchaseSourceBillProduct
- FETCH NEXT FROM cur INTO @ID_PurchaseSourceBillProduct,@Quantity_OnShipProduct
- END
-
- DELETE FROM OnShipProduct WHERE ID_OnShip=@ID_OnShip
- DELETE FROM OnShip WHERE ID_OnShip=@ID_OnShip">
- <Params>
- <Param name="@ID_OnShip" type="OnShip.ID_OnShip" sourceColumn="ID_OnShip" />
- </Params>
- </Delete>
- <FKErrorReport ErrorMessage="该装箱单号已被引用,删除失败!"/>
- <UNIQUEErrorReport ErrorMessage="该发票号码已存在,提交失败!"/>
- </Table>
- <Table name="OnShipProduct" Type="Child">
- <GetSchema CmdType="Text" CmdText="
- SELECT TOP 0 OnShipProduct.*,Product.No_Product,Product.Name_Product
- FROM OnShipProduct
- LEFT JOIN Product On Product.ID_Product=OnShipProduct.ID_Product" />
- <New CmdType="Text" CmdText="
- DECLARE @Error NVARCHAR(256)
- IF(@Quantity_OnShipProduct > (SELECT (Quantity_Order-Quantity_InDepot-Quantity_OnShip-Quantity_EndCase)
- FROM PurchaseSourceBillProduct WHERE ID_PurchaseSourceBillProduct=@ID_PurchaseSourceBillProduct))
- BEGIN
- SET @Error='采购订单编号为'+@No_FromBill+'序号为'+@No_FromBillProduct+'的本次在途数量 > 订货数量-已入库数量-强制结案数量-(本订单产品)已在途数量,提交失败!'
- RAISERROR(@Error,16,1)
- RETURN
- END
-
- INSERT INTO OnShipProduct(ID_OnShipProduct,No_OnShipProduct,ID_OnShip,ID_PurchaseSourceBillProduct,No_FromBill,No_FromBillProduct,ID_Product,Quantity_Order,Quantity_OnShipProduct,Quantity_InDepotBillProduct,Quantity_OnShip,Quantity_EndCase)
- VALUES(@ID_OnShipProduct,@No_OnShipProduct,@ID_OnShip,@ID_PurchaseSourceBillProduct,@No_FromBill,@No_FromBillProduct,@ID_Product,@Quantity_Order,@Quantity_OnShipProduct,@Quantity_InDepotBillProduct,@Quantity_OnShip,@Quantity_EndCase)
-
- UPDATE PurchaseSourceBillProduct SET Quantity_OnShip=Quantity_OnShip+@Quantity_OnShipProduct
- WHERE ID_PurchaseSourceBillProduct=@ID_PurchaseSourceBillProduct
- ">
- <Params>
- <Param name="@ID_OnShipProduct" type="OnShipProduct.ID_OnShipProduct" sourceColumn="ID_OnShipProduct" />
- <Param name="@No_OnShipProduct" type="OnShipProduct.No_OnShipProduct" sourceColumn="No_OnShipProduct" />
- <Param name="@ID_OnShip" type="OnShipProduct.ID_OnShip" sourceColumn="ID_OnShip" />
- <Param name="@ID_PurchaseSourceBillProduct" type="OnShipProduct.ID_PurchaseSourceBillProduct" sourceColumn="ID_PurchaseSourceBillProduct" />
- <Param name="@No_FromBill" type="OnShipProduct.No_FromBill" sourceColumn="No_FromBill" />
- <Param name="@No_FromBillProduct" type="OnShipProduct.No_FromBillProduct" sourceColumn="No_FromBillProduct" />
- <Param name="@ID_Product" type="OnShipProduct.ID_Product" sourceColumn="ID_Product" />
- <Param name="@Quantity_Order" type="OnShipProduct.Quantity_Order" sourceColumn="Quantity_Order" />
- <Param name="@Quantity_OnShipProduct" type="OnShipProduct.Quantity_OnShipProduct" sourceColumn="Quantity_OnShipProduct" />
- <Param name="@Quantity_InDepotBillProduct" type="OnShipProduct.Quantity_InDepotBillProduct" sourceColumn="Quantity_InDepotBillProduct" />
- <Param name="@Quantity_OnShip" type="OnShipProduct.Quantity_OnShip" sourceColumn="Quantity_OnShip" />
- <Param name="@Quantity_EndCase" type="OnShipProduct.Quantity_EndCase" sourceColumn="Quantity_EndCase" />
- </Params>
- </New>
- <Update CmdType="Text" CmdText="
- DECLARE @oldValue decimal(14,4)
- DECLARE @Error NVARCHAR(256)
- SELECT @oldValue=Quantity_OnShipProduct From OnShipProduct Where ID_OnShipProduct=@ID_OnShipProduct
- IF((@Quantity_OnShipProduct-@oldValue) > (SELECT (Quantity_Order-Quantity_InDepot-Quantity_OnShip-Quantity_EndCase)
- FROM PurchaseSourceBillProduct WHERE ID_PurchaseSourceBillProduct=@ID_PurchaseSourceBillProduct))
- BEGIN
- SET @Error='采购订单编号为'+@No_FromBill+'序号为'+@No_FromBillProduct+'的本次在途数量 > 订货数量-已入库数量-强制结案数量-(本订单产品)已在途数量,提交失败!'
- RAISERROR(@Error,16,1)
- RETURN
- END
-
- UPDATE OnShipProduct
- SET No_OnShipProduct=@No_OnShipProduct,ID_OnShip=@ID_OnShip,ID_PurchaseSourceBillProduct=@ID_PurchaseSourceBillProduct,No_FromBill=@No_FromBill,No_FromBillProduct=@No_FromBillProduct,
- ID_Product=@ID_Product,Quantity_Order=@Quantity_Order,Quantity_OnShipProduct=@Quantity_OnShipProduct,Quantity_InDepotBillProduct=@Quantity_InDepotBillProduct,Quantity_OnShip=@Quantity_OnShip,Quantity_EndCase=@Quantity_EndCase
- WHERE ID_OnShipProduct=@ID_OnShipProduct
-
- UPDATE PurchaseSourceBillProduct SET Quantity_OnShip=Quantity_OnShip+@Quantity_OnShipProduct-@oldValue
- WHERE ID_PurchaseSourceBillProduct=@ID_PurchaseSourceBillProduct
- ">
- <Params>
- <Param name="@ID_OnShipProduct" type="OnShipProduct.ID_OnShipProduct" sourceColumn="ID_OnShipProduct" />
- <Param name="@No_OnShipProduct" type="OnShipProduct.No_OnShipProduct" sourceColumn="No_OnShipProduct" />
- <Param name="@ID_OnShip" type="OnShipProduct.ID_OnShip" sourceColumn="ID_OnShip" />
- <Param name="@ID_PurchaseSourceBillProduct" type="OnShipProduct.ID_PurchaseSourceBillProduct" sourceColumn="ID_PurchaseSourceBillProduct" />
- <Param name="@No_FromBill" type="OnShipProduct.No_FromBill" sourceColumn="No_FromBill" />
- <Param name="@No_FromBillProduct" type="OnShipProduct.No_FromBillProduct" sourceColumn="No_FromBillProduct" />
- <Param name="@ID_Product" type="OnShipProduct.ID_Product" sourceColumn="ID_Product" />
- <Param name="@Quantity_Order" type="OnShipProduct.Quantity_Order" sourceColumn="Quantity_Order" />
- <Param name="@Quantity_OnShipProduct" type="OnShipProduct.Quantity_OnShipProduct" sourceColumn="Quantity_OnShipProduct" />
- <Param name="@Quantity_InDepotBillProduct" type="OnShipProduct.Quantity_InDepotBillProduct" sourceColumn="Quantity_InDepotBillProduct" />
- <Param name="@Quantity_OnShip" type="OnShipProduct.Quantity_OnShip" sourceColumn="Quantity_OnShip" />
- <Param name="@Quantity_EndCase" type="OnShipProduct.Quantity_EndCase" sourceColumn="Quantity_EndCase" />
- </Params>
- </Update>
- <Delete CmdType="Text" CmdText="
- UPDATE PurchaseSourceBillProduct
- SET Quantity_OnShip=Quantity_OnShip-@Quantity_OnShipProduct
- WHERE ID_PurchaseSourceBillProduct=@ID_PurchaseSourceBillProduct
-
- DELETE FROM OnShipProduct WHERE ID_OnShipProduct=@ID_OnShipProduct
- ">
- <Params>
- <Param name="@ID_OnShipProduct" type="OnShipProduct.ID_OnShipProduct" sourceColumn="ID_OnShipProduct" />
- <Param name="@ID_PurchaseSourceBillProduct" type="OnShipProduct.ID_PurchaseSourceBillProduct" sourceColumn="ID_PurchaseSourceBillProduct" />
- <Param name="@Quantity_OnShipProduct" type="OnShipProduct.Quantity_OnShipProduct" sourceColumn="Quantity_OnShipProduct" />
- </Params>
- </Delete>
- </Table>
- </Tables>
- <Search>
- <SearchAllOnShip CmdType="Text" CmdText="SELECT EncasementNo_OnShip,DeliveryDate_OnShip FROM OnShip ">
- <Tables>
- <Table name="AllOnShip" />
- </Tables>
- </SearchAllOnShip>
- <SearchOnShipWithNo CmdType="Text" CmdText=" DECLARE @ID_OnShip uniqueidentifier
- SELECT * FROM OnShip
- where EncasementNo_OnShip = @EncasementNo_OnShip
- SELECT @ID_OnShip = ID_OnShip FROM OnShip where EncasementNo_OnShip = @EncasementNo_OnShip
- SELECT OnShipProduct.*,Product.No_Product,Product.Name_Product
- FROM OnShipProduct
- JOIN Product On Product.ID_Product=OnShipProduct.ID_Product
- WHERE ID_OnShip=@ID_OnShip
- Order By No_OnShipProduct
- ">
- <Params>
- <Param name="@EncasementNo_OnShip" type="OnShip.EncasementNo_OnShip" Index="0" />
- </Params>
- <Tables>
- <Table name="OnShip" />
- <Table name="OnShipProduct" />
- </Tables>
- </SearchOnShipWithNo>
- <SearchPurchaseOrderBillProduct CmdType="Text" CmdText="
- SELECT PurchaseSourceBillProduct.*,Product.No_Product,Product.Name_Product,Product.ID_Product
- FROM PurchaseOrderBillProduct
- Left Join PurchaseSourceBillProduct ON PurchaseOrderBillProduct.ID_PurchaseOrderBillProduct=PurchaseSourceBillProduct.ID_PurchaseSourceBillProduct
- Join PurchaseOrderBill On PurchaseOrderBill.ID_PurchaseOrderBill=PurchaseOrderBillProduct.ID_PurchaseOrderBill
- Join Product ON Product.ID_Product=PurchaseOrderBillProduct.ID_Product
- WHERE PurchaseOrderBill.ID_Assessor Is Not Null And No_PurchaseOrderBill=@No_PurchaseOrderBill AND No_PurchaseOrderBillProduct=@No_PurchaseOrderBillProduct
- ">
- <Params>
- <Param name="@No_PurchaseOrderBill" type="PurchaseOrderBill.No_PurchaseOrderBill" Index="0" />
- <Param name="@No_PurchaseOrderBillProduct" type="PurchaseOrderBillProduct.No_PurchaseOrderBillProduct" Index="1" />
- </Params>
- <Tables>
- <Table name="PurchaseOrderBillProduct" />
- </Tables>
- </SearchPurchaseOrderBillProduct>
- <SearchPurchaseOrderBill CmdType="Text" CmdText="
- Select ID_Assessor From PurchaseOrderBill
- Where No_PurchaseOrderBill=@No_PurchaseOrderBill
- ">
- <Params>
- <Param name="@No_PurchaseOrderBill" type="PurchaseOrderBill.No_PurchaseOrderBill" Index="0" />
- </Params>
- <Tables>
- <Table name="PurchaseOrderBill" />
- </Tables>
- </SearchPurchaseOrderBill>
- <SearchOnShipFirst CmdType="Text" CmdText=" DECLARE @ID_OnShip UNIQUEIDENTIFIER
- SELECT TOP 1 @ID_OnShip=ID_OnShip FROM OnShip ORDER BY EncasementNo_OnShip
- SELECT * FROM OnShip WHERE ID_OnShip=@ID_OnShip
- SELECT OnShipProduct.*,Product.No_Product,Product.Name_Product
- FROM OnShipProduct JOIN Product ON Product.ID_Product=OnShipProduct.ID_Product
- WHERE ID_OnShip=@ID_OnShip
- Order By No_OnShipProduct">
- <Tables>
- <Table name="OnShip" />
- <Table name="OnShipProduct" />
- </Tables>
- </SearchOnShipFirst>
- <SearchOnShipPrevious CmdType="Text" CmdText=" DECLARE @ID_OnShip UNIQUEIDENTIFIER
- SELECT TOP 1 @ID_OnShip=ID_OnShip FROM OnShip WHERE EncasementNo_OnShip < @EncasementNo_OnShip ORDER BY EncasementNo_OnShip DESC
- SELECT * FROM OnShip WHERE ID_OnShip=@ID_OnShip
- SELECT OnShipProduct.*,Product.No_Product,Product.Name_Product
- FROM OnShipProduct JOIN Product ON Product.ID_Product=OnShipProduct.ID_Product
- WHERE ID_OnShip=@ID_OnShip
- Order By No_OnShipProduct
- ">
- <Params>
- <Param name="@EncasementNo_OnShip" type="OnShip.EncasementNo_OnShip" Index="0" />
- </Params>
- <Tables>
- <Table name="OnShip" />
- <Table name="OnShipProduct" />
- </Tables>
- </SearchOnShipPrevious>
- <SearchOnShipNext CmdType="Text" CmdText=" DECLARE @ID_OnShip UNIQUEIDENTIFIER
- SELECT TOP 1 @ID_OnShip=ID_OnShip FROM OnShip WHERE EncasementNo_OnShip > @EncasementNo_OnShip ORDER BY EncasementNo_OnShip
- SELECT * FROM OnShip WHERE ID_OnShip=@ID_OnShip
- SELECT OnShipProduct.*,Product.No_Product,Product.Name_Product
- FROM OnShipProduct JOIN Product ON Product.ID_Product=OnShipProduct.ID_Product
- WHERE ID_OnShip=@ID_OnShip
- Order By No_OnShipProduct
- ">
- <Params>
- <Param name="@EncasementNo_OnShip" type="OnShip.EncasementNo_OnShip" Index="0" />
- </Params>
- <Tables>
- <Table name="OnShip" />
- <Table name="OnShipProduct" />
- </Tables>
- </SearchOnShipNext>
- <SearchOnShipLast CmdType="Text" CmdText=" DECLARE @ID_OnShip UNIQUEIDENTIFIER
- SELECT TOP 1 @ID_OnShip=ID_OnShip FROM OnShip ORDER BY EncasementNo_OnShip DESC
- SELECT * FROM OnShip WHERE ID_OnShip=@ID_OnShip
- SELECT OnShipProduct.*,Product.No_Product,Product.Name_Product
- FROM OnShipProduct JOIN Product ON Product.ID_Product=OnShipProduct.ID_Product
- WHERE ID_OnShip=@ID_OnShip
- Order By No_OnShipProduct
- ">
- <Tables>
- <Table name="OnShip" />
- <Table name="OnShipProduct" />
- </Tables>
- </SearchOnShipLast>
- <SearchContr CmdType="Text" CmdText=" SELECT SystemSetting.StockAndInDepot_SystemSetting FROM SystemSetting WHERE SystemSetting.StockAndInDepot_SystemSetting = 1">
- <Tables>
- <Table name="SystemOutIn" />
- </Tables>
- </SearchContr>
- <SearchAllPurchaseOrderBill CmdType="Text" CmdText="Select PurchaseOrderBill.ID_PurchaseOrderBill,PurchaseOrderBill.No_PurchaseOrderBill,PurchaseOrderBill.Date_PurchaseOrderBill,Supplier.No_Supplier,Supplier.ShortName_Supplier,Case When PurchaseOrderBill.ID_Assessor is null Then '未审核' Else '已审核' End As State_PurchaseOrderBill,Location.Name_Location From PurchaseOrderBill
- Inner Join Supplier On PurchaseOrderBill.ID_Supplier = Supplier.ID_Supplier
- Inner Join Location On Location.ID_Location = PurchaseOrderBill.ID_Location" >
- <Tables>
- <Table name="AllSaleOutDepotBill" />
- </Tables>
- </SearchAllPurchaseOrderBill>
- <SearchAllPurchaseOrderBillProduct CmdType="Text" CmdText="Select Product.No_Product,PurchaseOrderBillProduct.No_PurchaseOrderBillProduct,Product.Name_Product,PurchaseOrderBillProduct.Quantity_PurchaseOrderBillProduct,PurchaseOrderBillProduct.UnitPrice_PurchaseOrderBillProduct From PurchaseOrderBillProduct
- Inner Join Product On Product.ID_Product = PurchaseOrderBillProduct.ID_Product
- Inner Join PurchaseOrderBill On PurchaseOrderBill.ID_PurchaseOrderBill = PurchaseOrderBillProduct.ID_PurchaseOrderBill" >
- <Tables>
- <Table name="AllSaleOutDepotBillProduct" />
- </Tables>
- </SearchAllPurchaseOrderBillProduct>
- <SearchSupplier CmdType="Text" CmdText="Select No_Supplier From PurchaseOrderBill
- Inner Join Supplier On Supplier.ID_Supplier = PurchaseOrderBill.ID_Supplier
- Where No_PurchaseOrderBill = @No_PurchaseOrderBill">
- <Params>
- <Param name="@No_PurchaseOrderBill" type="PurchaseOrderBill.No_PurchaseOrderBill" Index="0" />
- </Params>
- <Tables>
- <Table name="Supplier" />
- </Tables>
- </SearchSupplier>
- </Search>
- </Server>
- <Lables>
- <Search>
- Empty();
- NewInstance();
- tbNo.ReadOnly=false;
- dtArrival.Enabled=false;
- txtInvoiceNo.ReadOnly=true;
- dgProduct.ReadOnly=true;
- toolBar.EnableSubmit=false;
- toolBar.EnableModify=false;
- toolBar.EnableDelete=false;
- toolBar.EnablePrint=false;
- toolBar.EnableImport= false;
- UpdateForm(true, "");
- tbNo.Focus();
- @Status=0;
- </Search>
- <New>
- Empty();
- NewInstance();
- tbNo.ReadOnly=true;
- dtArrival.Enabled=true;
- txtInvoiceNo.ReadOnly=false;
- dgProduct.ReadOnly=false;
- dgProduct.SetColumnReadOnly(1, false);
- dgProduct.SetColumnReadOnly(2, false);
- dgProduct.AllowNew(true);
- #OnShip.EncasementNo_OnShip=tbNo.CValue;
- #OnShip.ID_OnShip=NewGuid();
- toolBar.EnableSubmit=GetRight(@Title,"新增");
- toolBar.EnableModify=false;
- toolBar.EnableDelete=false;
- toolBar.EnablePrint=false;
- toolBar.EnableImport= true;
- UpdateForm(true, "");
- txtInvoiceNo.Focus();
- @Status=1;
- </New>
- <View>
- tbNo.ReadOnly=true;
- dtArrival.Enabled=false;
- txtInvoiceNo.ReadOnly=true;
- dgProduct.ReadOnly=true;
- toolBar.EnableSubmit=false;
- toolBar.EnableModify=GetRight(@Title,"修改");
- toolBar.EnableDelete=GetRight(@Title,"删除");
- toolBar.EnablePrint=true;
- toolBar.EnableImport= false;
- UpdateForm(true, "");
- @Status=2;
- </View>
- <Modify>
- tbNo.ReadOnly=true;
- dtArrival.Enabled=true;
- txtInvoiceNo.ReadOnly=true;
- dgProduct.ReadOnly=false;
- dgProduct.SetColumnReadOnly(1,true);
- dgProduct.SetColumnReadOnly(2,true);
- dgProduct.AllowNew(false);
- toolBar.EnableSubmit=GetRight(@Title,"新增");
- toolBar.EnableModify=false;
- toolBar.EnableDelete=false;
- toolBar.EnablePrint=false;
- toolBar.EnableImport= false;
- UpdateForm(true, "");
- txtInvoiceNo.Focus();
- @Status=3;
- </Modify>
- <SubmitButtonClick>
- <![CDATA[
- if(txtInvoiceNo.CValue=="")
- {
- MessageBox("请输入发票号码!",@Title);
- txtInvoiceNo.Focus();
- return;
- }
- if(RowCount("#OnShipProduct")==0)
- {
- MessageBox("请输入订单在途产品!",@Title);
- dgProduct.Focus();
- return;
- }
- UpdateForm(false, "");
- SuspendLayout();
- for(@i=0;@i<RowCount("#OnShipProduct");@i++)
- {
- SetPosition("#OnShipProduct",@i);
- if(Equals(#OnShipProduct.No_FromBill,""))
- {
- MessageBox("采购订单编号不能为空!",@Title);
- dgProduct.CurrentRowIndex=@i;
- dgProduct.Focus();
- ResumeLayout();
- return;
- }
- else
- {
- if(Search("SearchPurchaseOrderBill",#OnShipProduct.No_FromBill))
- {
- if(Equals(#PurchaseOrderBill.ID_Assessor,DBNull()))
- {
- MessageBox("该采购订单未经审核!",@Title);
- dgProduct.CurrentRowIndex=@i;
- dgProduct.Focus();
- ResumeLayout();
- return;
- }
- }
- else
- {
- MessageBox("该采购订单不存在!",@Title);
- dgProduct.CurrentRowIndex=@i;
- dgProduct.Focus();
- ResumeLayout();
- return;
- }
- }
- if(Equals(#OnShipProduct.No_FromBillProduct,""))
- {
- MessageBox("采购订单产品序号不能为空!",@Title);
- dgProduct.CurrentRowIndex=@i;
- dgProduct.Focus();
- ResumeLayout();
- return;
- }
- if(Equals(#OnShipProduct.ID_PurchaseSourceBillProduct,GuidEmpty()))
- {
- MessageBox("不存在该采购订单产品!",@Title);
- dgProduct.CurrentRowIndex=@i;
- dgProduct.Focus();
- ResumeLayout();
- return;
- }
- if(#OnShipProduct.Quantity_OnShipProduct<=0)
- {
- MessageBox("本次在途数量必须大于0!",@Title);
- dgProduct.CurrentRowIndex=@i;
- dgProduct.Focus();
- ResumeLayout();
- return;
- }
-
- Search("SearchSupplier",#OnShipProduct.No_FromBill);
- Register_Set("1",#Supplier.No_Supplier);
- for(@j=@i+1;@j<=RowCount("#OnShipProduct")-1;@j=@j+1)
- {
- SetPosition("#OnShipProduct",@j);
- Search("SearchSupplier",#OnShipProduct.No_FromBill);
- if(!Equals(Register_Get("1"),#Supplier.No_Supplier))
- {
- dgProduct.CurrentRowIndex=@j;
- MessageBox("采购订单的供应商不同,提交失败!",@Title);
- dgProduct.CurrentRowIndex=@i;
- dgProduct.Focus();
- ResumeLayout();
- return;
- }
- }
- Register_Remove("1");
-
- SetPosition("#OnShipProduct",@i);
- if(Equals(#OnShipProduct.ID_OnShipProduct,GuidEmpty()))
- {
- #OnShipProduct.ID_OnShipProduct=NewGuid();
- }
- #OnShipProduct.ID_OnShip=#OnShip.ID_OnShip;
-
- }
- ResumeLayout();
- if(@Status==1)
- {
- New();
- }
- else if(@Status==3)
- {
- Update();
- }
- ChangeMode("View");
- ]]>
- </SubmitButtonClick>
- </Lables>
- </Form>
- </Forms>
|