3397 lines
110 KiB
ObjectPascal
3397 lines
110 KiB
ObjectPascal
unit U_ProductOrderAnPai;
|
||
|
||
interface
|
||
|
||
uses
|
||
Windows, Messages, SysUtils, strUtils, Variants, Classes, Graphics, Controls,
|
||
Forms, Dialogs, StdCtrls, ExtCtrls, ComCtrls, ToolWin, cxStyles, cxCustomData,
|
||
cxGraphics, cxFilter, cxData, cxDataStorage, cxEdit, DB, cxDBData, ADODB,
|
||
cxGridCustomPopupMenu, cxGridPopupMenu, cxGridLevel, cxClasses, cxControls,
|
||
cxGridCustomView, cxGridCustomTableView, cxGridTableView, cxGridDBTableView,
|
||
cxGrid, DBClient, cxCheckBox, cxCalendar, cxSplitter, RM_Dataset, RM_System,
|
||
RM_Common, RM_Class, RM_GridReport, RM_e_Xls, Menus, cxPC, BtnEdit, cxTextEdit,
|
||
cxButtonEdit, cxDropDownEdit, MovePanel, cxContainer, cxCurrencyEdit,
|
||
cxLookAndFeels, cxLookAndFeelPainters, cxNavigator, dxSkinsCore, dxSkinBlack,
|
||
dxSkinBlue, dxSkinBlueprint, dxSkinCaramel, dxSkinCoffee, dxSkinDarkRoom,
|
||
dxSkinDarkSide, dxSkinDevExpressDarkStyle, dxSkinDevExpressStyle, dxSkinFoggy,
|
||
dxSkinGlassOceans, dxSkinHighContrast, dxSkiniMaginary, dxSkinLilian,
|
||
dxSkinLiquidSky, dxSkinLondonLiquidSky, dxSkinMcSkin, dxSkinMetropolis,
|
||
dxSkinMetropolisDark, dxSkinMoneyTwins, dxSkinOffice2007Black,
|
||
dxSkinOffice2007Blue, dxSkinOffice2007Green, dxSkinOffice2007Pink,
|
||
dxSkinOffice2007Silver, dxSkinOffice2010Black, dxSkinOffice2010Blue,
|
||
dxSkinOffice2010Silver, dxSkinOffice2013DarkGray, dxSkinOffice2013LightGray,
|
||
dxSkinOffice2013White, dxSkinPumpkin, dxSkinSeven, dxSkinSevenClassic,
|
||
dxSkinSharp, dxSkinSharpPlus, dxSkinSilver, dxSkinSpringTime, dxSkinStardust,
|
||
dxSkinSummer2008, dxSkinTheAsphaltWorld, dxSkinsDefaultPainters,
|
||
dxSkinValentine, dxSkinVS2010, dxSkinWhiteprint, dxSkinXmas2008Blue,
|
||
dxSkinscxPCPainter;
|
||
|
||
type
|
||
TfrmProductOrderAnPai = class(TForm)
|
||
ToolBar1: TToolBar;
|
||
TBPrint: TToolButton;
|
||
TBClose: TToolButton;
|
||
cxGridPopupMenu1: TcxGridPopupMenu;
|
||
ADOQueryCmd: TADOQuery;
|
||
ADOQueryMain: TADOQuery;
|
||
ADOQueryTemp: TADOQuery;
|
||
DataSource1: TDataSource;
|
||
TBExport: TToolButton;
|
||
Order_Main: TClientDataSet;
|
||
RM1: TRMGridReport;
|
||
RMDBMain: TRMDBDataSet;
|
||
RMXLSExport1: TRMXLSExport;
|
||
PopupMenu1: TPopupMenu;
|
||
N2: TMenuItem;
|
||
ToolButton1: TToolButton;
|
||
DataSource2: TDataSource;
|
||
CDS_Sub: TClientDataSet;
|
||
Panel2: TPanel;
|
||
cxGrid2: TcxGrid;
|
||
TV2: TcxGridDBTableView;
|
||
cxGridDBColumn1: TcxGridDBColumn;
|
||
V2Column1: TcxGridDBColumn;
|
||
cxGridLevel1: TcxGridLevel;
|
||
ToolBar2: TToolBar;
|
||
ToolButton2: TToolButton;
|
||
ToolButton3: TToolButton;
|
||
ToolButton5: TToolButton;
|
||
ToolButton6: TToolButton;
|
||
ADOQueryPrint: TADOQuery;
|
||
V2Column2: TcxGridDBColumn;
|
||
V2Column3: TcxGridDBColumn;
|
||
V2Column4: TcxGridDBColumn;
|
||
Panel1: TPanel;
|
||
Label3: TLabel;
|
||
ConNo: TEdit;
|
||
cxGrid4: TcxGrid;
|
||
Tv4: TcxGridDBTableView;
|
||
v4Column1: TcxGridDBColumn;
|
||
v4Column2: TcxGridDBColumn;
|
||
cxGrid4Level1: TcxGridLevel;
|
||
CDS_OrderNo: TClientDataSet;
|
||
DS_OrderNo: TDataSource;
|
||
V2Column5: TcxGridDBColumn;
|
||
V2Column6: TcxGridDBColumn;
|
||
V2Column7: TcxGridDBColumn;
|
||
V2Column8: TcxGridDBColumn;
|
||
V2Column9: TcxGridDBColumn;
|
||
ToolButton4: TToolButton;
|
||
ADOQueryHC: TADOQuery;
|
||
Panel3: TPanel;
|
||
DateTimePicker1: TDateTimePicker;
|
||
BtnEditA1: TBtnEditA;
|
||
ComboBox1: TComboBox;
|
||
BtnEditA2: TBtnEditA;
|
||
Label1: TLabel;
|
||
Label2: TLabel;
|
||
Label4: TLabel;
|
||
Label5: TLabel;
|
||
BtnEditA3: TBtnEditA;
|
||
Label6: TLabel;
|
||
V2Column10: TcxGridDBColumn;
|
||
ToolButton7: TToolButton;
|
||
ToolButton8: TToolButton;
|
||
V2Column11: TcxGridDBColumn;
|
||
BtnEditA4: TBtnEditA;
|
||
Label7: TLabel;
|
||
cxGridPopupMenu2: TcxGridPopupMenu;
|
||
ToolButton9: TToolButton;
|
||
ToolButton10: TToolButton;
|
||
V2Column12: TcxGridDBColumn;
|
||
MovePanel2: TMovePanel;
|
||
Panel4: TPanel;
|
||
ToolBar3: TToolBar;
|
||
ToolButton12: TToolButton;
|
||
cxGrid3: TcxGrid;
|
||
TV3: TcxGridDBTableView;
|
||
V3Column3: TcxGridDBColumn;
|
||
cxGrid3Level1: TcxGridLevel;
|
||
ADORoll: TADOQuery;
|
||
CDS_Roll: TClientDataSet;
|
||
DSRoll: TDataSource;
|
||
V3Column4: TcxGridDBColumn;
|
||
Panel5: TPanel;
|
||
Button1: TButton;
|
||
cxCurrencyEdit1: TcxCurrencyEdit;
|
||
Label9: TLabel;
|
||
Edit1: TcxCurrencyEdit;
|
||
Label8: TLabel;
|
||
CheckBox1: TCheckBox;
|
||
Label10: TLabel;
|
||
Edit2: TEdit;
|
||
V2Column13: TcxGridDBColumn;
|
||
Button2: TButton;
|
||
V3note: TcxGridDBColumn;
|
||
V3Aorddefstr1: TcxGridDBColumn;
|
||
V2C_CodeName: TcxGridDBColumn;
|
||
cxGrid5: TcxGrid;
|
||
TV5: TcxGridDBTableView;
|
||
v1OrderNo: TcxGridDBColumn;
|
||
v1DeliveryDate: TcxGridDBColumn;
|
||
cxGridDBColumn10: TcxGridDBColumn;
|
||
cxGridDBColumn11: TcxGridDBColumn;
|
||
v1FactoryNo1Name: TcxGridDBColumn;
|
||
v1PRTSpec: TcxGridDBColumn;
|
||
v1PRTMF: TcxGridDBColumn;
|
||
v1PRTKZ: TcxGridDBColumn;
|
||
v1Qty1: TcxGridDBColumn;
|
||
cxGridDBColumn12: TcxGridDBColumn;
|
||
v1OrderUnit: TcxGridDBColumn;
|
||
cxGridDBColumn13: TcxGridDBColumn;
|
||
v1PRTUnit: TcxGridDBColumn;
|
||
v1PRTQty: TcxGridDBColumn;
|
||
cxGridDBColumn14: TcxGridDBColumn;
|
||
cxGridDBColumn15: TcxGridDBColumn;
|
||
cxGridDBColumn16: TcxGridDBColumn;
|
||
v1gf: TcxGridDBColumn;
|
||
cxGrid1Level1: TcxGridLevel;
|
||
cxGridDBTableC_Unit: TcxGridDBColumn;
|
||
V5Column1: TcxGridDBColumn;
|
||
V5Column2: TcxGridDBColumn;
|
||
V2Column14: TcxGridDBColumn;
|
||
Label11: TLabel;
|
||
C_CodeName: TEdit;
|
||
Label12: TLabel;
|
||
C_Color: TEdit;
|
||
Label13: TLabel;
|
||
FactoryNoName: TBtnEditA;
|
||
ADOQuery_Tp: TADOQuery;
|
||
Label14: TLabel;
|
||
cxCurrencyEdit2: TcxCurrencyEdit;
|
||
V5Column3: TcxGridDBColumn;
|
||
DateTimePicker2: TDateTimePicker;
|
||
V2Column15: TcxGridDBColumn;
|
||
V2Column16: TcxGridDBColumn;
|
||
Label15: TLabel;
|
||
Label16: TLabel;
|
||
Edit3: TEdit;
|
||
Edit4: TEdit;
|
||
CheckBox_XS: TCheckBox;
|
||
TBfind: TToolButton;
|
||
Label17: TLabel;
|
||
procedure FormDestroy(Sender: TObject);
|
||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||
procedure FormCreate(Sender: TObject);
|
||
procedure TBCloseClick(Sender: TObject);
|
||
procedure TBExportClick(Sender: TObject);
|
||
procedure TBPrintClick(Sender: TObject);
|
||
procedure FormShow(Sender: TObject);
|
||
procedure TBTPClick(Sender: TObject);
|
||
procedure CheckBox1Click(Sender: TObject);
|
||
procedure Tv1StylesGetContentStyle(Sender: TcxCustomGridTableView; ARecord: TcxCustomGridRecord; AItem: TcxCustomGridTableItem; out AStyle: TcxStyle);
|
||
procedure v1DeliveryDateCustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
||
procedure N1Click(Sender: TObject);
|
||
procedure N2Click(Sender: TObject);
|
||
procedure ToolButton1Click(Sender: TObject);
|
||
procedure ToolButton2Click(Sender: TObject);
|
||
procedure ToolButton3Click(Sender: TObject);
|
||
procedure AOrdDefNote12DblClick(Sender: TObject);
|
||
procedure AOrdDefNote7BtnDnClick(Sender: TObject);
|
||
procedure cxTabControl1Change(Sender: TObject);
|
||
procedure ToolButton5Click(Sender: TObject);
|
||
procedure ToolButton6Click(Sender: TObject);
|
||
procedure Tv4DblClick(Sender: TObject);
|
||
procedure V2Column1PropertiesEditValueChanged(Sender: TObject);
|
||
procedure cxGridDBColumn1PropertiesEditValueChanged(Sender: TObject);
|
||
procedure V2Column4PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||
procedure V2Column5PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||
procedure V2Column6PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||
procedure V2Column8PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||
procedure ToolButton4Click(Sender: TObject);
|
||
procedure BtnEditA1BtnClick(Sender: TObject);
|
||
procedure BtnEditA2BtnClick(Sender: TObject);
|
||
procedure BtnEditA3BtnClick(Sender: TObject);
|
||
procedure ToolButton8Click(Sender: TObject);
|
||
procedure ToolButton7Click(Sender: TObject);
|
||
procedure BtnEditA4BtnClick(Sender: TObject);
|
||
procedure V2Column11PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||
procedure ToolButton9Click(Sender: TObject);
|
||
procedure ToolButton10Click(Sender: TObject);
|
||
procedure ToolButton12Click(Sender: TObject);
|
||
procedure TV3CustomDrawIndicatorCell(Sender: TcxGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxCustomGridIndicatorItemViewInfo; var ADone: Boolean);
|
||
procedure Edit1KeyPress(Sender: TObject; var Key: Char);
|
||
procedure cxCurrencyEdit1KeyPress(Sender: TObject; var Key: Char);
|
||
procedure Button1Click(Sender: TObject);
|
||
procedure V2Column13PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||
procedure Button2Click(Sender: TObject);
|
||
procedure V2Column13PropertiesEditValueChanged(Sender: TObject);
|
||
procedure V2C_CodeNamePropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||
procedure V2C_CodeNamePropertiesEditValueChanged(Sender: TObject);
|
||
procedure TV3MouseEnter(Sender: TObject);
|
||
procedure TV2FocusedRecordChanged(Sender: TcxCustomGridTableView; APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean);
|
||
procedure TV5FocusedRecordChanged(Sender: TcxCustomGridTableView; APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean);
|
||
procedure FactoryNoNameBtnClick(Sender: TObject);
|
||
procedure cxCurrencyEdit2KeyPress(Sender: TObject; var Key: Char);
|
||
procedure V2Column14PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||
procedure V2Column14PropertiesEditValueChanged(Sender: TObject);
|
||
procedure TV2CustomDrawIndicatorCell(Sender: TcxGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxCustomGridIndicatorItemViewInfo; var ADone: Boolean);
|
||
procedure V3Column3PropertiesEditValueChanged(Sender: TObject);
|
||
procedure V3Column4PropertiesEditValueChanged(Sender: TObject);
|
||
procedure V3Aorddefstr1PropertiesEditValueChanged(Sender: TObject);
|
||
procedure V3notePropertiesEditValueChanged(Sender: TObject);
|
||
procedure TV5CustomDrawIndicatorCell(Sender: TcxGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxCustomGridIndicatorItemViewInfo; var ADone: Boolean);
|
||
procedure TBfindClick(Sender: TObject);
|
||
procedure CheckBox_XSClick(Sender: TObject);
|
||
private
|
||
DQdate: TDateTime;
|
||
fRoll: Boolean;
|
||
procedure InitGrid();
|
||
procedure InitForm();
|
||
function DelData(): Boolean;
|
||
procedure InitGridFH();
|
||
function SaveData(): Boolean;
|
||
procedure UpdateHC(FFirstNo: string);
|
||
function YFData(): Boolean;
|
||
function DELYFData(): Boolean;
|
||
procedure InitRoll();
|
||
function SaveData10(): Boolean;
|
||
function SaveMJID(): boolean;
|
||
function getPrice(ffactoryName, fP_CodeName, fP_Color, fYFName: string): double;
|
||
{ Private declarations }
|
||
public
|
||
FFInt: Integer;
|
||
{ Public declarations }
|
||
end;
|
||
|
||
var
|
||
frmProductOrderAnPai: TfrmProductOrderAnPai;
|
||
|
||
implementation
|
||
|
||
uses
|
||
U_DataLink, U_OrderInPut, U_Fun, U_ZDYHelp, U_iniParam, U_ZDYHelpSel,
|
||
U_BefChkHX, U_ZdyAttachGYS, U_ZdyAttachCP, U_ClothContractList_Sel;
|
||
|
||
{$R *.dfm}
|
||
function TfrmProductOrderAnPai.getPrice(ffactoryName, fP_CodeName, fP_Color, fYFName: string): double;
|
||
var
|
||
fprice: double;
|
||
begin
|
||
fprice := 0;
|
||
try
|
||
|
||
with ADOQueryTemp do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
SQL.Add(' SELECT Top 1 Price FROM YF_Money_CR A');
|
||
sql.Add(' where factoryName=' + quotedstr(trim(ffactoryName)));
|
||
sql.Add(' and P_CodeName=' + quotedstr(trim(fP_CodeName)));
|
||
sql.Add(' and P_Color=' + quotedstr(trim(fP_Color)));
|
||
sql.Add(' and YFName=' + quotedstr(trim(fYFName)));
|
||
sql.Add(' and CRType=''Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD>Ǽ<EFBFBD>'' ');
|
||
sql.Add(' and price>0 ');
|
||
sql.Add(' order by FillTime desc');
|
||
open;
|
||
end;
|
||
if not ADOQueryTemp.IsEmpty then
|
||
fprice := ADOQueryTemp.fieldbyName('Price').AsFloat;
|
||
finally
|
||
result := fprice;
|
||
end;
|
||
end;
|
||
|
||
function TfrmProductOrderAnPai.SaveMJID(): boolean;
|
||
begin
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
try
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('delete from JYOrder_Sub_AnPai_MX where APTM=''' + Trim(CDS_Roll.fieldbyname('APTM').AsString) + '''');
|
||
execsql;
|
||
end;
|
||
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select * from JYOrder_Sub_AnPai_MX where APTM=''' + Trim(CDS_Roll.fieldbyname('APTM').AsString) + '''');
|
||
Open;
|
||
end;
|
||
|
||
with ADOQueryCmd do
|
||
begin
|
||
append;
|
||
FieldByName('ApId').Value := Trim(CDS_Sub.fieldbyname('apid').AsString);
|
||
FieldByName('ApsubId').Value := CDS_Roll.recNo;
|
||
FieldByName('APTM').Value := Trim(CDS_Roll.fieldbyname('APTM').AsString);
|
||
FieldByName('AOrdQty2').Value := CDS_Roll.fieldbyname('AOrdQty2').AsInteger;
|
||
FieldByName('AOrdQty1').Value := CDS_Roll.fieldbyname('AOrdQty1').AsFloat;
|
||
FieldByName('AOrdQty3').Value := CDS_Roll.fieldbyname('AOrdQty3').AsFloat;
|
||
FieldByName('AorddefNote1').Value := Trim(CDS_Roll.fieldbyname('AorddefNote1').AsString);
|
||
FieldByName('Aorddefstr1').Value := Trim(CDS_Roll.fieldbyname('Aorddefstr1').AsString);
|
||
post;
|
||
end;
|
||
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('update YF_Money_CR SET Qty=(select sum(AOrdQty1) from JYOrder_Sub_AnPai X where X.apid=YF_Money_CR.YFTypeId )');
|
||
sql.Add('where YFTypeId=' + quotedstr(trim(CDS_Roll.fieldbyname('APID').AsString)));
|
||
sql.Add('update YF_Money_CR SET Money=Price*Qty,BBMoney=Price*Qty ');
|
||
sql.Add('where YFTypeId=' + quotedstr(trim(CDS_Roll.fieldbyname('APID').AsString)));
|
||
execsql;
|
||
end;
|
||
|
||
with ADOQueryCmd do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('delete from WFB_MJJY ');
|
||
sql.Add('where MJID=' + quotedstr(trim(CDS_Roll.fieldbyname('APTM').AsString)));
|
||
execsql;
|
||
end;
|
||
if CDS_Roll.FieldByName('AOrdQty3').AsFloat <> 0 then
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('select * from WFB_MJJY ');
|
||
sql.Add('where 1=2 ');
|
||
open;
|
||
append;
|
||
FieldByName('MainId').value := Trim(cds_sub.fieldbyname('mainiD').AsString);
|
||
FieldByName('SubId').value := Trim(cds_sub.fieldbyname('subid').AsString);
|
||
FieldByName('conNo').Value := Trim(cds_sub.fieldbyname('conNo').AsString);
|
||
FieldByName('APId').value := Trim(cds_sub.fieldbyname('apid').AsString);
|
||
FieldByName('MJID').Value := Trim(CDS_Roll.fieldbyname('APTM').AsString);
|
||
FieldByName('MJSTr1').value := Trim(cds_sub.fieldbyname('AOrddefstr2').AsString);
|
||
FieldByName('MJTypeOther').value := Trim(cds_sub.fieldbyname('AOrddefstr3').AsString);
|
||
FieldByName('MJStr2').Value := 'δ<><CEB4><EFBFBD><EFBFBD>';
|
||
FieldByName('MJType').Value := Trim(CDS_Roll.fieldbyname('Aorddefstr1').AsString);
|
||
FieldByName('Filler').Value := Trim(DName);
|
||
FieldByName('MJLen').Value := CDS_Roll.fieldbyname('AOrdQty3').AsFloat;
|
||
FieldByName('MJQty1').Value := CDS_Roll.fieldbyname('AOrdQty1').AsFloat;
|
||
FieldByName('MJxh').Value := CDS_Roll.fieldbyname('apsubid').AsFloat;
|
||
FieldByName('note').Value := Trim(CDS_Roll.fieldbyname('AorddefNote1').AsString);
|
||
FieldByName('C_Code').value := Trim(cds_sub.fieldbyname('C_Code').AsString);
|
||
FieldByName('C_CodeName').value := Trim(cds_sub.fieldbyname('C_CodeName').AsString);
|
||
FieldByName('C_spec').value := Trim(cds_sub.fieldbyname('C_spec').AsString);
|
||
FieldByName('C_color').value := Trim(cds_sub.fieldbyname('C_color').AsString);
|
||
FieldByName('RCGangNo').value := Trim(cds_sub.fieldbyname('GangNo').AsString);
|
||
FieldByName('BCGangNo').value := Trim(cds_sub.fieldbyname('AOrddefstr1').AsString);
|
||
post;
|
||
end;
|
||
end;
|
||
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
result := true;
|
||
except
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
application.MessageBox('<27><><EFBFBD>鱣<EFBFBD><E9B1A3>ʧ<EFBFBD><CAA7>!', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
end;
|
||
end;
|
||
|
||
function TfrmProductOrderAnPai.SaveData10(): Boolean;
|
||
var
|
||
maxno: string;
|
||
begin
|
||
CDS_Sub.DisableControls;
|
||
try
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
with CDS_Sub do
|
||
begin
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
if Fieldbyname('Ssel').AsBoolean then
|
||
begin
|
||
|
||
if CDS_Sub.Locate('C_CodeName', null, []) = True then
|
||
begin
|
||
Application.MessageBox('<27><>Ʒ<EFBFBD><C6B7><EFBFBD>Ʋ<EFBFBD><C6B2><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
if CDS_Sub.Locate('C_CodeName', '', []) = True then
|
||
begin
|
||
Application.MessageBox('<27><>Ʒ<EFBFBD><C6B7><EFBFBD>Ʋ<EFBFBD><C6B2><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
|
||
if CDS_Sub.Locate('C_Color', null, []) = True then
|
||
begin
|
||
Application.MessageBox('<27><>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
if CDS_Sub.Locate('C_Color', '', []) = True then
|
||
begin
|
||
Application.MessageBox('<27><>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
|
||
if trim(CDS_Sub.FieldByName('AOrddefstr4').AsString) = '' then
|
||
begin
|
||
Application.MessageBox('Ⱦ<><C8BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
if trim(CDS_Sub.FieldByName('AOrddefstr1').AsString) = '' then
|
||
begin
|
||
Application.MessageBox('<27>Ų<D7BA><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
|
||
if trim(CDS_Sub.FieldByName('AOrddefstr2').AsString) = '' then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
|
||
if trim(CDS_Sub.FieldByName('ZSXS').AsString) = '' then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
if trim(CDS_Sub.FieldByName('AOrddefstr3').AsString) = '' then
|
||
begin
|
||
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
|
||
with ADOQueryTemp do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('select YFID from YF_money_CR ');
|
||
sql.Add('where YFTypeid=''' + trim(CDS_Sub.FieldByName('APID').AsString) + ''' ');
|
||
sql.Add('and status>0 ');
|
||
open;
|
||
if not IsEmpty then
|
||
begin
|
||
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˣ<EFBFBD><CBA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<DEB8>', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
|
||
exit;
|
||
end;
|
||
end;
|
||
|
||
// try
|
||
// ADOQueryCmd.Connection.BeginTrans;
|
||
///<2F><><EFBFBD><EFBFBD><EFBFBD>ӱ<EFBFBD>
|
||
with CDS_Sub do
|
||
begin
|
||
// First;
|
||
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select * from JYOrder_Sub_AnPai where APId=''' + Trim(CDS_Sub.fieldbyname('APId').AsString) + '''');
|
||
Open;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
if Trim(CDS_Sub.fieldbyname('Sflag').AsString) = '0' then
|
||
Append
|
||
else
|
||
Edit;
|
||
FieldByName('MainId').Value := Trim(Order_Main.fieldbyname('MainId').AsString);
|
||
FieldByName('SubId').Value := Trim(Order_Main.fieldbyname('SubId').AsString);
|
||
FieldByName('ApId').Value := Trim(CDS_Sub.fieldbyname('apid').AsString);
|
||
FieldByName('ADefDate1').Value := CDS_Sub.fieldbyname('ADefDate1').AsDateTime;
|
||
FieldByName('AOrddefstr4').Value := Trim(Order_Main.fieldbyname('factoryNoName').AsString);
|
||
FieldByName('AOrddefstr5').Value := Trim(Order_Main.fieldbyname('factoryNo').AsString);
|
||
FieldByName('GangNo').Value := CDS_Sub.fieldbyname('GangNo').Value;
|
||
FieldByName('conNo').Value := CDS_Sub.fieldbyname('conNo').Value;
|
||
FieldByName('C_Code').Value := CDS_Sub.fieldbyname('C_Code').Value;
|
||
FieldByName('C_CodeName').Value := CDS_Sub.fieldbyname('C_CodeName').Value;
|
||
FieldByName('C_Spec').Value := CDS_Sub.fieldbyname('C_Spec').Value;
|
||
FieldByName('C_Color').Value := CDS_Sub.fieldbyname('C_Color').Value;
|
||
FieldByName('AOrddefstr1').Value := CDS_Sub.fieldbyname('AOrddefstr1').Value;
|
||
FieldByName('AOrddefstr2').Value := CDS_Sub.fieldbyname('AOrddefstr2').Value;
|
||
if Trim(CDS_Sub.fieldbyname('ZSXS').AsString) <> '' then
|
||
FieldByName('ZSXS').Value := CDS_Sub.fieldbyname('ZSXS').Value
|
||
else
|
||
FieldByName('ZSXS').Value := 1;
|
||
FieldByName('AOrdQty2').Value := CDS_Sub.fieldbyname('AOrdQty2').AsInteger;
|
||
FieldByName('AOrdQty1').Value := CDS_Sub.fieldbyname('AOrdQty1').AsFloat;
|
||
|
||
FieldByName('AOrdQty3').Value := CDS_Sub.fieldbyname('AOrdQty3').AsInteger;
|
||
FieldByName('AOrdQty4').Value := CDS_Sub.fieldbyname('AOrdQty4').AsFloat;
|
||
|
||
FieldByName('AOrddefstr3').Value := CDS_Sub.fieldbyname('AOrddefstr3').Value;
|
||
FieldByName('AOrdDefNote1').Value := CDS_Sub.fieldbyname('AOrdDefNote1').Value;
|
||
FieldByName('LLID').Value := Order_Main.fieldbyname('subID').Value;
|
||
FieldByName('AOrddefstr6').Value := CDS_Sub.fieldbyname('AOrddefstr6').Value;
|
||
if CDS_Sub.fieldbyname('AOrdFlag1').AsBoolean = True then
|
||
FieldByName('AOrdFlag1').Value := 1
|
||
else
|
||
FieldByName('AOrdFlag1').Value := 0;
|
||
|
||
if Trim(CDS_Sub.fieldbyname('Sflag').AsString) = '0' then
|
||
FieldByName('Filler').Value := Trim(DName)
|
||
else
|
||
begin
|
||
FieldByName('Editer').Value := Trim(DName);
|
||
FieldByName('EditTime').Value := SGetServerDateTime(ADOQueryTemp);
|
||
end;
|
||
|
||
if Trim(Order_Main.fieldbyname('C_Unit').AsString) = Trim(CDS_Sub.fieldbyname('AOrddefstr2').AsString) then
|
||
begin
|
||
FieldByName('HCYZQty').Value := CDS_Sub.fieldbyname('AOrdQty1').Value;
|
||
end
|
||
else
|
||
begin
|
||
if Trim(CDS_Sub.fieldbyname('AOrddefstr2').AsString) = 'M' then
|
||
begin
|
||
FieldByName('HCYZQty').Value := (CDS_Sub.fieldbyname('AOrdQty1').Value * 1.00 / ADOQueryTemp.fieldbyname('TPMQty').Value) * ADOQueryTemp.fieldbyname('TPQty').Value;
|
||
end;
|
||
end;
|
||
|
||
if Trim(CDS_Sub.fieldbyname('AOrddefstr2').AsString) = 'M' then
|
||
begin
|
||
FieldByName('HCMQty').Value := CDS_Sub.fieldbyname('AOrdQty1').Value;
|
||
end
|
||
else
|
||
begin
|
||
FieldByName('HCMQty').Value := CDS_Sub.fieldbyname('AOrdQty1').Value * CDS_Sub.fieldbyname('ZSXS').Value;
|
||
end;
|
||
Post;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('delete from JYOrder_Sub_AnPai_MX where APId=''' + Trim(CDS_Sub.fieldbyname('APId').AsString) + '''');
|
||
execsql;
|
||
end;
|
||
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select * from JYOrder_Sub_AnPai_MX where APId=''' + Trim(CDS_Sub.fieldbyname('APId').AsString) + '''');
|
||
Open;
|
||
end;
|
||
CDS_Roll.DisableControls;
|
||
CDS_Roll.First;
|
||
while not CDS_Roll.Eof do
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
append;
|
||
FieldByName('ApId').Value := Trim(CDS_Roll.fieldbyname('apid').AsString);
|
||
FieldByName('ApsubId').Value := CDS_Roll.recNo;
|
||
FieldByName('APTM').Value := Trim(CDS_Roll.fieldbyname('APTM').AsString);
|
||
FieldByName('AOrdQty2').Value := CDS_Roll.fieldbyname('AOrdQty2').AsInteger;
|
||
FieldByName('AOrdQty1').Value := CDS_Roll.fieldbyname('AOrdQty1').AsFloat;
|
||
FieldByName('AorddefNote1').Value := Trim(CDS_Roll.fieldbyname('AorddefNote1').AsString);
|
||
FieldByName('Aorddefstr1').Value := Trim(CDS_Roll.fieldbyname('Aorddefstr1').AsString);
|
||
post;
|
||
end;
|
||
CDS_Roll.Next;
|
||
end;
|
||
CDS_Roll.EnableControls;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('UPdate JYOrder_Sub Set SOrdFlag20=1 where SubId=''' + Trim(Order_Main.fieldbyname('SubId').AsString) + '''');
|
||
ExecSQL;
|
||
end;
|
||
CDS_Sub.Edit;
|
||
// CDS_Sub.FieldByName('APId').Value:=Trim(maxno);
|
||
CDS_Sub.FieldByName('SubId').Value := Trim(Order_Main.fieldbyname('SubId').AsString);
|
||
|
||
//Order_Sub.Post;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add(' UPdate WFB_MJJY Set MJTypeOther=''' + Trim(CDS_Sub.fieldbyname('AOrddefstr3').AsString) + '''');
|
||
SQL.Add(' where APId=''' + Trim(maxno) + '''');
|
||
sql.Add(' UPdate CK_BanCP_KC Set KCQtyUnit=''' + Trim(CDS_Sub.fieldbyname('AOrddefstr3').AsString) + '''');
|
||
SQL.Add(' where MJId in (select MJID from WFB_MJJY where APID=''' + Trim(maxno) + ''')');
|
||
sql.Add(' UPdate CK_BanCP_CR Set QtyUnit=''' + Trim(CDS_Sub.fieldbyname('AOrddefstr3').AsString) + '''');
|
||
SQL.Add(' where MJId in (select MJID from WFB_MJJY where APID=''' + Trim(maxno) + ''')');
|
||
ExecSQL;
|
||
end;
|
||
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add(' UPdate Contract_sub Set H_PS=(select sum(AOrdQty2) from JYOrder_Sub_AnPai X where X.mainID=''' + trim(Order_Main.fieldbyname('mainID').AsString) + ''' and X.subID=''' + trim(Order_Main.fieldbyname('subID').AsString) + ''' )');
|
||
sql.Add(' ,H_Qty=(select sum(AOrdQty1) from JYOrder_Sub_AnPai X where X.mainID=''' + trim(Order_Main.fieldbyname('mainID').AsString) + ''' and X.subID=''' + trim(Order_Main.fieldbyname('subID').AsString) + ''' )');
|
||
SQL.Add(' where subID =' + quotedstr(trim(Order_Main.fieldbyname('fromsubID').AsString)));
|
||
ExecSQL;
|
||
end;
|
||
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add(' UPdate Contract_sub Set H_PS=(select sum(AOrdQty2) from JYOrder_Sub_AnPai X where X.mainID=''' + trim(Order_Main.fieldbyname('mainID').AsString) + ''' and X.subID=''' + trim(Order_Main.fieldbyname('subID').AsString) + ''' )');
|
||
sql.Add(' ,H_Qty=(select sum(AOrdQty1) from JYOrder_Sub_AnPai X where X.mainID=''' + trim(Order_Main.fieldbyname('mainID').AsString) + ''' and X.subID=''' + trim(Order_Main.fieldbyname('subID').AsString) + ''' )');
|
||
SQL.Add(' where subID =' + quotedstr(trim(Order_Main.fieldbyname('subID').AsString)));
|
||
ExecSQL;
|
||
end;
|
||
if YFData() = False then
|
||
begin
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD>²<EFBFBD><C2B2><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
{ IF trim(Order_Main.FieldByName('contk1').AsString)<>'<27><><EFBFBD>ӹ<DEBC>' then
|
||
begin
|
||
|
||
end; }
|
||
end;
|
||
|
||
// ADOQueryCmd.Connection.CommitTrans;
|
||
// Result := True;
|
||
// except
|
||
// Result := False;
|
||
// MovePanel2.Visible := False;
|
||
// ADOQueryCmd.Connection.RollbackTrans;
|
||
// Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣<EFBFBD><ECB3A3>', '<27><>ʾ', 0);
|
||
// end;
|
||
end;
|
||
Next;
|
||
end;
|
||
end;
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
Result := True;
|
||
except
|
||
Result := False;
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
end;
|
||
CDS_Sub.EnableControls;
|
||
|
||
end;
|
||
|
||
procedure TfrmProductOrderAnPai.InitRoll();
|
||
begin
|
||
// if CDS_Sub.Active then exit;
|
||
try
|
||
// ADORoll.DisableControls;
|
||
with ADORoll do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from JYOrder_Sub_AnPai_MX where ApID=''' + Trim(CDS_Sub.fieldbyname('ApID').AsString) + '''');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADORoll, CDS_Roll);
|
||
SInitCDSData20(ADORoll, CDS_Roll);
|
||
finally
|
||
// cxgrid3.SetFocus;
|
||
// ADORoll.EnableControls;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmProductOrderAnPai.FormDestroy(Sender: TObject);
|
||
begin
|
||
frmProductOrderAnPai := nil;
|
||
end;
|
||
|
||
procedure TfrmProductOrderAnPai.FormClose(Sender: TObject; var Action: TCloseAction);
|
||
begin
|
||
WriteCxGrid('ָʾ<D6B8><CABE><EFBFBD><EFBFBD>Ϣ1XXX', TV5, '<27>زֹ<D8B2><D6B9><EFBFBD>');
|
||
WriteCxGrid('<27>ز<EFBFBD><D8B2><EFBFBD>Ϣ', Tv2, '<27>زֹ<D8B2><D6B9><EFBFBD>');
|
||
Action := caFree;
|
||
end;
|
||
|
||
procedure TfrmProductOrderAnPai.FormCreate(Sender: TObject);
|
||
begin
|
||
|
||
//BegDate.DateTime:=SGetServerDateTime(ADOQueryTemp)-7;
|
||
//EndDate.DateTime:=SGetServerDateTime(ADOQueryTemp);
|
||
DQdate := SGetServerDate(ADOQueryTemp);
|
||
fRoll := true;
|
||
end;
|
||
|
||
procedure TfrmProductOrderAnPai.TBCloseClick(Sender: TObject);
|
||
begin
|
||
Close;
|
||
|
||
end;
|
||
|
||
procedure TfrmProductOrderAnPai.InitGrid();
|
||
begin
|
||
fRoll := true;
|
||
try
|
||
// ADOQueryMain.DisableControls;
|
||
with ADOQueryMain do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from JYOrder_Sub_AnPai where LLId=''' + Trim(Order_Main.fieldbyname('subID').AsString) + '''');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryMain, CDS_Sub);
|
||
SInitCDSData20(ADOQueryMain, CDS_Sub);
|
||
finally
|
||
// ADOQueryMain.EnableControls;
|
||
if fRoll then
|
||
InitRoll();
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmProductOrderAnPai.InitGridFH();
|
||
begin
|
||
end;
|
||
|
||
procedure TfrmProductOrderAnPai.InitForm();
|
||
var
|
||
i: Integer;
|
||
begin
|
||
DateTimePicker1.DateTime := SGetServerDateTime(ADOQueryTemp);
|
||
ReadCxGrid('ָʾ<D6B8><CABE><EFBFBD><EFBFBD>Ϣ1XXX', TV5, '<27>زֹ<D8B2><D6B9><EFBFBD>');
|
||
ReadCxGrid('<27>ز<EFBFBD><D8B2><EFBFBD>Ϣ', Tv2, '<27>زֹ<D8B2><D6B9><EFBFBD>');
|
||
end;
|
||
|
||
function TfrmProductOrderAnPai.DelData(): Boolean;
|
||
begin
|
||
try
|
||
Result := false;
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('delete JYOrder_Sub where SubId=''' + Trim(Order_Main.fieldbyname('SubId').AsString) + '''');
|
||
ExecSQL;
|
||
end;
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from JYOrder_Sub where MainId=''' + Trim(Order_Main.fieldbyname('MainId').AsString) + '''');
|
||
Open;
|
||
if IsEmpty then
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('delete JYOrder_Main where MainId=''' + Trim(Order_Main.fieldbyname('MainId').AsString) + '''');
|
||
ExecSQL;
|
||
end;
|
||
end;
|
||
end;
|
||
if Trim(Order_Main.fieldbyname('SubId').AsString) = '' then
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('delete JYOrder_Main where MainId=''' + Trim(Order_Main.fieldbyname('MainId').AsString) + '''');
|
||
ExecSQL;
|
||
end;
|
||
end;
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
Result := True;
|
||
except
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Result := False;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD>쳣<EFBFBD><ECB3A3>', '<27><>ʾ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmProductOrderAnPai.TBExportClick(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.IsEmpty then
|
||
Exit;
|
||
SelExportData(TV5, ADOQueryMain, '<27>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD>б<EFBFBD>');
|
||
end;
|
||
|
||
procedure TfrmProductOrderAnPai.TBPrintClick(Sender: TObject);
|
||
var
|
||
fPrintFile: string;
|
||
Porderno: string;
|
||
begin
|
||
if Order_Main.IsEmpty then
|
||
Exit;
|
||
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\<5C>ɹ<EFBFBD><C9B9><EFBFBD>.rmf';
|
||
SDofilter(ADOQueryMain, ' OrderNoM=''' + Trim(Order_Main.fieldbyname('OrderNoM').AsString) + '''');
|
||
SCreateCDS20(ADOQueryMain, Order_Main);
|
||
SInitCDSData20(ADOQueryMain, Order_Main);
|
||
Porderno := Trim(Order_Main.fieldbyname('OrderNoM').AsString);
|
||
if FileExists(fPrintFile) then
|
||
begin
|
||
//RMVariables['begindate']:=begindate.DateTime;
|
||
//RMVariables['enddate']:=enddate.DateTime;
|
||
//RMVariables['printtime']:=Now;
|
||
//RMVariables['printer']:=Trim(gUserName);
|
||
RM1.LoadFromFile(fPrintFile);
|
||
RM1.ShowReport;
|
||
end
|
||
else
|
||
begin
|
||
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + ExtractFilePath(Application.ExeName) + 'Report\<5C><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE>10.rmf'), '<27><>ʾ', 0);
|
||
end;
|
||
SDofilter(ADOQueryMain, '');
|
||
SCreateCDS20(ADOQueryMain, Order_Main);
|
||
SInitCDSData20(ADOQueryMain, Order_Main);
|
||
Order_Main.Locate('ordernoM', Porderno, []);
|
||
//SelPrintData(TV4,ADOQueryMain,'<27><>ͬ<EFBFBD><CDAC>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD>');
|
||
end;
|
||
|
||
procedure TfrmProductOrderAnPai.FormShow(Sender: TObject);
|
||
begin
|
||
InitForm();
|
||
end;
|
||
|
||
procedure TfrmProductOrderAnPai.TBTPClick(Sender: TObject);
|
||
var
|
||
FQty, FQty1, FMxQty, FPQty, FMxQtyS, FPQtyS: string;
|
||
begin
|
||
end;
|
||
|
||
procedure TfrmProductOrderAnPai.CheckBox1Click(Sender: TObject);
|
||
begin
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmProductOrderAnPai.Tv1StylesGetContentStyle(Sender: TcxCustomGridTableView; ARecord: TcxCustomGridRecord; AItem: TcxCustomGridTableItem; out AStyle: TcxStyle);
|
||
var
|
||
id, id10: Integer;
|
||
begin
|
||
{try
|
||
if Tv1.GroupedItemCount=0 then
|
||
begin
|
||
Id:=Tv1.GetColumnByFieldName('DeliveryDate').Index-tv1.GroupedItemCount;
|
||
Id10:=Tv1.GetColumnByFieldName('SubStatus').Index-tv1.GroupedItemCount;
|
||
if Trim(VarToStr(ARecord.Values[id]))='' then Exit;
|
||
if Id<0 then Exit;
|
||
if ARecord.Values[id10]='<27><><EFBFBD><EFBFBD>' then exit;
|
||
if (ARecord.Values[id]-DQdate)>=4 then Exit;
|
||
if ((ARecord.Values[id]-DQdate)>=0) and ((ARecord.Values[id]-DQdate)<4) then
|
||
AStyle:=DataLink_.QHuangSe
|
||
else
|
||
if ARecord.Values[id]-DQdate<0 then
|
||
begin
|
||
AStyle:=DataLink_OrderManage.FenHongS;
|
||
end;
|
||
end else
|
||
begin
|
||
|
||
end;
|
||
except
|
||
end; }
|
||
end;
|
||
|
||
procedure TfrmProductOrderAnPai.v1DeliveryDateCustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
||
begin
|
||
{ Id:=TV1.GetColumnByFieldName('DeliveryDate').Index;//;-TV1.GroupedItemCount;
|
||
Id10:=TV1.GetColumnByFieldName('SubStatus').Index;
|
||
if Id<0 then Exit;
|
||
if AViewInfo.GridRecord.Values[Id10]='<27><><EFBFBD><EFBFBD>' then Exit;
|
||
if AViewInfo.GridRecord.Values[Id]-SGetServerDate(ADOQueryTemp)>=4 then Exit;
|
||
if ((AViewInfo.GridRecord.Values[id]-SGetServerDate10(ADOQueryTemp))>=0) and ((AViewInfo.GridRecord.Values[id]-SGetServerDate(ADOQueryTemp))<4) then
|
||
ACanvas.Brush.Color:=clYellow
|
||
else
|
||
if (AViewInfo.GridRecord.Values[id])-(SGetServerDate10(ADOQueryTemp)<0) then
|
||
begin
|
||
ACanvas.Brush.Color:=clRed;
|
||
end;
|
||
begin
|
||
ACanvas.Brush.Color:=clRed;
|
||
end else
|
||
if AViewInfo.GridRecord.Values[Id]='Purple' then
|
||
begin
|
||
ACanvas.Brush.Color:=clPurple;
|
||
end else
|
||
if AViewInfo.GridRecord.Values[Id]='Olive' then
|
||
begin
|
||
ACanvas.Brush.Color:=clOlive;
|
||
end else
|
||
if AViewInfo.GridRecord.Values[Id]='Teal' then
|
||
begin
|
||
ACanvas.Brush.Color:=clTeal;
|
||
end else
|
||
if AViewInfo.GridRecord.Values[Id]='Background' then
|
||
begin
|
||
ACanvas.Brush.Color:=clBackground;
|
||
end; }
|
||
end;
|
||
|
||
procedure TfrmProductOrderAnPai.N1Click(Sender: TObject);
|
||
var
|
||
fPrintFile: string;
|
||
Porderno: string;
|
||
begin
|
||
if Order_Main.IsEmpty then
|
||
Exit;
|
||
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\<5C><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE>10.rmf';
|
||
SDofilter(ADOQueryMain, ' OrderNoM=''' + Trim(Order_Main.fieldbyname('OrderNoM').AsString) + '''');
|
||
SCreateCDS20(ADOQueryMain, Order_Main);
|
||
SInitCDSData20(ADOQueryMain, Order_Main);
|
||
Porderno := Trim(Order_Main.fieldbyname('OrderNoM').AsString);
|
||
if FileExists(fPrintFile) then
|
||
begin
|
||
//RMVariables['begindate']:=begindate.DateTime;
|
||
//RMVariables['enddate']:=enddate.DateTime;
|
||
//RMVariables['printtime']:=Now;
|
||
//RMVariables['printer']:=Trim(gUserName);
|
||
RM1.LoadFromFile(fPrintFile);
|
||
RM1.ShowReport;
|
||
end
|
||
else
|
||
begin
|
||
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + ExtractFilePath(Application.ExeName) + 'Report\<5C><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE>10.rmf'), '<27><>ʾ', 0);
|
||
end;
|
||
SDofilter(ADOQueryMain, '');
|
||
SCreateCDS20(ADOQueryMain, Order_Main);
|
||
SInitCDSData20(ADOQueryMain, Order_Main);
|
||
Order_Main.Locate('ordernoM', Porderno, []);
|
||
end;
|
||
|
||
procedure TfrmProductOrderAnPai.N2Click(Sender: TObject);
|
||
var
|
||
fPrintFile: string;
|
||
Porderno: string;
|
||
begin
|
||
if Order_Main.IsEmpty then
|
||
Exit;
|
||
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\<5C><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE>.rmf';
|
||
SDofilter(ADOQueryMain, ' OrderNoM=''' + Trim(Order_Main.fieldbyname('OrderNoM').AsString) + '''');
|
||
SCreateCDS20(ADOQueryMain, Order_Main);
|
||
SInitCDSData20(ADOQueryMain, Order_Main);
|
||
Porderno := Trim(Order_Main.fieldbyname('OrderNoM').AsString);
|
||
if FileExists(fPrintFile) then
|
||
begin
|
||
//RMVariables['begindate']:=begindate.DateTime;
|
||
//RMVariables['enddate']:=enddate.DateTime;
|
||
//RMVariables['printtime']:=Now;
|
||
//RMVariables['printer']:=Trim(gUserName);
|
||
RM1.LoadFromFile(fPrintFile);
|
||
RM1.ShowReport;
|
||
end
|
||
else
|
||
begin
|
||
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + ExtractFilePath(Application.ExeName) + 'Report\<5C><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE>.rmf'), '<27><>ʾ', 0);
|
||
end;
|
||
SDofilter(ADOQueryMain, '');
|
||
SCreateCDS20(ADOQueryMain, Order_Main);
|
||
SInitCDSData20(ADOQueryMain, Order_Main);
|
||
Order_Main.Locate('ordernoM', Porderno, []);
|
||
end;
|
||
|
||
procedure TfrmProductOrderAnPai.ToolButton1Click(Sender: TObject);
|
||
begin
|
||
with ADOQuery_Tp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select *,PBFactory=(select factoryNoName from Contract_Main X where X.mainID=B.frommainID), ');
|
||
sql.Add('fdhNO=(select conNo from Contract_Main X where X.mainID=B.frommainID) ');
|
||
sql.Add('from Contract_Main A');
|
||
sql.Add('inner join Contract_sub B on B.MainID=A.mainID ');
|
||
// sql.Add('where A.MainId='''+Trim(CDS_OrderNo.fieldbyname('MainId').AsString)+'''');
|
||
sql.Add('where A.conNO like ' + quotedstr('%' + trim(CONnO.Text) + '%'));
|
||
sql.Add('and A.FactoryNoName like ' + quotedstr('%' + trim(FactoryNoName.Text) + '%'));
|
||
sql.Add('and B.C_CodeName like ' + quotedstr('%' + trim(C_CodeName.Text) + '%'));
|
||
sql.Add('and B.C_Color = ' + quotedstr(trim(C_Color.Text)));
|
||
sql.Add(' and A.conType IN(''<27><><EFBFBD><EFBFBD>ԤͶ<D4A4><CDB6>'',''<27><>Ʒ<EFBFBD><C6B7><EFBFBD>ӹ<EFBFBD>'') ');
|
||
sql.Add(' and isnull(B.C_status,''0'')=''0'' ');
|
||
open;
|
||
end;
|
||
SCreateCDS20(ADOQuery_Tp, Order_Main);
|
||
SInitCDSData20(ADOQuery_Tp, Order_Main);
|
||
|
||
InitGrid();
|
||
BtnEditA1.TxtCode := Trim(Order_Main.fieldbyname('FactoryNo').AsString);
|
||
BtnEditA1.Text := Trim(Order_Main.fieldbyname('FactoryNoName').AsString);
|
||
BtnEditA4.Text := Trim(Order_Main.fieldbyname('PBFactory').AsString);
|
||
end;
|
||
|
||
procedure TfrmProductOrderAnPai.ToolButton2Click(Sender: TObject);
|
||
var
|
||
maxno: string;
|
||
begin
|
||
if Order_Main.IsEmpty then
|
||
exit;
|
||
{ if CDS_Sub.FieldByName('Sflag').AsString='0' then
|
||
begin
|
||
if application.MessageBox('<27><>ǰ<EFBFBD><C7B0><EFBFBD>ܼ<EFBFBD>¼δ<C2BC><CEB4><EFBFBD>棬<EFBFBD>Ƿ<C7B7>?','<27><>ʾ<EFBFBD><CABE>Ϣ',1)=1 then
|
||
begin
|
||
abort;
|
||
end;
|
||
end; }
|
||
if GetLSNo(ADOQueryCmd, maxno, 'W', 'JYOrder_Sub_AnPai', 3, 1) = False then
|
||
begin
|
||
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
with CDS_Sub do
|
||
begin
|
||
last;
|
||
Append;
|
||
FieldByName('apid').Value := trim(maxno);
|
||
FieldByName('Sflag').Value := '0';
|
||
FieldByName('mainID').Value := Trim(Order_Main.fieldbyname('mainID').AsString);
|
||
FieldByName('SubId').Value := Trim(Order_Main.fieldbyname('SubId').AsString);
|
||
FieldByName('C_Code').Value := Trim(Order_Main.fieldbyname('C_Code').AsString);
|
||
FieldByName('C_CodeName').Value := Trim(Order_Main.fieldbyname('C_CodeName').AsString);
|
||
FieldByName('C_COLor').Value := Trim(Order_Main.fieldbyname('C_COLor').AsString);
|
||
// FieldByName('ADefDate1').Value:=DateTimePicker1.Date;
|
||
FieldByName('ADefDate1').Value := formatdateTime('yyyy-MM-dd', DateTimePicker1.Date) + ' ' + formatdateTime('HH:nn:ss', DateTimePicker2.Time);
|
||
FieldByName('AOrddefstr4').Value := Trim(BtnEditA1.Text);
|
||
FieldByName('AOrddefstr5').Value := Trim(BtnEditA1.TxtCode);
|
||
FieldByName('AOrddefstr2').Value := Trim(Order_Main.fieldbyname('C_UNit').AsString);
|
||
FieldByName('AOrddefstr3').Value := Trim(Order_Main.fieldbyname('C_UNit').AsString);
|
||
// FieldByName('gangNO').Value:=Trim(Order_Main.fieldbyname('gangNO').AsString);
|
||
FieldByName('AOrddefstr1').Value := Trim(Order_Main.fieldbyname('BCGangNO').AsString);
|
||
// FieldByName('P_Color').Value:=Trim(Order_Main.fieldbyname('P_Color').AsString);
|
||
FieldByName('zsxs').Value := '1';
|
||
// FieldByName('AOrddefstr2').Value:=Trim(ComboBox1.Text);
|
||
// FieldByName('AOrddefstr3').Value:=Trim(BtnEditA2.Text);
|
||
FieldByName('AOrdDefNote1').Value := Trim(BtnEditA3.Text);
|
||
FieldByName('AOrddefstr6').Value := Trim(Order_Main.fieldbyname('PBfactory').AsString);
|
||
FieldByName('AOrdQty2').Value := Order_Main.fieldbyname('Qty1').AsFloat;
|
||
FieldByName('AOrdQty1').Value := Order_Main.fieldbyname('C_Qty').AsFloat;
|
||
Post;
|
||
end;
|
||
fRoll := false;
|
||
end;
|
||
|
||
procedure TfrmProductOrderAnPai.ToolButton3Click(Sender: TObject);
|
||
var
|
||
YFID, CRID: string;
|
||
begin
|
||
if CDS_Sub.IsEmpty then
|
||
Exit;
|
||
|
||
with ADOQueryTemp do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('select YFID from YF_money_CR ');
|
||
sql.Add('where YFTypeID=''' + trim(CDS_Sub.FieldByName('APID').AsString) + ''' ');
|
||
sql.Add('and status>0 ');
|
||
open;
|
||
if not IsEmpty then
|
||
begin
|
||
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˣ<EFBFBD><CBA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<DEB8>', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
|
||
exit;
|
||
end;
|
||
end;
|
||
|
||
if Trim(CDS_Sub.fieldbyname('APID').AsString) <> '' then
|
||
begin
|
||
{ with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from YF_Money_CR ');
|
||
sql.Add(' where MainID='''+Trim(Order_Main.fieldbyname('MainID').AsString)+'''');
|
||
sql.Add(' and subID='''+Trim(Order_Main.fieldbyname('subID').AsString)+'''');
|
||
sql.Add(' and YFName=''<27>ӹ<EFBFBD><D3B9><EFBFBD>'' ');
|
||
Open;
|
||
if not IsEmpty then
|
||
begin
|
||
YFID:=Fieldbyname('YFID').AsString;
|
||
CRID:=Fieldbyname('CRID').AsString;
|
||
end;
|
||
end;
|
||
}
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select Top 1 * from WFB_MJJY where APID=''' + Trim(CDS_Sub.fieldbyname('APID').AsString) + '''');
|
||
Open;
|
||
end;
|
||
if ADOQueryTemp.IsEmpty = False then
|
||
begin
|
||
Application.MessageBox('<27>Ѳ<EFBFBD><D1B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݲ<EFBFBD><DDB2><EFBFBD>ɾ<EFBFBD><C9BE>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
||
Exit;
|
||
try
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('delete JYOrder_Sub_AnPai where APID=''' + Trim(CDS_Sub.fieldbyname('APID').AsString) + '''');
|
||
sql.Add('delete JYOrder_Sub_AnPai_MX where APID=''' + Trim(CDS_Sub.fieldbyname('APID').AsString) + '''');
|
||
sql.Add('delete YF_Money_CR where YFTypeID=''' + Trim(CDS_Sub.fieldbyname('APID').AsString) + '''');
|
||
|
||
{ sql.Add('update YF_Money_CR Set Qty=(select isnull(Sum(AOrdQty1),0) from JYOrder_Sub_AnPai A ');
|
||
sql.Add(' where A.mainID=YF_Money_CR.mainID and A.subiD=YF_Money_CR.subiD )');
|
||
sql.Add(',PS=(select isnull(sum(AOrdQty2),0) from JYOrder_Sub_AnPai A ');
|
||
sql.Add(' where A.mainID=YF_Money_CR.mainID and A.subiD=YF_Money_CR.subiD )');
|
||
sql.Add(' where YFID='''+Trim(YFID)+'''');
|
||
|
||
sql.Add('delete from YF_Money_CR ');
|
||
sql.Add('where YFID='''+Trim(YFID)+''' ');
|
||
sql.Add('Update YF_Money_CR Set Money=Price*Qty,BBMoney=Price*Qty*HuiLv');
|
||
sql.Add(' where YFID='''+Trim(YFID)+'''');
|
||
sql.Add('Update YF_Money_KC Set KCMoney=(select isnull(Sum(Money*QtyFlag),0) from YF_Money_CR A where A.CRID=YF_Money_KC.CRID)');
|
||
sql.Add(',KCBBMoney=(select isnull(Sum(BBMoney*QtyFlag),0) from YF_Money_CR A where A.CRID=YF_Money_KC.CRID)');
|
||
sql.Add(' where CRID='''+Trim(CRID)+''''); }
|
||
ExecSQL;
|
||
end;
|
||
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
except
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
end;
|
||
end;
|
||
with CDS_Sub do
|
||
begin
|
||
Delete;
|
||
end;
|
||
|
||
end;
|
||
|
||
function TfrmProductOrderAnPai.SaveData(): Boolean;
|
||
var
|
||
maxno: string;
|
||
begin
|
||
try
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
///<2F><><EFBFBD><EFBFBD><EFBFBD>ӱ<EFBFBD>
|
||
with CDS_Sub do
|
||
begin
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
if Trim(CDS_Sub.fieldbyname('APId').AsString) = '' then
|
||
begin
|
||
if GetLSNo(ADOQueryCmd, maxno, '', 'JYOrder_Sub_AnPai', 3, 1) = False then
|
||
begin
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
end
|
||
else
|
||
begin
|
||
maxno := Trim(CDS_Sub.fieldbyname('APId').AsString);
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select * from JYOrder_Sub_AnPai where APId=''' + Trim(CDS_Sub.fieldbyname('APId').AsString) + '''');
|
||
Open;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
if Trim(CDS_Sub.fieldbyname('APId').AsString) = '' then
|
||
Append
|
||
else
|
||
Edit;
|
||
FieldByName('MainId').Value := Trim(Order_Main.fieldbyname('MainId').AsString);
|
||
FieldByName('SubId').Value := Trim(Order_Main.fieldbyname('SubId').AsString);
|
||
FieldByName('ApId').Value := Trim(maxno);
|
||
FieldByName('ADefDate1').Value := CDS_Sub.fieldbyname('ADefDate1').Value;
|
||
FieldByName('AOrddefstr4').Value := Trim(Order_Main.fieldbyname('FirstName').AsString);
|
||
FieldByName('AOrddefstr5').Value := Trim(Order_Main.fieldbyname('FirstNo').AsString);
|
||
FieldByName('GangNo').Value := CDS_Sub.fieldbyname('GangNo').Value;
|
||
FieldByName('AOrddefstr1').Value := CDS_Sub.fieldbyname('AOrddefstr1').Value;
|
||
FieldByName('AOrddefstr2').Value := CDS_Sub.fieldbyname('AOrddefstr2').Value;
|
||
if Trim(CDS_Sub.fieldbyname('ZSXS').AsString) <> '' then
|
||
FieldByName('ZSXS').Value := CDS_Sub.fieldbyname('ZSXS').Value
|
||
else
|
||
FieldByName('ZSXS').Value := 1;
|
||
FieldByName('AOrdQty2').Value := CDS_Sub.fieldbyname('AOrdQty2').Value;
|
||
FieldByName('AOrdQty1').Value := CDS_Sub.fieldbyname('AOrdQty1').Value;
|
||
FieldByName('AOrddefstr3').Value := CDS_Sub.fieldbyname('AOrddefstr3').Value;
|
||
FieldByName('AOrdDefNote1').Value := CDS_Sub.fieldbyname('AOrdDefNote1').Value;
|
||
FieldByName('LLID').Value := Order_Main.fieldbyname('LLID').Value;
|
||
FieldByName('AOrddefstr6').Value := CDS_Sub.fieldbyname('AOrddefstr6').Value;
|
||
if CDS_Sub.fieldbyname('AOrdFlag1').AsBoolean = True then
|
||
FieldByName('AOrdFlag1').Value := 1
|
||
else
|
||
FieldByName('AOrdFlag1').Value := 0;
|
||
|
||
//RTSetSaveDataCDS(ADOQueryCmd,Tv2,CDS_Sub,'JYOrder_Sub_AnPai',0);
|
||
{if Trim(CDS_Sub.fieldbyname('APID').AsString)<>'' then
|
||
begin
|
||
FieldByName('Editer').Value:=Trim(DName);
|
||
FieldByName('EditTime').Value:=SGetServerDateTime(ADOQueryTemp);
|
||
end else
|
||
begin
|
||
|
||
end; }
|
||
if Trim(CDS_Sub.fieldbyname('APId').AsString) = '' then
|
||
FieldByName('Filler').Value := Trim(DName)
|
||
else
|
||
begin
|
||
FieldByName('Editer').Value := Trim(DName);
|
||
FieldByName('EditTime').Value := SGetServerDateTime(ADOQueryTemp);
|
||
end;
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select Top 1* from Contract_Cloth_LL where LLId=''' + Trim(Order_Main.fieldbyname('LLId').AsString) + '''');
|
||
Open;
|
||
end;
|
||
if Trim(ADOQueryTemp.fieldbyname('TPUnit').AsString) = Trim(CDS_Sub.fieldbyname('AOrddefstr2').AsString) then
|
||
begin
|
||
FieldByName('HCYZQty').Value := CDS_Sub.fieldbyname('AOrdQty1').Value;
|
||
end
|
||
else
|
||
begin
|
||
if Trim(CDS_Sub.fieldbyname('AOrddefstr2').AsString) = 'M' then
|
||
begin
|
||
FieldByName('HCYZQty').Value := (CDS_Sub.fieldbyname('AOrdQty1').Value * 1.00 / ADOQueryTemp.fieldbyname('TPMQty').Value) * ADOQueryTemp.fieldbyname('TPQty').Value;
|
||
end;
|
||
end;
|
||
if Trim(CDS_Sub.fieldbyname('AOrddefstr2').AsString) = 'M' then
|
||
begin
|
||
FieldByName('HCMQty').Value := CDS_Sub.fieldbyname('AOrdQty1').Value;
|
||
end
|
||
else
|
||
begin
|
||
FieldByName('HCMQty').Value := CDS_Sub.fieldbyname('AOrdQty1').Value * CDS_Sub.fieldbyname('ZSXS').Value;
|
||
end;
|
||
Post;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('UPdate JYOrder_Sub Set SOrdFlag20=1 where SubId=''' + Trim(Order_Main.fieldbyname('SubId').AsString) + '''');
|
||
ExecSQL;
|
||
end;
|
||
CDS_Sub.Edit;
|
||
CDS_Sub.FieldByName('APId').Value := Trim(maxno);
|
||
CDS_Sub.FieldByName('SubId').Value := Trim(Order_Main.fieldbyname('SubId').AsString);
|
||
|
||
//Order_Sub.Post;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add(' UPdate WFB_MJJY Set MJTypeOther=''' + Trim(CDS_Sub.fieldbyname('AOrddefstr3').AsString) + '''');
|
||
SQL.Add(' where APId=''' + Trim(maxno) + '''');
|
||
sql.Add(' UPdate CK_BanCP_KC Set KCQtyUnit=''' + Trim(CDS_Sub.fieldbyname('AOrddefstr3').AsString) + '''');
|
||
SQL.Add(' where MJId in (select MJID from WFB_MJJY where APID=''' + Trim(maxno) + ''')');
|
||
sql.Add(' UPdate CK_BanCP_CR Set QtyUnit=''' + Trim(CDS_Sub.fieldbyname('AOrddefstr3').AsString) + '''');
|
||
SQL.Add(' where MJId in (select MJID from WFB_MJJY where APID=''' + Trim(maxno) + ''')');
|
||
ExecSQL;
|
||
end;
|
||
|
||
{ if YFData()=False then
|
||
begin
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD>²<EFBFBD><C2B2><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!','<27><>ʾ',0);
|
||
Exit;
|
||
end; }
|
||
Next;
|
||
end;
|
||
end;
|
||
{ with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('UPdate Contract_Cloth_LL Set HCPS=0,HCQty=0,HCMQty=0 where OrdSubId='''+Trim(Order_Main.fieldbyname('SubId').AsString)+'''');
|
||
ExecSQL;
|
||
end;
|
||
with ADOQueryHC do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select distinct(AOrddefstr5) AOrddefstr5 from JYOrder_Sub_AnPai where SubId='''+Trim(Order_Main.fieldbyname('SubId').AsString)+'''');
|
||
Open;
|
||
end;
|
||
with ADOQueryHC do
|
||
begin
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
UpdateHC(Trim(ADOQueryHC.fieldbyname('AOrddefstr5').AsString));
|
||
Next;
|
||
end;
|
||
end; }
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('UPdate Contract_Cloth_LL Set HCPS=(select isnull(sum(AOrdQty2),0) from JYOrder_Sub_AnPai A where A.LLID=Contract_Cloth_LL.LLID )');
|
||
sql.Add(',HCMQty=(select isnull(sum(HCMQty),0) from JYOrder_Sub_AnPai A where A.LLID=Contract_Cloth_LL.LLID )');
|
||
sql.Add(' where LLID=''' + Trim(Order_Main.fieldbyname('LLID').AsString) + '''');
|
||
ExecSQL;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
if (Trim(CDS_Sub.fieldbyname('AOrddefstr2').AsString) = Trim(Order_Main.fieldbyname('TPUnit').AsString)) then
|
||
sql.Add('Update Contract_Cloth_LL Set HCQty=(select isnull(Sum(AOrdQty1),0) from JYOrder_Sub_AnPai A where A.LLID=Contract_Cloth_LL.LLID) ')
|
||
else
|
||
sql.Add('Update Contract_Cloth_LL Set HCQty=HCMQty*1.00/TPMQty*TPQty ');
|
||
sql.Add(' where LLID=''' + Trim(Order_Main.fieldbyname('LLID').AsString) + '''');
|
||
ExecSQL;
|
||
end;
|
||
{if YFData()=False then
|
||
begin
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD>²<EFBFBD><C2B2><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!','<27><>ʾ',0);
|
||
Exit;
|
||
end; }
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
Result := True;
|
||
except
|
||
Result := False;
|
||
MovePanel2.Visible := False;
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣<EFBFBD><ECB3A3>', '<27><>ʾ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmProductOrderAnPai.AOrdDefNote12DblClick(Sender: TObject);
|
||
var
|
||
fsj: string;
|
||
FWZ: Integer;
|
||
begin
|
||
fsj := Trim(TEdit(Sender).Hint);
|
||
FWZ := Pos('/', fsj);
|
||
try
|
||
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag := Copy(fsj, 1, FWZ - 1);
|
||
flagname := Copy(fsj, FWZ + 1, Length(fsj) - FWZ);
|
||
if ShowModal = 1 then
|
||
begin
|
||
TEdit(Sender).Text := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmProductOrderAnPai.AOrdDefNote7BtnDnClick(Sender: TObject);
|
||
begin
|
||
TBtnEditC(Sender).Text := '';
|
||
TBtnEditC(Sender).TxtCode := '';
|
||
end;
|
||
|
||
procedure TfrmProductOrderAnPai.cxTabControl1Change(Sender: TObject);
|
||
begin
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmProductOrderAnPai.ToolButton5Click(Sender: TObject);
|
||
begin
|
||
try
|
||
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag := 'WFBCD';
|
||
flagname := '<27>õ<EFBFBD>';
|
||
fnote := True;
|
||
V1Note.Caption := 'Ӣ<><D3A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
||
if ShowModal = 1 then
|
||
begin
|
||
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmProductOrderAnPai.ToolButton6Click(Sender: TObject);
|
||
var
|
||
fPrintFile: string;
|
||
Txt, fImagePath: string;
|
||
Moudle: THandle;
|
||
Makebar: TMakebar;
|
||
Mixtext: TMixtext;
|
||
begin
|
||
if CDS_Sub.IsEmpty then
|
||
Exit;
|
||
if CDS_Sub.Locate('ssel', true, []) = false then
|
||
begin
|
||
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
|
||
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\<5C><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE><EFBFBD><EFBFBD>ǩ.rmf';
|
||
if not FileExists(fPrintFile) then
|
||
begin
|
||
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + ExtractFilePath(Application.ExeName) + 'Report\<5C><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE><EFBFBD><EFBFBD>ǩ.rmf'), '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
with CDS_Sub do
|
||
begin
|
||
DisableControls;
|
||
First;
|
||
while not eof do
|
||
begin
|
||
if Fieldbyname('ssel').AsBoolean then
|
||
begin
|
||
|
||
with ADOQueryPrint do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('select A.* ');
|
||
sql.Add(',CPKW=(select Top 1 zdyCode from KH_Zdy_Attachment X where X.DEFstr1=A.C_CodeName and X.DEFstr2=A.C_Color)');
|
||
sql.Add(',CPNUM=(select count(CRID) from CK_BanCP_KC X where X.C_CodeName=A.C_CodeName and X.C_Color=A.C_Color)');
|
||
sql.Add(',C_CodeNameZW=(select Top 1 defnote3 from KH_Zdy_Attachment X where X.ZdyName=A.C_CodeName and Type=''CP'') ');
|
||
sql.Add(',C_colorName=(select Top 1 DEFstr6 from KH_Zdy_Attachment X where X.ZdyName=A.C_CodeName and X.DEFstr3=A.C_Color and Type=''CP'') ');
|
||
sql.Add('from JYOrder_Sub_AnPai A ');
|
||
sql.Add('where Apid=' + quotedstr(trim(CDS_Sub.fieldbyname('apid').AsString)));
|
||
open;
|
||
if isempty then
|
||
begin
|
||
CDS_Sub.EnableControls;
|
||
application.MessageBox('<27>˻زֵ<D8B2>δ<EFBFBD><CEB4><EFBFBD>棬<EFBFBD><E6A3AC><EFBFBD>ܱ<EFBFBD><DCB1><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
exit;
|
||
end;
|
||
end;
|
||
try
|
||
Moudle := LoadLibrary('MakeQRBarcode.dll');
|
||
@Makebar := GetProcAddress(Moudle, 'Make');
|
||
@Mixtext := GetProcAddress(Moudle, 'MixText');
|
||
Txt := Trim(ADOQueryPrint.fieldbyname('APID').AsString);
|
||
fImagePath := ExtractFilePath(Application.ExeName) + 'image\temp.bmp';
|
||
if not DirectoryExists(pchar(ExtractFilePath(Application.ExeName) + 'image')) then
|
||
CreateDirectory(pchar(ExtractFilePath(Application.ExeName) + 'image'), nil);
|
||
if FileExists(fImagePath) then
|
||
DeleteFile(fImagePath);
|
||
Makebar(pchar(Txt), Length(Txt), 3, 3, 0, PChar(fImagePath), 3);
|
||
except
|
||
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
|
||
Order_Main.EnableControls;
|
||
exit;
|
||
end;
|
||
|
||
RMVariables['QRBARCODE'] := fImagePath;
|
||
RM1.LoadFromFile(fPrintFile);
|
||
if CheckBox1.Checked then
|
||
RM1.ShowReport
|
||
else
|
||
begin
|
||
RM1.DefaultCopies := strtointdef(trim(edit2.Text), 1);
|
||
RM1.PrintReport;
|
||
end;
|
||
end;
|
||
next;
|
||
end;
|
||
EnableControls;
|
||
First;
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmProductOrderAnPai.Tv4DblClick(Sender: TObject);
|
||
begin
|
||
cxGrid4.Visible := False;
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select *,PBFactory=(select factoryNoName from Contract_Main X where X.mainID=B.frommainID), ');
|
||
sql.Add('fdhNO=(select conNo from Contract_Main X where X.mainID=B.frommainID) ');
|
||
sql.Add('from Contract_Main A');
|
||
sql.Add('inner join Contract_sub B on B.MainID=A.mainID ');
|
||
sql.Add('where A.MainId=''' + Trim(CDS_OrderNo.fieldbyname('MainId').AsString) + '''');
|
||
sql.Add(' and A.conType IN(''<27><><EFBFBD><EFBFBD>ԤͶ<D4A4><CDB6>'',''<27><>Ʒ<EFBFBD><C6B7><EFBFBD>ӹ<EFBFBD>'') ');
|
||
sql.Add(' and isnull(B.C_status,''0'')=''0'' ');
|
||
open;
|
||
end;
|
||
{ with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select D.TpNote,D.gangNo,D.BCGangNO,D.C_Color,C.FirstName,C.FirstNo,C.TPPS,C.TPMQty,C.LLID,C.HXPS,C.HXQty,C.bcpQty,C.HXUnit,C.DHIDHelp,C.DHID,C.TPUnit,A.*,B.* ');
|
||
sql.Add(',PBFactory=(select Top 1 AA.factoryNoName from Contract_Main AA inner join Contract_Cloth_DH BB on AA.MainId=BB.MainId');
|
||
sql.Add(' where BB.DHID=C.DHID)');
|
||
sql.Add(',HCUnit=(select Top 1 AOrddefstr2 from JYOrder_Sub_AnPai AA where AA.SubId=B.SubId)');
|
||
sql.Add('from Contract_Main A inner join Contract_sub B on A.MainId=B.MainId ');
|
||
sql.Add(' inner join Contract_Cloth_LL C on C.OrdSubId=B.SubId');
|
||
sql.Add(' inner join Contract_Cloth_LLMX D on D.MXID=C.LLID');
|
||
sql.Add('where A.MainId='''+Trim(CDS_OrderNo.fieldbyname('MainId').AsString)+'''');
|
||
sql.Add(' and C.JXJGFlag=0 and D.JGType<>''<27>˻<EFBFBD><CBBB><EFBFBD><EFBFBD><EFBFBD>'' ');
|
||
sql.Add(' and exists(select * from Contract_Cloth_LLMX LM where LM.OrdSubId=B.SubId and LM.OrdSubId=C.OrdSubId )');
|
||
// ShowMessage(SQL.Text);
|
||
Open;
|
||
end; }
|
||
SCreateCDS20(ADOQueryTemp, Order_Main);
|
||
SInitCDSData20(ADOQueryTemp, Order_Main);
|
||
|
||
InitGrid();
|
||
BtnEditA1.TxtCode := Trim(Order_Main.fieldbyname('FactoryNo').AsString);
|
||
BtnEditA1.Text := Trim(Order_Main.fieldbyname('FactoryNoName').AsString);
|
||
BtnEditA4.Text := Trim(Order_Main.fieldbyname('PBFactory').AsString);
|
||
end;
|
||
|
||
procedure TfrmProductOrderAnPai.V2Column1PropertiesEditValueChanged(Sender: TObject);
|
||
//var
|
||
//mvalue,FFieldName,mvalue10,mvalue20:String;
|
||
//FHCPS,FHCQty,FHCMQty:Double;
|
||
begin
|
||
{if Trim(CDS_Sub.fieldbyname('AOrddefstr4').AsString)='' then
|
||
begin
|
||
Application.MessageBox('Ⱦ<><C8BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
with Self.ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from Contract_Cloth_LL A ');
|
||
sql.Add(' where A.FirstNo='''+Trim(CDS_Sub.fieldbyname('AOrddefstr5').AsString)+'''');
|
||
sql.Add(' and A.OrdSubId='''+Trim(CDS_Sub.fieldbyname('SubId').AsString)+'''');
|
||
Open;
|
||
end;
|
||
if Self.ADOQueryTemp.IsEmpty then
|
||
begin
|
||
Application.MessageBox('<27><>Ⱦ<EFBFBD><C8BE>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
mvalue:=TcxTextEdit(Sender).EditingText;
|
||
FFieldName:=Trim(Tv2.Controller.FocusedColumn.DataBinding.FilterFieldName);
|
||
if FFieldName='AOrdQty1' then
|
||
begin
|
||
if Trim(CDS_Sub.fieldbyname('AOrddefstr2').AsString)='' then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
end;
|
||
if Trim(mvalue)='' then
|
||
begin
|
||
if FFieldName='ZSXS' then
|
||
mvalue:='1'
|
||
else
|
||
if FFieldName='AOrddefstr2' then
|
||
mvalue:=''
|
||
else
|
||
mvalue:='0';
|
||
end;
|
||
|
||
with CDS_Sub do
|
||
begin
|
||
Edit;
|
||
FieldByName(FFieldName).Value:=Trim(mvalue);
|
||
Post;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('UPdate JYOrder_Sub_AnPai ');
|
||
if Trim(FFieldName)='AOrddefstr2' then
|
||
begin
|
||
sql.Add(' Set '+FFieldName+'='''+Trim(mvalue)+'''');
|
||
end else
|
||
begin
|
||
sql.Add(' Set '+FFieldName+'='+Trim(mvalue));
|
||
end;
|
||
SQL.Add(',Editer='''+Trim(DName)+'''');
|
||
SQL.Add(',Edittime=getdate() ');
|
||
SQL.Add(' where APId='''+Trim(CDS_Sub.fieldbyname('APId').AsString)+'''');
|
||
ExecSQL;
|
||
end;
|
||
if Trim(FFieldName)='AOrdQty2' then
|
||
begin
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select isnull(Sum(AOrdQty2),0) HCPS,isnull(Sum(AOrdQty1),0) HCQty from JYOrder_Sub_AnPai ');
|
||
sql.Add(' where SubId='''+Trim(Order_Main.fieldbyname('SubId').AsString)+'''');
|
||
sql.Add(' and AOrddefstr5='''+Trim(CDS_Sub.fieldbyname('AOrddefstr5').AsString)+'''');
|
||
Open;
|
||
end;
|
||
FHCPS:=ADOQueryTemp.FieldByName('HCPS').Value;
|
||
if FHCPS>0 then
|
||
begin
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from Contract_Cloth_LL where OrdSubId='''+Trim(Order_Main.fieldbyname('SubId').AsString)+'''');
|
||
sql.Add(' and FirstNo='''+Trim(CDS_Sub.fieldbyname('AOrddefstr5').AsString)+'''');
|
||
SQL.Add(' order by LLIdx');
|
||
Open;
|
||
end;
|
||
with ADOQueryTemp do
|
||
begin
|
||
First;
|
||
while (not eof) and (FHCPS>0) do
|
||
begin
|
||
if FHCPS>=FieldByName('TPPS').Value then
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('Update Contract_Cloth_LL Set HCPS=TPPS ');
|
||
sql.Add(' where LLID='''+Trim(ADOQueryTemp.fieldbyname('LLID').AsString)+'''');
|
||
ExecSQL;
|
||
end;
|
||
FHCPS:=FHCPS-FieldByName('TPPS').Value;
|
||
end else
|
||
begin
|
||
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('Update Contract_Cloth_LL Set HCPS='+FloatToStr(FHCPS));
|
||
sql.Add(' where LLID='''+Trim(ADOQueryTemp.fieldbyname('LLID').AsString)+'''');
|
||
ExecSQL;
|
||
end;
|
||
FHCPS:=0;
|
||
end;
|
||
Next;
|
||
end;
|
||
end;
|
||
end;
|
||
end;
|
||
if Trim(FFieldName)='AOrdQty1' then
|
||
begin
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select isnull(Sum(AOrdQty2),0) HCPS,isnull(Sum(AOrdQty1),0) HCQty from JYOrder_Sub_AnPai ');
|
||
sql.Add(' where SubId='''+Trim(Order_Main.fieldbyname('SubId').AsString)+'''');
|
||
sql.Add(' and AOrddefstr5='''+Trim(CDS_Sub.fieldbyname('AOrddefstr5').AsString)+'''');
|
||
Open;
|
||
end;
|
||
FHCQty:=ADOQueryTemp.FieldByName('HCQty').Value;
|
||
if FHCQty>0 then
|
||
begin
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from Contract_Cloth_LL where OrdSubId='''+Trim(Order_Main.fieldbyname('SubId').AsString)+'''');
|
||
sql.Add(' and FirstNo='''+Trim(CDS_Sub.fieldbyname('AOrddefstr5').AsString)+'''');
|
||
SQL.Add(' order by LLIdx');
|
||
Open;
|
||
end;
|
||
with ADOQueryTemp do
|
||
begin
|
||
First;
|
||
while (not eof) and (FHCQty>0) do
|
||
begin
|
||
if FHCQty>=FieldByName('BCPQty').Value then
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('Update Contract_Cloth_LL Set HCQty=BCPQty ');
|
||
sql.Add(' where LLID='''+Trim(ADOQueryTemp.fieldbyname('LLID').AsString)+'''');
|
||
ExecSQL;
|
||
end;
|
||
FHCQty:=FHCQty-FieldByName('BCPQty').Value;
|
||
end else
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('Update Contract_Cloth_LL Set HCQty='+FloatToStr(FHCQty));
|
||
sql.Add(' where LLID='''+Trim(ADOQueryTemp.fieldbyname('LLID').AsString)+'''');
|
||
ExecSQL;
|
||
end;
|
||
FHCQty:=0;
|
||
end;
|
||
Next;
|
||
end;
|
||
end;
|
||
end;
|
||
end;}
|
||
end;
|
||
|
||
procedure TfrmProductOrderAnPai.UpdateHC(FFirstNo: string);
|
||
var
|
||
FHCPS, FHCYZQty, FHCMQty: Double;
|
||
begin
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select isnull(Sum(AOrdQty2),0) HCPS from JYOrder_Sub_AnPai ');
|
||
sql.Add(' where SubId=''' + Trim(Order_Main.fieldbyname('SubId').AsString) + '''');
|
||
sql.Add(' and AOrddefstr5=''' + Trim(FFirstNo) + '''');
|
||
Open;
|
||
end;
|
||
FHCPS := ADOQueryTemp.FieldByName('HCPS').Value;
|
||
if FHCPS = 0 then
|
||
begin
|
||
|
||
end;
|
||
if FHCPS > 0 then
|
||
begin
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from Contract_Cloth_LL where OrdSubId=''' + Trim(Order_Main.fieldbyname('SubId').AsString) + '''');
|
||
sql.Add(' and FirstNo=''' + Trim(FFirstNo) + '''');
|
||
SQL.Add(' order by LLIdx');
|
||
Open;
|
||
end;
|
||
with ADOQueryTemp do
|
||
begin
|
||
First;
|
||
while (not eof) and (FHCPS > 0) do
|
||
begin
|
||
if FHCPS >= FieldByName('TPPS').Value then
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('Update Contract_Cloth_LL Set HCPS=TPPS ');
|
||
sql.Add(' where LLID=''' + Trim(ADOQueryTemp.fieldbyname('LLID').AsString) + '''');
|
||
ExecSQL;
|
||
end;
|
||
FHCPS := FHCPS - FieldByName('TPPS').Value;
|
||
end
|
||
else
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('Update Contract_Cloth_LL Set HCPS=' + FloatToStr(FHCPS));
|
||
sql.Add(' where LLID=''' + Trim(ADOQueryTemp.fieldbyname('LLID').AsString) + '''');
|
||
ExecSQL;
|
||
end;
|
||
FHCPS := 0;
|
||
end;
|
||
Next;
|
||
end;
|
||
end;
|
||
end;
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select isnull(Sum(HCYZQty),0) HCYZQty,isnull(Sum(HCMQty),0) HCMQty from JYOrder_Sub_AnPai ');
|
||
sql.Add(' where SubId=''' + Trim(Order_Main.fieldbyname('SubId').AsString) + '''');
|
||
sql.Add(' and AOrddefstr5=''' + Trim(FFirstNo) + '''');
|
||
Open;
|
||
end;
|
||
FHCYZQty := ADOQueryTemp.FieldByName('HCYZQty').Value;
|
||
FHCMQty := ADOQueryTemp.FieldByName('HCMQty').Value;
|
||
if FHCYZQty >= 0 then
|
||
begin
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from Contract_Cloth_LL where OrdSubId=''' + Trim(Order_Main.fieldbyname('SubId').AsString) + '''');
|
||
sql.Add(' and FirstNo=''' + Trim(FFirstNo) + '''');
|
||
SQL.Add(' order by LLIdx');
|
||
Open;
|
||
end;
|
||
with ADOQueryTemp do
|
||
begin
|
||
First;
|
||
while (not eof) and (FHCYZQty > 0) do
|
||
begin
|
||
if FHCYZQty >= FieldByName('BCPQty').Value then
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('Update Contract_Cloth_LL Set HCQty=BCPQty ');
|
||
sql.Add(' where LLID=''' + Trim(ADOQueryTemp.fieldbyname('LLID').AsString) + '''');
|
||
ExecSQL;
|
||
end;
|
||
FHCYZQty := FHCYZQty - FieldByName('BCPQty').Value;
|
||
end
|
||
else
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('Update Contract_Cloth_LL Set HCQty=' + FloatToStr(FHCYZQty));
|
||
sql.Add(' where LLID=''' + Trim(ADOQueryTemp.fieldbyname('LLID').AsString) + '''');
|
||
ExecSQL;
|
||
end;
|
||
FHCYZQty := 0;
|
||
end;
|
||
Next;
|
||
end;
|
||
end;
|
||
with ADOQueryTemp do
|
||
begin
|
||
First;
|
||
while (not eof) and (FHCMQty > 0) do
|
||
begin
|
||
if FHCMQty >= FieldByName('BCPMQty').Value then
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('Update Contract_Cloth_LL Set HCMQty=BCPMQty ');
|
||
sql.Add(' where LLID=''' + Trim(ADOQueryTemp.fieldbyname('LLID').AsString) + '''');
|
||
ExecSQL;
|
||
end;
|
||
FHCMQty := FHCMQty - FieldByName('BCPMQty').Value;
|
||
end
|
||
else
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('Update Contract_Cloth_LL Set HCMQty=' + FloatToStr(FHCMQty));
|
||
sql.Add(' where LLID=''' + Trim(ADOQueryTemp.fieldbyname('LLID').AsString) + '''');
|
||
ExecSQL;
|
||
end;
|
||
FHCMQty := 0;
|
||
end;
|
||
Next;
|
||
end;
|
||
end;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmProductOrderAnPai.cxGridDBColumn1PropertiesEditValueChanged(Sender: TObject);
|
||
//var
|
||
//mvalue,FFieldName:String;
|
||
begin
|
||
{mvalue:=TcxTextEdit(Sender).EditingText;
|
||
FFieldName:=Trim(Tv2.Controller.FocusedColumn.DataBinding.FilterFieldName);
|
||
with CDS_Sub do
|
||
begin
|
||
Edit;
|
||
FieldByName(FFieldName).Value:=Trim(mvalue);
|
||
Post;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('UPdate JYOrder_Sub_AnPai ');
|
||
if Trim(mvalue)<>'' then
|
||
begin
|
||
sql.Add(' Set '+FFieldName+'='''+Trim(mvalue)+'''');
|
||
end else
|
||
begin
|
||
sql.Add(' Set '+FFieldName+'=NULL');
|
||
end;
|
||
SQL.Add(',Editer='''+Trim(DName)+'''');
|
||
SQL.Add(',Edittime=getdate() ');
|
||
SQL.Add(' where APId='''+Trim(CDS_Sub.fieldbyname('APId').AsString)+'''');
|
||
ExecSQL;
|
||
end; }
|
||
end;
|
||
|
||
procedure TfrmProductOrderAnPai.V2Column4PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||
begin
|
||
try
|
||
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag := 'OrderUnit';
|
||
flagname := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ';
|
||
if ShowModal = 1 then
|
||
begin
|
||
Self.CDS_Sub.Edit;
|
||
Self.CDS_Sub.FieldByName('AOrddefstr2').Value := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('UPdate JYOrder_Sub_AnPai ');
|
||
sql.Add(' Set AOrddefstr2=''' + Trim(ClientDataSet1.fieldbyname('ZDYName').AsString) + '''');
|
||
SQL.Add(',Editer=''' + Trim(DName) + '''');
|
||
SQL.Add(',Edittime=getdate() ');
|
||
SQL.Add(' where APId=''' + Trim(CDS_Sub.fieldbyname('APId').AsString) + '''');
|
||
sql.Add(' UPdate WFB_MJJY Set MJStr1=''' + Trim(ClientDataSet1.fieldbyname('ZDYName').AsString) + '''');
|
||
SQL.Add(' where APId=''' + Trim(CDS_Sub.fieldbyname('APId').AsString) + '''');
|
||
ExecSQL;
|
||
end;
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmProductOrderAnPai.V2Column5PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||
begin
|
||
try
|
||
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag := 'OrderUnit';
|
||
flagname := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ';
|
||
if ShowModal = 1 then
|
||
begin
|
||
Self.CDS_Sub.Edit;
|
||
Self.CDS_Sub.FieldByName('AOrddefstr3').Value := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmProductOrderAnPai.V2Column6PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||
var
|
||
mvalue: string;
|
||
begin
|
||
mvalue := Trim(CDS_Sub.FieldByName('AOrdDefNote1').AsString);
|
||
try
|
||
frmZDYHelpSel := TfrmZDYHelpSel.Create(Application);
|
||
with frmZDYHelpSel do
|
||
begin
|
||
flag := 'JYYQ';
|
||
flagname := '<27><><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA>';
|
||
if ShowModal = 1 then
|
||
begin
|
||
Self.CDS_Sub.Edit;
|
||
Self.CDS_Sub.FieldByName('AOrdDefNote1').Value := mvalue + frmZDYHelpSel.ReturnStr;
|
||
{with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('UPdate JYOrder_Sub_AnPai ');
|
||
sql.Add(' Set AOrdDefNote1='''+Trim(mvalue+frmZDYHelpSel.ReturnStr)+'''');
|
||
SQL.Add(',Editer='''+Trim(DName)+'''');
|
||
SQL.Add(',Edittime=getdate() ');
|
||
SQL.Add(' where APId='''+Trim(CDS_Sub.fieldbyname('APId').AsString)+'''');
|
||
ExecSQL;
|
||
end; }
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelpSel.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmProductOrderAnPai.V2Column8PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||
begin
|
||
try
|
||
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
//flag:='RKPlace';
|
||
flag := 'FactoryNo1Name';
|
||
flagname := 'Ⱦ<><C8BE>';
|
||
MainType := 'Ⱦ<><C8BE>';
|
||
if ShowModal = 1 then
|
||
begin
|
||
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from Contract_Cloth_LL A ');
|
||
sql.Add(' where A.FirstNo=''' + Trim(frmZDYHelp.ClientDataSet1.fieldbyname('ZDYNo').AsString) + '''');
|
||
sql.Add(' and A.OrdSubId=''' + Trim(CDS_Sub.fieldbyname('SubId').AsString) + '''');
|
||
Open;
|
||
end;
|
||
if ADOQueryTemp.IsEmpty then
|
||
begin
|
||
Application.MessageBox('<27><>Ⱦ<EFBFBD><C8BE>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
|
||
end
|
||
else
|
||
begin
|
||
with CDS_Sub do
|
||
begin
|
||
Edit;
|
||
FieldByName('AOrddefstr4').Value := Trim(frmZDYHelp.ClientDataSet1.fieldbyname('ZDYName').AsString);
|
||
FieldByName('AOrddefstr5').Value := Trim(frmZDYHelp.ClientDataSet1.fieldbyname('ZDYNo').AsString);
|
||
end;
|
||
{with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('UPdate JYOrder_Sub_AnPai ');
|
||
sql.Add(' Set AOrddefstr5='''+Trim(ClientDataSet1.fieldbyname('ZDYNo').AsString)+'''');
|
||
sql.Add(' ,AOrddefstr4='''+Trim(ClientDataSet1.fieldbyname('ZDYName').AsString)+'''');
|
||
SQL.Add(',Editer='''+Trim(DName)+'''');
|
||
SQL.Add(',Edittime=getdate() ');
|
||
SQL.Add(' where APId='''+Trim(CDS_Sub.fieldbyname('APId').AsString)+'''');
|
||
ExecSQL;
|
||
end;}
|
||
end;
|
||
|
||
end;
|
||
end;
|
||
finally
|
||
//frmZDYHelp.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmProductOrderAnPai.ToolButton4Click(Sender: TObject);
|
||
var
|
||
FDW: string;
|
||
begin
|
||
ConNo.SetFocus;
|
||
|
||
MovePanel2.Visible := True;
|
||
MovePanel2.Refresh;
|
||
if SaveData10() then
|
||
begin
|
||
MovePanel2.Visible := False;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>!', '<27><>ʾ', 0);
|
||
initRoll();
|
||
fRoll := true;
|
||
Exit;
|
||
end;
|
||
MovePanel2.Visible := False;
|
||
end;
|
||
|
||
procedure TfrmProductOrderAnPai.BtnEditA1BtnClick(Sender: TObject);
|
||
begin
|
||
{ try
|
||
frmZDYHelp:=TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag:='FactoryNo1Name';
|
||
flagname:='Ⱦ<><C8BE>';
|
||
MainType:='Ⱦ<><C8BE>';
|
||
if ShowModal=1 then
|
||
begin
|
||
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from Contract_Cloth_LL A ');
|
||
sql.Add(' where A.FirstNo='''+Trim(frmZDYHelp.ClientDataSet1.fieldbyname('ZDYNo').AsString)+'''');
|
||
sql.Add(' and A.OrdSubId='''+Trim(Order_Main.fieldbyname('SubId').AsString)+'''');
|
||
Open;
|
||
end;
|
||
if ADOQueryTemp.IsEmpty then
|
||
begin
|
||
Application.MessageBox('<27><>Ⱦ<EFBFBD><C8BE>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
||
|
||
end else
|
||
begin
|
||
BtnEditA1.Text:=Trim(frmZDYHelp.ClientDataSet1.fieldbyname('ZDYName').AsString);
|
||
BtnEditA1.TxtCode:=Trim(frmZDYHelp.ClientDataSet1.fieldbyname('ZDYNo').AsString);
|
||
end;
|
||
|
||
end;
|
||
end;
|
||
finally
|
||
//frmZDYHelp.Free;
|
||
end;}
|
||
|
||
try
|
||
frmZdyAttachGYS := TfrmZdyAttachGYS.Create(Application);
|
||
with frmZdyAttachGYS do
|
||
begin
|
||
if ShowModal = 1 then
|
||
begin
|
||
BtnEditA1.Text := Trim(CDS_HZ.fieldbyname('ZDYName').AsString);
|
||
BtnEditA1.TxtCode := Trim(CDS_HZ.fieldbyname('ZdyCode').AsString);
|
||
end;
|
||
end;
|
||
finally
|
||
frmZdyAttachGYS.Free;
|
||
end;
|
||
end;
|
||
|
||
function TfrmProductOrderAnPai.YFData(): Boolean;
|
||
var
|
||
CRID, OrdMainId, YFID, Price, LLID: string;
|
||
begin
|
||
Result := False;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('delete YF_Money_CR where YFTypeID=''' + Trim(CDS_Sub.fieldbyname('APID').AsString) + '''');
|
||
ExecSQL;
|
||
end;
|
||
OrdMainId := Trim(Order_Main.fieldbyname('MainId').AsString);
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select * from YF_Money_KC where FactoryName=''' + Trim(CDS_Sub.fieldbyname('AOrddefstr4').AsString) + '''');
|
||
Open;
|
||
end;
|
||
if ADOQueryCmd.IsEmpty = False then
|
||
begin
|
||
CRID := ADOQueryCmd.fieldbyname('CRID').AsString;
|
||
end
|
||
else
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('Update YF_Money_CRID set CRID=CRID+1');
|
||
sql.Add('select * from YF_Money_CRID ');
|
||
Open;
|
||
end;
|
||
CRID := ADOQueryCmd.fieldbyname('CRID').AsString;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select * from YF_Money_KC where 1<>1');
|
||
Open;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Append;
|
||
FieldByName('CRID').Value := StrToInt(CRID);
|
||
FieldByName('FactoryName').Value := Trim(Order_Main.fieldbyname('FactoryNoName').AsString);
|
||
FieldByName('ZdyStr1').Value := 'Ӧ<><D3A6><EFBFBD><EFBFBD>';
|
||
Post;
|
||
end;
|
||
end;
|
||
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from YF_Money_CR where YFTypeID=''' + Trim(CDS_Sub.fieldbyname('APID').AsString) + '''');
|
||
sql.Add('and YFName IN(''<27>ӹ<EFBFBD><D3B9><EFBFBD>'',''<27><><EFBFBD><EFBFBD>'') ');
|
||
Open;
|
||
end;
|
||
if ADOQueryTemp.IsEmpty then
|
||
begin
|
||
if GetLSNo(ADOQueryCmd, YFID, 'RJ', 'YF_Money_CR', 3, 1) = False then
|
||
begin
|
||
Application.MessageBox('ȡȾ<C8A1><C8BE>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
end
|
||
else
|
||
begin
|
||
YFID := Trim(ADOQueryTemp.fieldbyname('YFID').AsString);
|
||
end;
|
||
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from YF_Money_CR where YFID=''' + Trim(YFID) + '''');
|
||
Open;
|
||
end;
|
||
|
||
with ADOQueryCmd do
|
||
begin
|
||
if ADOQueryTemp.IsEmpty then
|
||
Append
|
||
else
|
||
Edit;
|
||
FieldByName('YFID').Value := Trim(YFID);
|
||
FieldByName('YFTypeId').Value := Trim(CDS_Sub.fieldbyname('APId').AsString);
|
||
FieldByName('CRID').Value := StrToInt(CRID);
|
||
FieldByName('Filler').Value := Trim(DName);
|
||
FieldByName('CRType').Value := 'Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD>Ǽ<EFBFBD>';
|
||
FieldByName('CRFlag').Value := 'Ӧ<><D3A6><EFBFBD><EFBFBD>';
|
||
FieldByName('QtyFlag').Value := 1;
|
||
FieldByName('FactoryName').Value := Trim(CDS_Sub.fieldbyname('AOrddefstr4').AsString);
|
||
FieldByName('CRTime').Value := CDS_Sub.fieldbyname('ADefDate1').Value;
|
||
// FieldByName('Qty').Value:=CDS_Sub.fieldbyname('AOrdQty1').Value;
|
||
FieldByName('YFType').Value := '<27>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>';
|
||
FieldByName('Price').Value := 0;
|
||
FieldByName('HuiLv').Value := 1;
|
||
FieldByName('BZType').Value := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
||
FieldByName('ComTaiTou').Value := Trim(CDS_Sub.fieldbyname('AOrddefstr4').AsString);
|
||
FieldByName('QtyUnit').Value := Trim(CDS_Sub.fieldbyname('AOrddefstr2').AsString);
|
||
if trim(Order_Main.FieldByName('conTk1').AsString) = '<27><><EFBFBD>ӹ<DEBC>' then
|
||
FieldByName('YFName').Value := '<27><><EFBFBD><EFBFBD>'
|
||
else
|
||
FieldByName('YFName').Value := '<27>ӹ<EFBFBD><D3B9><EFBFBD>';
|
||
FieldByName('ps').Value := CDS_Sub.fieldbyname('AOrdQty2').AsFloat;
|
||
FieldByName('Qty').Value := CDS_Sub.fieldbyname('AOrdQty1').AsFloat;
|
||
|
||
FieldByName('MainId').Value := Trim(Order_Main.fieldbyname('mainID').AsString);
|
||
FieldByName('subID').Value := Trim(Order_Main.fieldbyname('subID').AsString);
|
||
FieldByName('P_CodeName').Value := Trim(CDS_Sub.fieldbyname('C_CodeName').AsString);
|
||
FieldByName('P_Color').Value := Trim(CDS_Sub.fieldbyname('C_color').AsString);
|
||
|
||
FieldByName('Price').Value := getPrice(FieldByName('FactoryName').AsString, FieldByName('P_CodeName').AsString, FieldByName('P_COlor').AsString, FieldByName('YFName').AsString);
|
||
|
||
if trim(Order_Main.FieldByName('conTk1').AsString) = '<27><><EFBFBD><EFBFBD><EFBFBD>ӹ<EFBFBD>' then
|
||
FieldByName('fstr1').Value := '<27><><EFBFBD>ӹ<EFBFBD>'
|
||
else if trim(Order_Main.FieldByName('conTk1').AsString) = '<27><><EFBFBD>ӹ<DEBC>' then
|
||
FieldByName('fstr1').Value := '<27><><EFBFBD>ӹ<DEBC>'
|
||
else
|
||
FieldByName('fstr1').Value := '<27><><EFBFBD><EFBFBD><EFBFBD>ӹ<EFBFBD>';
|
||
FieldByName('note').Value := Trim(CDS_Sub.fieldbyname('AOrdDefNote1').AsString);
|
||
Post;
|
||
end;
|
||
|
||
{ with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('update YF_Money_CR Set Qty=(select isnull(Sum(AOrdQty1),0) from JYOrder_Sub_AnPai A ');
|
||
sql.Add(' where A.mainID=YF_Money_CR.mainID and A.subiD=YF_Money_CR.subiD )');
|
||
sql.Add(',PS=(select isnull(sum(AOrdQty2),0) from JYOrder_Sub_AnPai A ');
|
||
sql.Add(' where A.mainID=YF_Money_CR.mainID and A.subiD=YF_Money_CR.subiD )');
|
||
sql.Add(' where YFID='''+Trim(YFID)+'''');
|
||
ExecSQL;
|
||
END; }
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('delete from YF_Money_CR ');
|
||
sql.Add('where YFID=''' + Trim(YFID) + ''' and Qty=0 ');
|
||
ExecSQL;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('Update YF_Money_CR Set Money=Price*Qty,BBMoney=Price*Qty');
|
||
sql.Add(' where YFID=''' + Trim(YFID) + '''');
|
||
ExecSQL;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('Update YF_Money_KC Set KCMoney=(select isnull(Sum(Money*QtyFlag),0) from YF_Money_CR A where A.CRID=YF_Money_KC.CRID)');
|
||
sql.Add(',KCBBMoney=(select isnull(Sum(BBMoney*QtyFlag),0) from YF_Money_CR A where A.CRID=YF_Money_KC.CRID)');
|
||
sql.Add(' where CRID=' + CRID);
|
||
ExecSQL;
|
||
end;
|
||
Result := True;
|
||
end;
|
||
|
||
function TfrmProductOrderAnPai.DELYFData(): Boolean;
|
||
var
|
||
CRID, OrdMainId, YFID, Price, LLID: string;
|
||
begin
|
||
Result := False;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('delete YF_Money_CR where YFTypeID=''' + Trim(CDS_Sub.fieldbyname('APID').AsString) + '''');
|
||
ExecSQL;
|
||
end;
|
||
OrdMainId := Trim(Order_Main.fieldbyname('MainId').AsString);
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select * from YF_Money_KC where FactoryName=''' + Trim(Order_Main.fieldbyname('FirstName').AsString) + '''');
|
||
Open;
|
||
end;
|
||
if ADOQueryTemp.IsEmpty = False then
|
||
begin
|
||
CRID := ADOQueryTemp.fieldbyname('CRID').AsString;
|
||
end
|
||
else
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('Update YF_Money_CRID set CRID=CRID+1');
|
||
sql.Add('select * from YF_Money_CRID ');
|
||
Open;
|
||
end;
|
||
CRID := ADOQueryCmd.fieldbyname('CRID').AsString;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select * from YF_Money_KC where 1<>1');
|
||
Open;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Append;
|
||
FieldByName('CRID').Value := StrToInt(CRID);
|
||
FieldByName('FactoryName').Value := Trim(Order_Main.fieldbyname('FirstName').AsString);
|
||
FieldByName('ZdyStr1').Value := 'Ӧ<><D3A6><EFBFBD><EFBFBD>';
|
||
Post;
|
||
end;
|
||
end;
|
||
begin
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('select Case when HXQty>0 then HCQty-HXQty else HCQty end as HCQty');
|
||
SQL.Add(',Case when HXPS>0 then HCPS-HXPS else HCPS end as HCPS');
|
||
SQL.Add(' from Contract_Cloth_LL where LLID=''' + Trim(Order_Main.fieldbyname('LLID').AsString) + '''');
|
||
Open;
|
||
end;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('Update YF_Money_KC Set KCMoney=(select isnull(Sum(Money*QtyFlag),0) from YF_Money_CR A where A.CRID=YF_Money_KC.CRID)');
|
||
sql.Add(',KCBBMoney=(select isnull(Sum(BBMoney*QtyFlag),0) from YF_Money_CR A where A.CRID=YF_Money_KC.CRID)');
|
||
sql.Add(' where CRID=' + CRID);
|
||
ExecSQL;
|
||
end;
|
||
Result := True;
|
||
end;
|
||
|
||
procedure TfrmProductOrderAnPai.BtnEditA2BtnClick(Sender: TObject);
|
||
begin
|
||
try
|
||
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag := 'OrderUnit';
|
||
flagname := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ';
|
||
if ShowModal = 1 then
|
||
begin
|
||
BtnEditA2.Text := Trim(ClientDataSet1.fieldbyname('ZdyName').AsString);
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmProductOrderAnPai.BtnEditA3BtnClick(Sender: TObject);
|
||
begin
|
||
try
|
||
frmZDYHelpSel := TfrmZDYHelpSel.Create(Application);
|
||
with frmZDYHelpSel do
|
||
begin
|
||
flag := 'JYYQ';
|
||
flagname := '<27><><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA>';
|
||
if ShowModal = 1 then
|
||
begin
|
||
BtnEditA3.Text := Trim(BtnEditA3.Text) + frmZDYHelpSel.ReturnStr;
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelpSel.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmProductOrderAnPai.ToolButton8Click(Sender: TObject);
|
||
begin
|
||
CDS_Sub.DisableControls;
|
||
with CDS_Sub do
|
||
begin
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
Edit;
|
||
FieldByName('SSel').Value := True;
|
||
Post;
|
||
Next;
|
||
end;
|
||
end;
|
||
CDS_Sub.EnableControls;
|
||
end;
|
||
|
||
procedure TfrmProductOrderAnPai.ToolButton7Click(Sender: TObject);
|
||
begin
|
||
CDS_Sub.DisableControls;
|
||
with CDS_Sub do
|
||
begin
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
Edit;
|
||
FieldByName('SSel').Value := False;
|
||
Post;
|
||
Next;
|
||
end;
|
||
end;
|
||
CDS_Sub.EnableControls;
|
||
end;
|
||
|
||
procedure TfrmProductOrderAnPai.BtnEditA4BtnClick(Sender: TObject);
|
||
begin
|
||
{ try
|
||
frmZDYHelp:=TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag:='FactoryNo1Name';
|
||
flagname:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
||
MainType:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
||
if ShowModal=1 then
|
||
begin
|
||
BtnEditA4.Text:=Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.Free;
|
||
end; }
|
||
|
||
try
|
||
frmZdyAttachGYS := TfrmZdyAttachGYS.Create(Application);
|
||
with frmZdyAttachGYS do
|
||
begin
|
||
if ShowModal = 1 then
|
||
begin
|
||
BtnEditA1.Text := Trim(CDS_HZ.fieldbyname('ZDYName').AsString);
|
||
BtnEditA1.TxtCode := Trim(CDS_HZ.fieldbyname('ZdyCode').AsString);
|
||
end;
|
||
end;
|
||
finally
|
||
frmZdyAttachGYS.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmProductOrderAnPai.V2Column11PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||
begin
|
||
try
|
||
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag := 'FactoryNo1Name';
|
||
flagname := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
||
MainType := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
||
if ShowModal = 1 then
|
||
begin
|
||
begin
|
||
with CDS_Sub do
|
||
begin
|
||
Edit;
|
||
FieldByName('AOrddefstr6').Value := Trim(frmZDYHelp.ClientDataSet1.fieldbyname('ZDYName').AsString);
|
||
end;
|
||
end;
|
||
|
||
end;
|
||
end;
|
||
finally
|
||
//frmZDYHelp.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmProductOrderAnPai.ToolButton9Click(Sender: TObject);
|
||
begin
|
||
try
|
||
frmBefChkHX := TfrmBefChkHX.Create(Application);
|
||
with frmBefChkHX do
|
||
begin
|
||
orderno.Caption := Trim(Self.Order_Main.fieldbyname('OrderNo').AsString);
|
||
PRTColor.Caption := Trim(Self.Order_Main.fieldbyname('PRTColor').AsString);
|
||
FirstName.Caption := Trim(Self.Order_Main.fieldbyname('FirstName').AsString);
|
||
PBFactory.Caption := Trim(Self.Order_Main.fieldbyname('PBFactory').AsString);
|
||
FLLID := Trim(Self.Order_Main.fieldbyname('LLID').AsString);
|
||
with ADOQuery1 do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from Contract_Cloth_BefChkHX where LLID=''' + Trim(Order_Main.fieldbyname('LLID').AsString) + '''');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQuery1, ClientDataSet1);
|
||
SInitCDSData20(ADOQuery1, ClientDataSet1);
|
||
if ShowModal = 1 then
|
||
begin
|
||
|
||
end;
|
||
end;
|
||
finally
|
||
frmBefChkHX.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmProductOrderAnPai.ToolButton10Click(Sender: TObject);
|
||
begin
|
||
with ADOQuery_Tp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
// sql.Add('select AA.* from ( ');
|
||
sql.Add('select *,PBFactory=(select factoryNoName from Contract_Main X where X.mainID=B.frommainID), ');
|
||
sql.Add('case when isnull(C_note,'''')<>'''' then C_note else (select top 1 note from CK_BanCP_CR C where C.ckOrdNo=A.conTk2 ) end as C_note1,');
|
||
sql.Add('fdhNO=(select conNo from Contract_Main X where X.mainID=B.frommainID), ');
|
||
sql.Add('H_gs=isnull((select count(APID) from JYOrder_Sub_AnPai X where X.mainID=B.mainID and X.subID=B.subID),0)');
|
||
sql.Add('from Contract_Main A');
|
||
sql.Add('inner join Contract_sub B on B.MainID=A.mainID ');
|
||
// sql.Add('where A.MainId='''+Trim(CDS_OrderNo.fieldbyname('MainId').AsString)+'''');
|
||
sql.Add('where A.conNO like ' + quotedstr('%' + trim(CONnO.Text) + '%'));
|
||
sql.Add('and A.FactoryNoName like ' + quotedstr('%' + trim(FactoryNoName.Text) + '%'));
|
||
sql.Add('and B.C_CodeName like ' + quotedstr('%' + trim(C_CodeName.Text) + '%'));
|
||
sql.Add('and B.C_Color like ' + quotedstr('%' + trim(C_Color.Text) + '%'));
|
||
sql.Add('and A.conType IN(''<27><><EFBFBD><EFBFBD>ԤͶ<D4A4><CDB6>'',''<27><>Ʒ<EFBFBD><C6B7><EFBFBD>ӹ<EFBFBD>'',''<27><>ɫ<EFBFBD>ƻ<EFBFBD>'') ');
|
||
sql.Add('and isnull(B.C_status,''0'')=''0'' ');
|
||
if not CheckBox_XS.Checked then
|
||
sql.Add('and Qty2>isnull((select count(APID) from JYOrder_Sub_AnPai X where X.mainID=B.mainID and X.subID=B.subID),0) ');
|
||
sql.Add('and A.FillTime>=''2023-01-01'' ');
|
||
// sql.Add(' )AA where Qty>HCgangNum');
|
||
// ShowMessage(SQL.text);
|
||
open;
|
||
end;
|
||
SCreateCDS20(ADOQuery_Tp, Order_Main);
|
||
SInitCDSData20(ADOQuery_Tp, Order_Main);
|
||
|
||
InitGrid();
|
||
BtnEditA1.TxtCode := Trim(Order_Main.fieldbyname('FactoryNo').AsString);
|
||
BtnEditA1.Text := Trim(Order_Main.fieldbyname('FactoryNoName').AsString);
|
||
BtnEditA4.Text := Trim(Order_Main.fieldbyname('PBFactory').AsString);
|
||
|
||
TBfind.Click;
|
||
end;
|
||
|
||
procedure TfrmProductOrderAnPai.ToolButton12Click(Sender: TObject);
|
||
begin
|
||
if cds_Roll.IsEmpty then
|
||
exit;
|
||
|
||
{ with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('delete JYOrder_Sub_AnPai_MX where APID='''+Trim(CDS_Roll.fieldbyname('APID').AsString)+'''');
|
||
sql.Add('and APsubID='''+Trim(CDS_Roll.fieldbyname('APsubID').AsString)+'''');
|
||
ExecSQL;
|
||
end; }
|
||
cds_Roll.Delete;
|
||
end;
|
||
|
||
procedure TfrmProductOrderAnPai.TV3CustomDrawIndicatorCell(Sender: TcxGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxCustomGridIndicatorItemViewInfo; var ADone: Boolean);
|
||
var
|
||
FValue: string;
|
||
FBounds: TRect;
|
||
begin
|
||
if (AViewInfo is TcxGridIndicatorRowItemViewInfo) then
|
||
begin
|
||
FValue := IntToStr(TcxGridIndicatorRowItemViewInfo(AViewInfo).GridRecord.Index + 1);
|
||
FBounds := AViewInfo.Bounds;
|
||
ACanvas.FillRect(FBounds);
|
||
ACanvas.DrawComplexFrame(FBounds, clBtnHighlight, clBtnShadow, [bBottom, bLeft, bRight], 1);
|
||
InflateRect(FBounds, -1, -1);
|
||
ACanvas.Font.Color := clBlack;
|
||
ACanvas.Brush.Style := bsClear;
|
||
ACanvas.DrawText(FValue, FBounds, cxAlignCenter or cxAlignTop);
|
||
ADone := True;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmProductOrderAnPai.Edit1KeyPress(Sender: TObject; var Key: Char);
|
||
var
|
||
fAPTM: string;
|
||
begin
|
||
if cds_sub.IsEmpty then
|
||
exit;
|
||
if Key = #13 then
|
||
begin
|
||
if GetLSNo(ADOQueryCmd, fAPTM, '', 'APTM', 4, 1) = False then
|
||
begin
|
||
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
with CDS_Roll do
|
||
begin
|
||
DisableControls;
|
||
last;
|
||
append;
|
||
FieldByName('AOrdQty1').Value := strtofloatdef(trim(edit1.Text), 0);
|
||
FieldByName('AOrdQty2').Value := 1;
|
||
FieldByName('apid').Value := CDS_Sub.fieldbyname('apid').AsString;
|
||
FieldByName('Aorddefstr1').Value := '<27><>Ʒ';
|
||
FieldByName('APTM').Value := trim(fAPTM);
|
||
post;
|
||
EnableControls;
|
||
end;
|
||
self.tv3.Controller.EditingController.ShowEdit();
|
||
edit1.text := '';
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmProductOrderAnPai.cxCurrencyEdit1KeyPress(Sender: TObject; var Key: Char);
|
||
var
|
||
fAPTM: string;
|
||
begin
|
||
{ if cds_sub.IsEmpty then exit;
|
||
if key=#13 then
|
||
begin
|
||
with CDS_Roll do
|
||
begin
|
||
DisableControls;
|
||
first;
|
||
while not eof do
|
||
begin
|
||
edit;
|
||
FieldByName('AOrdQty3').Value:=FieldByName('AOrdQty1').AsFloat* strtofloatdef(trim(cxCurrencyEdit1.Text),0);
|
||
Post;
|
||
next;
|
||
end;
|
||
first;
|
||
EnableControls;
|
||
end;
|
||
self.tv3.Controller.EditingController.ShowEdit();
|
||
end; }
|
||
|
||
|
||
if Key = #13 then
|
||
begin
|
||
if cds_sub.IsEmpty then
|
||
exit;
|
||
with ADOQueryCmd do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('select * from JYOrder_Sub_AnPai ');
|
||
sql.Add('where Apid=' + quotedstr(trim(CDS_Roll.fieldbyname('apid').AsString)));
|
||
open;
|
||
if isempty then
|
||
begin
|
||
application.MessageBox('<27>˻زֵ<D8B2>δ<EFBFBD><CEB4><EFBFBD>棬<EFBFBD><E6A3AC><EFBFBD>ܱ<EFBFBD><DCB1><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
exit;
|
||
end;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('select * from WFB_MJJY ');
|
||
sql.Add('where MJID=' + quotedstr(trim(CDS_Roll.fieldbyname('apTm').AsString)));
|
||
sql.Add('and mjstr2<>' + quotedstr(trim('δ<><CEB4><EFBFBD><EFBFBD>')));
|
||
open;
|
||
if not isempty then
|
||
begin
|
||
application.MessageBox('<27>˻زֵ<D8B2><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
exit;
|
||
end;
|
||
end;
|
||
|
||
with CDS_Roll do
|
||
begin
|
||
if (Eof) and (fieldbyname('AOrdQty3').AsFloat <> 0) then
|
||
begin
|
||
if GetLSNo(ADOQueryCmd, fAPTM, '', 'APTM', 4, 1) = False then
|
||
begin
|
||
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
append;
|
||
FieldByName('AOrdQty1').Value := 0;
|
||
FieldByName('AOrdQty2').Value := 1;
|
||
FieldByName('apid').Value := CDS_Sub.fieldbyname('apid').AsString;
|
||
FieldByName('Aorddefstr1').Value := '<27><>Ʒ';
|
||
FieldByName('APTM').Value := trim(fAPTM);
|
||
post;
|
||
end;
|
||
edit;
|
||
FieldByName('AOrdQty3').Value := strtofloatdef(trim(cxCurrencyEdit1.Text), 0);
|
||
Post;
|
||
if not SaveMJID() then
|
||
begin
|
||
edit;
|
||
FieldByName('AOrdQty3').Value := 0;
|
||
Post;
|
||
application.MessageBox('<27><><EFBFBD>ݱ<EFBFBD><DDB1><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
self.tv3.Controller.EditingController.ShowEdit();
|
||
exit;
|
||
end;
|
||
next;
|
||
end;
|
||
self.tv3.Controller.EditingController.ShowEdit();
|
||
cxCurrencyEdit1.text := '';
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmProductOrderAnPai.Button1Click(Sender: TObject);
|
||
begin
|
||
Edit1.SetFocus;
|
||
|
||
if strtofloatdef(trim(edit3.Text), 0) <> CDS_Roll.RecordCount then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD>ƥ<EFBFBD><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȷ!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
|
||
if strtofloatdef(trim(edit4.Text), 0) <> tv3.DataController.Summary.FooterSummaryValues[2] then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȷ!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
|
||
with ADOQueryCmd do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('select * from JYOrder_Sub_AnPai ');
|
||
sql.Add('where apid=' + quotedstr(trim(CDS_Sub.fieldbyname('apid').AsString)));
|
||
open;
|
||
if isempty then
|
||
begin
|
||
application.MessageBox('<27>˻زֵ<D8B2>δ<EFBFBD><CEB4><EFBFBD>棬<EFBFBD><E6A3AC><EFBFBD>ܼ<EFBFBD><DCBC>鱣<EFBFBD><E9B1A3>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
exit;
|
||
end;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('select * from WFB_MJJY ');
|
||
sql.Add('where apid=' + quotedstr(trim(CDS_Sub.fieldbyname('apid').AsString)));
|
||
sql.Add('and mjstr2<>' + quotedstr(trim('δ<><CEB4><EFBFBD><EFBFBD>')));
|
||
open;
|
||
if not isempty then
|
||
begin
|
||
application.MessageBox('<27>˻زֵ<D8B2><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
exit;
|
||
end;
|
||
end;
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
try
|
||
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('delete from JYOrder_Sub_AnPai_MX where APId=''' + Trim(CDS_Sub.fieldbyname('APId').AsString) + '''');
|
||
execsql;
|
||
end;
|
||
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select * from JYOrder_Sub_AnPai_MX where APId=''' + Trim(CDS_Sub.fieldbyname('APId').AsString) + '''');
|
||
Open;
|
||
end;
|
||
CDS_Roll.DisableControls;
|
||
CDS_Roll.First;
|
||
while not CDS_Roll.Eof do
|
||
begin
|
||
if trim(CDS_Roll.fieldbyname('apid').AsString) = '' then
|
||
CDS_Roll.delete;
|
||
with ADOQueryCmd do
|
||
begin
|
||
append;
|
||
FieldByName('ApId').Value := Trim(CDS_Sub.fieldbyname('apid').AsString);
|
||
FieldByName('ApsubId').Value := CDS_Roll.recNo;
|
||
FieldByName('APTM').Value := Trim(CDS_Sub.fieldbyname('APTM').AsString);
|
||
FieldByName('AOrdQty2').Value := CDS_Roll.fieldbyname('AOrdQty2').AsInteger;
|
||
FieldByName('AOrdQty1').Value := CDS_Roll.fieldbyname('AOrdQty1').AsFloat;
|
||
FieldByName('AOrdQty3').Value := CDS_Roll.fieldbyname('AOrdQty3').AsFloat;
|
||
FieldByName('AorddefNote1').Value := Trim(CDS_Roll.fieldbyname('AorddefNote1').AsString);
|
||
FieldByName('Aorddefstr1').Value := Trim(CDS_Roll.fieldbyname('Aorddefstr1').AsString);
|
||
post;
|
||
end;
|
||
CDS_Roll.Next;
|
||
end;
|
||
CDS_Roll.EnableControls;
|
||
|
||
with ADOQueryCmd do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('delete from WFB_MJJY ');
|
||
sql.Add('where apid=' + quotedstr(trim(CDS_Sub.fieldbyname('apid').AsString)));
|
||
execsql;
|
||
end;
|
||
|
||
CDS_Roll.DisableControls;
|
||
CDS_Roll.First;
|
||
while not CDS_Roll.Eof do
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('select * from WFB_MJJY ');
|
||
sql.Add('where 1=2 ');
|
||
open;
|
||
append;
|
||
FieldByName('MainId').value := Trim(cds_sub.fieldbyname('mainiD').AsString);
|
||
FieldByName('SubId').value := Trim(cds_sub.fieldbyname('subid').AsString);
|
||
FieldByName('conNo').Value := Trim(cds_sub.fieldbyname('conNo').AsString);
|
||
FieldByName('APId').value := Trim(cds_sub.fieldbyname('apid').AsString);
|
||
FieldByName('MJID').Value := Trim(CDS_Sub.fieldbyname('APTM').AsString);
|
||
FieldByName('MJSTr1').value := Trim(cds_sub.fieldbyname('AOrddefstr2').AsString);
|
||
FieldByName('MJTypeOther').value := Trim(cds_sub.fieldbyname('AOrddefstr3').AsString);
|
||
FieldByName('MJStr2').Value := 'δ<><CEB4><EFBFBD><EFBFBD>';
|
||
FieldByName('MJType').Value := Trim(CDS_Roll.fieldbyname('Aorddefstr1').AsString);
|
||
FieldByName('Filler').Value := Trim(DName);
|
||
FieldByName('MJLen').Value := CDS_Roll.fieldbyname('AOrdQty3').AsFloat;
|
||
FieldByName('MJQty1').Value := CDS_Roll.fieldbyname('AOrdQty1').AsFloat;
|
||
FieldByName('MJxh').Value := CDS_Roll.fieldbyname('apsubid').AsFloat;
|
||
FieldByName('note').Value := Trim(CDS_Roll.fieldbyname('AorddefNote1').AsString);
|
||
post;
|
||
end;
|
||
CDS_Roll.Next;
|
||
end;
|
||
CDS_Roll.EnableControls;
|
||
CDS_Roll.First;
|
||
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
application.MessageBox('<27><><EFBFBD>鱣<EFBFBD><E9B1A3><EFBFBD>ɹ<EFBFBD>!', '<27><>ʾ<EFBFBD><CABE>Ϣ');
|
||
except
|
||
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
application.MessageBox('<27><><EFBFBD>鱣<EFBFBD><E9B1A3>ʧ<EFBFBD><CAA7>!', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmProductOrderAnPai.V2Column13PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||
begin
|
||
try
|
||
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag := 'OrdColor';
|
||
flagname := '<27><>ɫ';
|
||
V1Name.Caption := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
||
V1Note.Caption := 'Ӣ<><D3A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
||
MainType := Trim(DName);
|
||
// fnote:=True;
|
||
if ShowModal = 1 then
|
||
begin
|
||
Self.CDS_Sub.Edit;
|
||
Self.CDS_Sub.FieldByName('C_color').Value := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString) + '#';
|
||
;
|
||
// Self.CDS_Sub.FieldByName('SOrddefstr4').Value:=Trim(ClientDataSet1.fieldbyname('Note').AsString);
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmProductOrderAnPai.Button2Click(Sender: TObject);
|
||
begin
|
||
if CDS_Sub.IsEmpty then
|
||
Exit;
|
||
if Trim(CDS_Sub.fieldbyname('APID').AsString) <> '' then
|
||
begin
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select Top 1* from CK_BanCP_CR where APID=''' + Trim(CDS_Sub.fieldbyname('APID').AsString) + '''');
|
||
Open;
|
||
end;
|
||
if ADOQueryTemp.IsEmpty = False then
|
||
begin
|
||
Application.MessageBox('<27>Ѳ<EFBFBD><D1B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݲ<EFBFBD><DDB2><EFBFBD>ɾ<EFBFBD><C9BE>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
||
Exit;
|
||
try
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('update JYOrder_Sub_AnPai_MX SET AOrdQty3=0 where APID=''' + Trim(CDS_Sub.fieldbyname('APID').AsString) + '''');
|
||
sql.Add('delete WFB_MJJY where APID=''' + Trim(CDS_Sub.fieldbyname('APID').AsString) + '''');
|
||
ExecSQL;
|
||
end;
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
InitRoll();
|
||
except
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
end;
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmProductOrderAnPai.V2Column13PropertiesEditValueChanged(Sender: TObject);
|
||
var
|
||
mvalue: string;
|
||
begin
|
||
mvalue := TcxTextEdit(Sender).EditingText;
|
||
|
||
if trim(mvalue) = '' then
|
||
exit;
|
||
|
||
if rightBstr(trim(mvalue), 1) <> '#' then
|
||
begin
|
||
mvalue := trim(mvalue) + '#';
|
||
end;
|
||
|
||
with CDS_Sub do
|
||
begin
|
||
Edit;
|
||
FieldByName('C_Color').Value := Trim(mvalue);
|
||
Post;
|
||
end;
|
||
self.tv2.Controller.EditingController.ShowEdit();
|
||
end;
|
||
|
||
procedure TfrmProductOrderAnPai.V2C_CodeNamePropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||
begin
|
||
{ try
|
||
frmZDYHelp:=TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag:='MPRTCodeName';
|
||
flagname:='<27><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>';
|
||
V1Name.Caption:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
||
V1Note.Caption:='Ӣ<><D3A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
||
// MainType:=Trim(DName);
|
||
fnote:=FALSE;
|
||
if ShowModal=1 then
|
||
begin
|
||
Self.CDS_Sub.Edit;
|
||
Self.CDS_Sub.FieldByName('C_Code').Value:=Trim(ClientDataSet1.fieldbyname('ZDYNo').AsString);
|
||
Self.CDS_Sub.FieldByName('C_CodeName').Value:=Trim(ClientDataSet1.fieldbyname('ZDYName').AsString)+'#';
|
||
// Self.Order_Sub.FieldByName('SOrddefstr4').Value:=Trim(ClientDataSet1.fieldbyname('Note').AsString);
|
||
Self.CDS_Sub.Post;
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.Free;
|
||
end; }
|
||
try
|
||
frmZdyAttachCP := TfrmZdyAttachCP.Create(Application);
|
||
with frmZdyAttachCP do
|
||
begin
|
||
fType := '<27><>Ʒ';
|
||
if ShowModal = 1 then
|
||
begin
|
||
Self.CDS_Sub.Edit;
|
||
Self.CDS_Sub.FieldByName('C_Code').Value := Trim(CDS_HZ.fieldbyname('ZdyCode').AsString);
|
||
Self.CDS_Sub.FieldByName('C_CodeName').Value := Trim(CDS_HZ.fieldbyname('ZDYName').AsString);
|
||
// Self.Order_Sub.FieldByName('Color').Value:=Trim(CDS_HZ.fieldbyname('DEFstr3').AsString);
|
||
// Self.Order_Sub.FieldByName('SOrddefstr4').Value:=Trim(ClientDataSet1.fieldbyname('Note').AsString);
|
||
Self.CDS_Sub.Post;
|
||
end;
|
||
end;
|
||
finally
|
||
frmZdyAttachCP.Free;
|
||
end;
|
||
self.tv2.Controller.EditingController.ShowEdit();
|
||
end;
|
||
|
||
procedure TfrmProductOrderAnPai.V2C_CodeNamePropertiesEditValueChanged(Sender: TObject);
|
||
var
|
||
mvalue: string;
|
||
begin
|
||
mvalue := TcxTextEdit(Sender).EditingText;
|
||
|
||
if trim(mvalue) = '' then
|
||
exit;
|
||
|
||
if rightBstr(trim(mvalue), 1) <> '#' then
|
||
begin
|
||
mvalue := trim(mvalue) + '#';
|
||
end;
|
||
|
||
with CDS_Sub do
|
||
begin
|
||
Edit;
|
||
FieldByName('C_CodeName').Value := Trim(mvalue);
|
||
Post;
|
||
end;
|
||
self.tv2.Controller.EditingController.ShowEdit();
|
||
end;
|
||
|
||
procedure TfrmProductOrderAnPai.TV3MouseEnter(Sender: TObject);
|
||
begin
|
||
cxGrid3.SetFocus;
|
||
tv3.Controller.EditingController.ShowEdit();
|
||
end;
|
||
|
||
procedure TfrmProductOrderAnPai.TV2FocusedRecordChanged(Sender: TcxCustomGridTableView; APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean);
|
||
begin
|
||
if fRoll then
|
||
InitRoll();
|
||
end;
|
||
|
||
procedure TfrmProductOrderAnPai.TV5FocusedRecordChanged(Sender: TcxCustomGridTableView; APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean);
|
||
begin
|
||
InitGrid();
|
||
BtnEditA1.TxtCode := Trim(Order_Main.fieldbyname('factoryNo').AsString);
|
||
BtnEditA1.Text := Trim(Order_Main.fieldbyname('factoryNoName').AsString);
|
||
BtnEditA4.Text := Trim(Order_Main.fieldbyname('PBFactory').AsString);
|
||
end;
|
||
|
||
procedure TfrmProductOrderAnPai.FactoryNoNameBtnClick(Sender: TObject);
|
||
begin
|
||
try
|
||
frmZdyAttachGYS := TfrmZdyAttachGYS.Create(Application);
|
||
with frmZdyAttachGYS do
|
||
begin
|
||
if ShowModal = 1 then
|
||
begin
|
||
FactoryNoName.Text := Trim(CDS_HZ.fieldbyname('zdyName').AsString);
|
||
end;
|
||
end;
|
||
finally
|
||
frmZdyAttachGYS.Free;
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmProductOrderAnPai.cxCurrencyEdit2KeyPress(Sender: TObject; var Key: Char);
|
||
begin
|
||
|
||
if Key = #13 then
|
||
begin
|
||
if cds_sub.IsEmpty then
|
||
exit;
|
||
|
||
with ADOQueryCmd do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('select * from JYOrder_Sub_AnPai ');
|
||
sql.Add('where Apid=' + quotedstr(trim(cds_sub.fieldbyname('apid').AsString)));
|
||
open;
|
||
if isempty then
|
||
begin
|
||
application.MessageBox('<27>˻زֵ<D8B2>δ<EFBFBD><CEB4><EFBFBD>棬<EFBFBD><E6A3AC><EFBFBD>ܱ<EFBFBD><DCB1><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
exit;
|
||
end;
|
||
end;
|
||
|
||
with ADOQueryCmd do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('select * from WFB_MJJY ');
|
||
sql.Add('where apid=' + quotedstr(trim(CDS_Sub.fieldbyname('apid').AsString)));
|
||
sql.Add('and mjstr2<>' + quotedstr(trim('δ<><CEB4><EFBFBD><EFBFBD>')));
|
||
open;
|
||
if not isempty then
|
||
begin
|
||
application.MessageBox('<27>˻زֵ<D8B2><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
exit;
|
||
end;
|
||
end;
|
||
with CDS_Roll do
|
||
begin
|
||
DisableControls;
|
||
first;
|
||
while not eof do
|
||
begin
|
||
edit;
|
||
FieldByName('AOrdQty3').Value := FieldByName('AOrdQty1').AsFloat * strtofloatdef(trim(cxCurrencyEdit2.Text), 0);
|
||
Post;
|
||
if not SaveMJID() then
|
||
begin
|
||
edit;
|
||
FieldByName('AOrdQty3').Value := 0;
|
||
Post;
|
||
application.MessageBox('<27><><EFBFBD>ݱ<EFBFBD><DDB1><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
EnableControls;
|
||
self.tv3.Controller.EditingController.ShowEdit();
|
||
exit;
|
||
end;
|
||
next;
|
||
end;
|
||
first;
|
||
EnableControls;
|
||
end;
|
||
|
||
self.tv3.Controller.EditingController.ShowEdit();
|
||
cxCurrencyEdit2.Text := '';
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmProductOrderAnPai.V2Column14PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||
begin
|
||
frmClothContractList_sel := TfrmClothContractList_sel.create(self);
|
||
with frmClothContractList_sel do
|
||
begin
|
||
ffactoryName := self.Order_Main.fieldbyname('FactoryNoName').AsString;
|
||
C_CodeName.Text := self.Order_Main.fieldbyname('C_CodeName').AsString;
|
||
if showmodal = 1 then
|
||
begin
|
||
CDS_Sub.Edit;
|
||
CDS_Sub.FieldByName('conNo').Value := Order_Main.fieldbyname('conNo').AsString;
|
||
CDS_Sub.post;
|
||
end;
|
||
free;
|
||
end;
|
||
self.tv2.Controller.EditingController.ShowEdit();
|
||
end;
|
||
|
||
procedure TfrmProductOrderAnPai.V2Column14PropertiesEditValueChanged(Sender: TObject);
|
||
var
|
||
mvalue: string;
|
||
begin
|
||
mvalue := TcxTextEdit(Sender).EditingText;
|
||
|
||
// IF trim(mvalue)='' then exit;
|
||
with CDS_Sub do
|
||
begin
|
||
Edit;
|
||
FieldByName('conNo').Value := Trim(mvalue);
|
||
Post;
|
||
end;
|
||
|
||
|
||
{ with ADOQueryCmd do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('select * from Contract_Main A ');
|
||
sql.Add('where conNo='+quotedstr(trim(CDS_Sub.fieldbyname('conNo').AsString)));
|
||
sql.Add('and conType='+quotedstr(trim('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>')));
|
||
open;
|
||
end;
|
||
IF ADOQueryCmd.IsEmpty then
|
||
begin
|
||
application.MessageBox('<27><><EFBFBD>Ų<F1B5A5BA><C5B2><EFBFBD><EFBFBD>ڣ<EFBFBD>','<27><>ʾ<EFBFBD><CABE>Ϣ',0);
|
||
with CDS_Sub do
|
||
begin
|
||
Edit;
|
||
FieldByName('conNo').Value:='';
|
||
Post;
|
||
end;
|
||
end; }
|
||
self.tv2.Controller.EditingController.ShowEdit();
|
||
end;
|
||
|
||
procedure TfrmProductOrderAnPai.TV2CustomDrawIndicatorCell(Sender: TcxGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxCustomGridIndicatorItemViewInfo; var ADone: Boolean);
|
||
var
|
||
FValue: string;
|
||
FBounds: TRect;
|
||
begin
|
||
if (AViewInfo is TcxGridIndicatorRowItemViewInfo) then
|
||
begin
|
||
FValue := IntToStr(TcxGridIndicatorRowItemViewInfo(AViewInfo).GridRecord.Index + 1);
|
||
FBounds := AViewInfo.Bounds;
|
||
ACanvas.FillRect(FBounds);
|
||
ACanvas.DrawComplexFrame(FBounds, clBtnHighlight, clBtnShadow, [bBottom, bLeft, bRight], 1);
|
||
InflateRect(FBounds, -1, -1);
|
||
ACanvas.Font.Color := clBlack;
|
||
ACanvas.Brush.Style := bsClear;
|
||
ACanvas.DrawText(FValue, FBounds, cxAlignCenter or cxAlignTop);
|
||
ADone := True;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmProductOrderAnPai.V3Column3PropertiesEditValueChanged(Sender: TObject);
|
||
var
|
||
mvalue: double;
|
||
begin
|
||
mvalue := strtofloatdef(trim(TcxTextEdit(Sender).EditingText), 0);
|
||
with CDS_Roll do
|
||
begin
|
||
Edit;
|
||
FieldByName('AOrdQty1').Value := mvalue;
|
||
Post;
|
||
end;
|
||
if CDS_Roll.fieldbyname('APSubID').AsInteger < 1 then
|
||
exit;
|
||
with ADOQueryCmd do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add(' update JYOrder_Sub_AnPai_MX SET AOrdQty1=' + quotedstr(trim(CDS_Roll.fieldbyname('AOrdQty1').AsString)));
|
||
sql.Add(' where apID=' + quotedstr(trim(CDS_Roll.fieldbyname('APID').AsString)));
|
||
sql.Add(' and apSubID=' + quotedstr(trim(CDS_Roll.fieldbyname('apSubID').AsString)));
|
||
sql.Add(' update WFB_MJJY SET MJQty1=' + quotedstr(trim(CDS_Roll.fieldbyname('AOrdQty1').AsString)));
|
||
sql.Add(' where apID=' + quotedstr(trim(CDS_Roll.fieldbyname('APID').AsString)));
|
||
sql.Add(' and MJXh=' + quotedstr(trim(CDS_Roll.fieldbyname('apSubID').AsString)));
|
||
execsql;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmProductOrderAnPai.V3Column4PropertiesEditValueChanged(Sender: TObject);
|
||
var
|
||
mvalue: double;
|
||
begin
|
||
|
||
mvalue := CDS_Roll.fieldbyname('AOrdQty3').AsFloat;
|
||
with ADOQueryCmd do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add(' select *from WFB_MJJY ');
|
||
sql.Add(' where MJID=' + quotedstr(trim(CDS_Roll.fieldbyname('APTM').AsString)));
|
||
sql.Add(' and MJStr2=' + quotedstr(trim('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>')));
|
||
open;
|
||
if ADOQueryCmd.RecordCount > 0 then
|
||
begin
|
||
application.MessageBox('<27>˻زֵ<D8B2><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
with CDS_Roll do
|
||
begin
|
||
Edit;
|
||
FieldByName('AOrdQty3').Value := mvalue;
|
||
Post;
|
||
end;
|
||
exit;
|
||
end;
|
||
end;
|
||
mvalue := strtofloatdef(trim(TcxTextEdit(Sender).EditingText), 0);
|
||
|
||
with CDS_Roll do
|
||
begin
|
||
Edit;
|
||
FieldByName('AOrdQty3').Value := mvalue;
|
||
Post;
|
||
end;
|
||
|
||
if not SaveMJID() then
|
||
begin
|
||
with CDS_Roll do
|
||
begin
|
||
Edit;
|
||
FieldByName('AOrdQty3').Value := 0;
|
||
Post;
|
||
end;
|
||
application.MessageBox('<27><><EFBFBD>ݱ<EFBFBD><DDB1><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
self.tv3.Controller.EditingController.ShowEdit();
|
||
exit;
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmProductOrderAnPai.V3Aorddefstr1PropertiesEditValueChanged(Sender: TObject);
|
||
var
|
||
mvalue: string;
|
||
begin
|
||
mvalue := trim(CDS_Roll.fieldbyname('Aorddefstr1').AsString);
|
||
with ADOQueryCmd do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add(' select *from WFB_MJJY ');
|
||
sql.Add(' where MJID=' + quotedstr(trim(CDS_Roll.fieldbyname('APTM').AsString)));
|
||
sql.Add(' and MJStr2=' + quotedstr(trim('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>')));
|
||
open;
|
||
if ADOQueryCmd.RecordCount > 0 then
|
||
begin
|
||
application.MessageBox('<27>˻زֵ<D8B2><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
with CDS_Roll do
|
||
begin
|
||
Edit;
|
||
FieldByName('Aorddefstr1').Value := mvalue;
|
||
Post;
|
||
end;
|
||
exit;
|
||
end;
|
||
end;
|
||
mvalue := trim(TcxTextEdit(Sender).EditingText);
|
||
|
||
with CDS_Roll do
|
||
begin
|
||
Edit;
|
||
FieldByName('Aorddefstr1').Value := mvalue;
|
||
Post;
|
||
end;
|
||
|
||
if not SaveMJID() then
|
||
begin
|
||
with CDS_Roll do
|
||
begin
|
||
Edit;
|
||
FieldByName('Aorddefstr1').Value := '';
|
||
Post;
|
||
end;
|
||
application.MessageBox('<27><><EFBFBD>ݱ<EFBFBD><DDB1><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
self.tv3.Controller.EditingController.ShowEdit();
|
||
exit;
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmProductOrderAnPai.V3notePropertiesEditValueChanged(Sender: TObject);
|
||
var
|
||
mvalue: string;
|
||
begin
|
||
mvalue := trim(CDS_Roll.fieldbyname('AorddefNote1').AsString);
|
||
with ADOQueryCmd do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add(' select *from WFB_MJJY ');
|
||
sql.Add(' where MJID=' + quotedstr(trim(CDS_Roll.fieldbyname('APTM').AsString)));
|
||
sql.Add(' and MJStr2=' + quotedstr(trim('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>')));
|
||
open;
|
||
if ADOQueryCmd.RecordCount > 0 then
|
||
begin
|
||
application.MessageBox('<27>˻زֵ<D8B2><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
with CDS_Roll do
|
||
begin
|
||
Edit;
|
||
FieldByName('AorddefNote1').Value := mvalue;
|
||
Post;
|
||
end;
|
||
exit;
|
||
end;
|
||
end;
|
||
mvalue := trim(TcxTextEdit(Sender).EditingText);
|
||
|
||
with CDS_Roll do
|
||
begin
|
||
Edit;
|
||
FieldByName('AorddefNote1').Value := mvalue;
|
||
Post;
|
||
end;
|
||
|
||
if not SaveMJID() then
|
||
begin
|
||
with CDS_Roll do
|
||
begin
|
||
Edit;
|
||
FieldByName('AorddefNote1').Value := '';
|
||
Post;
|
||
end;
|
||
application.MessageBox('<27><><EFBFBD>ݱ<EFBFBD><DDB1><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
self.tv3.Controller.EditingController.ShowEdit();
|
||
exit;
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmProductOrderAnPai.TV5CustomDrawIndicatorCell(Sender: TcxGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxCustomGridIndicatorItemViewInfo; var ADone: Boolean);
|
||
var
|
||
FValue: string;
|
||
FBounds: TRect;
|
||
begin
|
||
if (AViewInfo is TcxGridIndicatorRowItemViewInfo) then
|
||
begin
|
||
FValue := IntToStr(TcxGridIndicatorRowItemViewInfo(AViewInfo).GridRecord.Index + 1);
|
||
FBounds := AViewInfo.Bounds;
|
||
ACanvas.FillRect(FBounds);
|
||
ACanvas.DrawComplexFrame(FBounds, clBtnHighlight, clBtnShadow, [bBottom, bLeft, bRight], 1);
|
||
InflateRect(FBounds, -1, -1);
|
||
ACanvas.Font.Color := clBlack;
|
||
ACanvas.Brush.Style := bsClear;
|
||
ACanvas.DrawText(FValue, FBounds, cxAlignCenter or cxAlignTop);
|
||
ADone := True;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmProductOrderAnPai.TBfindClick(Sender: TObject);
|
||
var
|
||
mvalue: string;
|
||
begin
|
||
if ADOQuery_Tp.Active = False then
|
||
Exit;
|
||
mvalue := SGetFilters(Panel1, 1, 2);
|
||
{
|
||
if (trim(mvalue)='') and (trim(C_Color.Text)<>'') then
|
||
begin
|
||
mvalue:=' C_Color='+quotedstr(trim(C_Color.Text));
|
||
end
|
||
else
|
||
if (trim(mvalue)<>'') and (trim(C_Color.Text)<>'') then
|
||
begin
|
||
mvalue:=mvalue+' and C_Color='+quotedstr(trim(C_Color.Text));
|
||
end;
|
||
|
||
IF not CheckBox_XS.Checked then
|
||
begin
|
||
IF mvalue=''then
|
||
mvalue:=mvalue+' Qty2>H_gs '
|
||
else
|
||
mvalue:=mvalue+' and Qty2>H_gs ';
|
||
end; }
|
||
|
||
SDofilter(ADOQuery_Tp, mvalue);
|
||
SCreateCDS20(ADOQuery_Tp, Order_Main);
|
||
SInitCDSData20(ADOQuery_Tp, Order_Main);
|
||
end;
|
||
|
||
procedure TfrmProductOrderAnPai.CheckBox_XSClick(Sender: TObject);
|
||
begin
|
||
ToolButton10.Click;
|
||
end;
|
||
|
||
end.
|
||
|