2025-07-26 10:46:46 +08:00
|
|
|
|
unit U_YMTRKInPut;
|
|
|
|
|
|
|
|
|
|
|
|
interface
|
|
|
|
|
|
|
|
|
|
|
|
uses
|
|
|
|
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|
|
|
|
|
Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData, cxDataStorage,
|
|
|
|
|
|
cxEdit, DB, cxDBData, cxCalendar, cxDropDownEdit, ComCtrls, ToolWin,
|
|
|
|
|
|
cxGridLevel, cxGridCustomTableView, cxGridTableView, cxGridDBTableView,
|
|
|
|
|
|
cxClasses, cxControls, cxGridCustomView, cxGrid, cxGridCustomPopupMenu,
|
|
|
|
|
|
cxGridPopupMenu, ADODB, DBClient, cxButtonEdit, cxTextEdit, StdCtrls, ExtCtrls,
|
|
|
|
|
|
cxLookAndFeels, cxLookAndFeelPainters, 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,
|
2025-10-20 11:30:39 +08:00
|
|
|
|
dxSkinscxPCPainter, cxNavigator, cxCurrencyEdit, IdBaseComponent, IdComponent,
|
|
|
|
|
|
IdTCPConnection, IdTCPClient, IdHTTP;
|
2025-07-26 10:46:46 +08:00
|
|
|
|
|
|
|
|
|
|
type
|
|
|
|
|
|
TfrmYMTRKInPut = class(TForm)
|
|
|
|
|
|
cxGrid2: TcxGrid;
|
|
|
|
|
|
Tv1: TcxGridDBTableView;
|
|
|
|
|
|
v1Column2: TcxGridDBColumn;
|
|
|
|
|
|
v2Column1: TcxGridDBColumn;
|
|
|
|
|
|
v1Column9: TcxGridDBColumn;
|
|
|
|
|
|
v2Column6: TcxGridDBColumn;
|
|
|
|
|
|
cxGrid2Level1: TcxGridLevel;
|
|
|
|
|
|
ToolBar1: TToolBar;
|
|
|
|
|
|
TBAdd: TToolButton;
|
|
|
|
|
|
TBDel: TToolButton;
|
|
|
|
|
|
TBSave: TToolButton;
|
|
|
|
|
|
TBClose: TToolButton;
|
2025-09-26 16:19:47 +08:00
|
|
|
|
v1Column4: TcxGridDBColumn;
|
2025-07-26 10:46:46 +08:00
|
|
|
|
DataSource3: TDataSource;
|
|
|
|
|
|
CDS_Sub: TClientDataSet;
|
|
|
|
|
|
ADOQueryCmd: TADOQuery;
|
|
|
|
|
|
ADOQueryMain: TADOQuery;
|
|
|
|
|
|
ADOQueryTemp: TADOQuery;
|
|
|
|
|
|
cxGridPopupMenu2: TcxGridPopupMenu;
|
|
|
|
|
|
v1Column12: TcxGridDBColumn;
|
2025-09-26 16:19:47 +08:00
|
|
|
|
v1Column14: TcxGridDBColumn;
|
2025-07-26 10:46:46 +08:00
|
|
|
|
v1Column6: TcxGridDBColumn;
|
|
|
|
|
|
v1Column7: TcxGridDBColumn;
|
|
|
|
|
|
v1Column8: TcxGridDBColumn;
|
|
|
|
|
|
v1Column10: TcxGridDBColumn;
|
|
|
|
|
|
v1Column1: TcxGridDBColumn;
|
|
|
|
|
|
v1Column3: TcxGridDBColumn;
|
|
|
|
|
|
v1Column11: TcxGridDBColumn;
|
|
|
|
|
|
v1Column15: TcxGridDBColumn;
|
|
|
|
|
|
v1Column17: TcxGridDBColumn;
|
|
|
|
|
|
v1Column18: TcxGridDBColumn;
|
|
|
|
|
|
v1Column19: TcxGridDBColumn;
|
|
|
|
|
|
v1Column20: TcxGridDBColumn;
|
|
|
|
|
|
v1Column21: TcxGridDBColumn;
|
|
|
|
|
|
ToolButton2: TToolButton;
|
|
|
|
|
|
Panel4: TPanel;
|
|
|
|
|
|
Label14: TLabel;
|
|
|
|
|
|
Panel10: TPanel;
|
|
|
|
|
|
Image2: TImage;
|
|
|
|
|
|
Button1: TButton;
|
|
|
|
|
|
GroupBox1: TGroupBox;
|
|
|
|
|
|
CheckBox1: TCheckBox;
|
|
|
|
|
|
CheckBox2: TCheckBox;
|
|
|
|
|
|
CheckBox3: TCheckBox;
|
|
|
|
|
|
CheckBox4: TCheckBox;
|
|
|
|
|
|
CheckBox5: TCheckBox;
|
|
|
|
|
|
CheckBox6: TCheckBox;
|
|
|
|
|
|
CheckBox7: TCheckBox;
|
|
|
|
|
|
CheckBox8: TCheckBox;
|
|
|
|
|
|
CheckBox9: TCheckBox;
|
|
|
|
|
|
Button2: TButton;
|
|
|
|
|
|
Panel2: TPanel;
|
|
|
|
|
|
CDS_MX: TClientDataSet;
|
|
|
|
|
|
DS_MX: TDataSource;
|
2025-08-08 17:35:13 +08:00
|
|
|
|
cxGrid1: TcxGrid;
|
|
|
|
|
|
TvMX: TcxGridDBTableView;
|
|
|
|
|
|
TvMXMXID: TcxGridDBColumn;
|
|
|
|
|
|
TvMXMXQty: TcxGridDBColumn;
|
|
|
|
|
|
cxGridLevel2: TcxGridLevel;
|
2025-09-26 16:19:47 +08:00
|
|
|
|
Tv1Column1: TcxGridDBColumn;
|
2025-09-29 09:29:56 +08:00
|
|
|
|
Tv1Column3: TcxGridDBColumn;
|
|
|
|
|
|
TvMXColumn1: TcxGridDBColumn;
|
2025-09-29 16:40:01 +08:00
|
|
|
|
Tv1PriceType: TcxGridDBColumn;
|
|
|
|
|
|
Tv1IsTax: TcxGridDBColumn;
|
|
|
|
|
|
Tv1Money: TcxGridDBColumn;
|
|
|
|
|
|
Tv1Price: TcxGridDBColumn;
|
2025-10-20 11:30:39 +08:00
|
|
|
|
Panel3: TPanel;
|
|
|
|
|
|
Label17: TLabel;
|
|
|
|
|
|
AddNum: TEdit;
|
|
|
|
|
|
BtnQuicklyAdd: TButton;
|
|
|
|
|
|
ToolBar2: TToolBar;
|
|
|
|
|
|
TbAddRow: TToolButton;
|
|
|
|
|
|
TbDeleteRow: TToolButton;
|
|
|
|
|
|
http: TIdHTTP;
|
2025-07-26 10:46:46 +08:00
|
|
|
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|
|
|
|
|
procedure TBAddClick(Sender: TObject);
|
|
|
|
|
|
procedure TBCloseClick(Sender: TObject);
|
|
|
|
|
|
procedure FormShow(Sender: TObject);
|
|
|
|
|
|
procedure TBDelClick(Sender: TObject);
|
|
|
|
|
|
procedure TBSaveClick(Sender: TObject);
|
|
|
|
|
|
procedure v1Column14PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|
|
|
|
|
procedure v2Column1PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|
|
|
|
|
procedure v1Column11PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|
|
|
|
|
procedure v1Column16PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|
|
|
|
|
procedure v1Column18PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|
|
|
|
|
procedure Button2Click(Sender: TObject);
|
|
|
|
|
|
procedure ToolButton2Click(Sender: TObject);
|
|
|
|
|
|
procedure Image2Click(Sender: TObject);
|
|
|
|
|
|
procedure Button1Click(Sender: TObject);
|
|
|
|
|
|
procedure ToolButton3Click(Sender: TObject);
|
|
|
|
|
|
procedure Tv1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
|
|
|
|
|
procedure cxGridDBColumn8PropertiesEditValueChanged(Sender: TObject);
|
|
|
|
|
|
procedure ToolButton4Click(Sender: TObject);
|
|
|
|
|
|
procedure TvMXCustomDrawIndicatorCell(Sender: TcxGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxCustomGridIndicatorItemViewInfo; var ADone: Boolean);
|
|
|
|
|
|
procedure TvMXKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
|
2025-09-26 16:19:47 +08:00
|
|
|
|
procedure v1Column21PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
2025-09-29 16:40:01 +08:00
|
|
|
|
procedure Tv1PricePropertiesEditValueChanged(Sender: TObject);
|
|
|
|
|
|
procedure Tv1PriceTypePropertiesEditValueChanged(Sender: TObject);
|
2025-10-20 11:30:39 +08:00
|
|
|
|
procedure BtnQuicklyAddClick(Sender: TObject);
|
|
|
|
|
|
procedure TbAddRowClick(Sender: TObject);
|
|
|
|
|
|
procedure TbDeleteRowClick(Sender: TObject);
|
|
|
|
|
|
procedure AddNumKeyPress(Sender: TObject; var Key: Char);
|
|
|
|
|
|
procedure FormDestroy(Sender: TObject);
|
|
|
|
|
|
procedure FormCreate(Sender: TObject);
|
2025-07-26 10:46:46 +08:00
|
|
|
|
private
|
|
|
|
|
|
{ Private declarations }
|
|
|
|
|
|
function SaveCKData(): Boolean;
|
2025-08-08 17:35:13 +08:00
|
|
|
|
procedure InitMXGrid(SPID: string);
|
2025-08-12 16:22:08 +08:00
|
|
|
|
procedure InitGrid();
|
|
|
|
|
|
procedure AddRows();
|
2025-09-30 15:36:41 +08:00
|
|
|
|
function YFData(): Boolean;
|
2025-10-20 11:30:39 +08:00
|
|
|
|
function BatchStockIn(MXIDs: string; UserID: string): Boolean;
|
2025-07-26 10:46:46 +08:00
|
|
|
|
public
|
|
|
|
|
|
{ Public declarations }
|
|
|
|
|
|
FBCId: string;
|
2025-09-09 17:22:59 +08:00
|
|
|
|
PState, CopyInt: Integer;
|
2025-10-20 11:30:39 +08:00
|
|
|
|
FSelectedSPIDs: TStringList; // <20><><EFBFBD>ڱ<EFBFBD><DAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD>е<EFBFBD>SPID
|
2025-07-26 10:46:46 +08:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
var
|
|
|
|
|
|
frmYMTRKInPut: TfrmYMTRKInPut;
|
|
|
|
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
|
|
|
|
|
|
|
uses
|
2025-10-20 11:30:39 +08:00
|
|
|
|
U_DataLink, U_RTFun, U_ZDYHelp, U_ZdyAttachGYS, U_MLMangeYHSel, U_ZdyAttachKH,
|
|
|
|
|
|
U_KuWeiList, superobject;
|
2025-07-26 10:46:46 +08:00
|
|
|
|
|
|
|
|
|
|
{$R *.dfm}
|
2025-10-20 11:30:39 +08:00
|
|
|
|
|
|
|
|
|
|
function TfrmYMTRKInPut.BatchStockIn(MXIDs: string; UserID: string): Boolean;
|
|
|
|
|
|
var
|
|
|
|
|
|
IdHttp: TIdHTTP;
|
|
|
|
|
|
Url, ResponseStr: string;
|
|
|
|
|
|
ResponseStream: TStringStream;
|
|
|
|
|
|
vJson1: ISuperObject;
|
|
|
|
|
|
begin
|
|
|
|
|
|
Result := False;
|
|
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֤
|
|
|
|
|
|
if Trim(MXIDs) = '' then
|
|
|
|
|
|
begin
|
|
|
|
|
|
ShowMessage('MXID<49><44><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>');
|
|
|
|
|
|
Exit;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
if Trim(UserID) = '' then
|
|
|
|
|
|
begin
|
|
|
|
|
|
ShowMessage('<27>û<EFBFBD>ID<49><44><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>');
|
|
|
|
|
|
Exit;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
IdHttp := TIdHTTP.Create(nil);
|
|
|
|
|
|
ResponseStream := TStringStream.Create('');
|
|
|
|
|
|
try
|
|
|
|
|
|
try
|
|
|
|
|
|
// GET<45><54><EFBFBD><EFBFBD> - <20><><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>ContentType
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD>ֱ<EFBFBD>ӷ<EFBFBD><D3B7><EFBFBD>URL<52><4C>
|
|
|
|
|
|
// <20>ӿ<EFBFBD>URL<52><4C><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>URL<52>У<EFBFBD>
|
|
|
|
|
|
Url := 'http://www.rightsoft.top/YunXiang/api/YMTCK/batchStockIn?' + 'MXID=' + Trim(MXIDs) + '&userid=' + Trim(UserID);
|
|
|
|
|
|
// ShowMessage(Url);
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD>GET<45><54><EFBFBD><EFBFBD>
|
|
|
|
|
|
IdHttp.Get(Url, ResponseStream);
|
|
|
|
|
|
|
|
|
|
|
|
// <20><>ȡ<EFBFBD><C8A1>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>
|
|
|
|
|
|
ResponseStr := ResponseStream.DataString;
|
|
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD>JSON<4F><4E>Ӧ
|
|
|
|
|
|
vJson1 := SO(ResponseStr);
|
|
|
|
|
|
// ShowMessage(ResponseStr);
|
|
|
|
|
|
if (vJson1.O['code'] <> nil) then
|
|
|
|
|
|
begin
|
|
|
|
|
|
if (vJson1.O['code'].AsInteger = 10000) then
|
|
|
|
|
|
begin
|
|
|
|
|
|
Result := True;
|
|
|
|
|
|
ShowMessage('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>');
|
|
|
|
|
|
end
|
|
|
|
|
|
else
|
|
|
|
|
|
begin
|
|
|
|
|
|
// <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
|
|
|
|
|
if vJson1.O['message'] <> nil then
|
|
|
|
|
|
ShowMessage('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>: ' + vJson1.O['message'].AsString)
|
|
|
|
|
|
else
|
|
|
|
|
|
ShowMessage('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>δ֪<CEB4><D6AA><EFBFBD><EFBFBD>');
|
|
|
|
|
|
end;
|
|
|
|
|
|
end
|
|
|
|
|
|
else
|
|
|
|
|
|
begin
|
|
|
|
|
|
ShowMessage('<27>ӿڷ<D3BF><DAB7>ظ<EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD>');
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
except
|
|
|
|
|
|
on e: Exception do
|
|
|
|
|
|
begin
|
|
|
|
|
|
ShowMessage('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>쳣: ' + e.Message);
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
finally
|
|
|
|
|
|
IdHttp.Free;
|
|
|
|
|
|
ResponseStream.Free;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2025-09-30 15:36:41 +08:00
|
|
|
|
function TfrmYMTRKInPut.YFData(): Boolean;
|
|
|
|
|
|
var
|
|
|
|
|
|
CRID, OrdMainId, YFID, FComTaiTou, FCRID, FFactoryName, FFactoryNo: string;
|
|
|
|
|
|
begin
|
|
|
|
|
|
Result := False;
|
|
|
|
|
|
FFactoryName := Trim(CDS_Sub.FieldByName('FactoryName').AsString);
|
|
|
|
|
|
FFactoryNo := Trim(CDS_Sub.FieldByName('FactoryNo').AsString);
|
|
|
|
|
|
with ADOQueryTemp do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Close;
|
|
|
|
|
|
SQL.Clear;
|
|
|
|
|
|
sql.Add('select * from YS_Money_KC where FactoryNo=' + quotedstr(Trim(FFactoryNo)));
|
|
|
|
|
|
sql.Add(' and KCType=''GYS'' ');
|
|
|
|
|
|
Open;
|
|
|
|
|
|
end;
|
|
|
|
|
|
if ADOQueryTemp.IsEmpty = False then
|
|
|
|
|
|
begin
|
|
|
|
|
|
CRID := ADOQueryTemp.fieldbyname('CRID').AsString;
|
|
|
|
|
|
end
|
|
|
|
|
|
else
|
|
|
|
|
|
begin
|
|
|
|
|
|
with ADOQueryTemp do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Close;
|
|
|
|
|
|
sql.Clear;
|
|
|
|
|
|
sql.Add('select * from YS_Money_CRID');
|
|
|
|
|
|
Open;
|
|
|
|
|
|
end;
|
|
|
|
|
|
if ADOQueryTemp.IsEmpty = False then
|
|
|
|
|
|
begin
|
|
|
|
|
|
with ADOQueryCmd do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Close;
|
|
|
|
|
|
sql.Clear;
|
|
|
|
|
|
sql.Add('Update YS_Money_CRID set CRID=CRID+1');
|
|
|
|
|
|
sql.Add('select * from YS_Money_CRID ');
|
|
|
|
|
|
Open;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end
|
|
|
|
|
|
else
|
|
|
|
|
|
begin
|
|
|
|
|
|
with ADOQueryCmd do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Close;
|
|
|
|
|
|
sql.Clear;
|
|
|
|
|
|
sql.Add('insert into YS_Money_CRID select 0 ');
|
|
|
|
|
|
sql.Add('select * from YS_Money_CRID ');
|
|
|
|
|
|
Open;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
CRID := ADOQueryCmd.fieldbyname('CRID').AsString;
|
|
|
|
|
|
with ADOQueryCmd do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Close;
|
|
|
|
|
|
SQL.Clear;
|
|
|
|
|
|
sql.Add('select * from YS_Money_KC where 1=2');
|
|
|
|
|
|
Open;
|
|
|
|
|
|
end;
|
|
|
|
|
|
with ADOQueryCmd do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Append;
|
|
|
|
|
|
FieldByName('CRID').Value := StrToInt(CRID);
|
|
|
|
|
|
FieldByName('FactoryName').Value := Trim(FFactoryName);
|
|
|
|
|
|
FieldByName('FactoryNo').Value := Trim(FFactoryNo);
|
|
|
|
|
|
FieldByName('ZdyStr1').Value := 'Ӧ<><D3A6><EFBFBD><EFBFBD>';
|
|
|
|
|
|
FieldByName('KCType').Value := 'GYS';
|
|
|
|
|
|
Post;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
with ADOQueryTemp do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Close;
|
|
|
|
|
|
sql.Clear;
|
|
|
|
|
|
sql.Add('select * from YS_Money_CR where FactoryNo=' + quotedstr(Trim(FFactoryNo)));
|
|
|
|
|
|
sql.Add(' and YFTypeId=''' + Trim(CDS_Sub.fieldbyname('SPID').AsString) + '''');
|
|
|
|
|
|
Open;
|
|
|
|
|
|
end;
|
|
|
|
|
|
if ADOQueryTemp.IsEmpty then
|
|
|
|
|
|
begin
|
|
|
|
|
|
if GetLSNo(ADOQueryCmd, YFID, 'JG', 'YS_Money_CR', 4, 1) = False then
|
|
|
|
|
|
begin
|
|
|
|
|
|
Application.MessageBox('ȡӦ<C8A1><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 YS_Money_CR where YFID=''' + Trim(YFID) + '''');
|
|
|
|
|
|
Open;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
with ADOQueryCmd do
|
|
|
|
|
|
begin
|
|
|
|
|
|
if ADOQueryTemp.IsEmpty then
|
|
|
|
|
|
begin
|
|
|
|
|
|
Append;
|
|
|
|
|
|
FieldByName('SCQty').Value := CDS_Sub.FieldByName('Qty').Asfloat;
|
|
|
|
|
|
FieldByName('SCPS').Value := CDS_Sub.FieldByName('PiQty').Asfloat;
|
|
|
|
|
|
end
|
|
|
|
|
|
else
|
|
|
|
|
|
Edit;
|
|
|
|
|
|
|
|
|
|
|
|
FieldByName('YFID').Value := Trim(YFID);
|
|
|
|
|
|
FieldByName('YFTypeId').Value := Trim(CDS_Sub.fieldbyname('SPID').AsString);
|
|
|
|
|
|
FieldByName('CRID').Value := StrToInt(CRID);
|
|
|
|
|
|
FieldByName('YFName').Value := '<27>ɹ<EFBFBD><C9B9><EFBFBD>';
|
|
|
|
|
|
FieldByName('Filler').Value := Trim(DName);
|
|
|
|
|
|
FieldByName('CRType').Value := 'Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD>Ǽ<EFBFBD>';
|
|
|
|
|
|
FieldByName('CRFlag').Value := 'Ӧ<><D3A6><EFBFBD><EFBFBD>';
|
|
|
|
|
|
FieldByName('ChkStatusP').Value := 'δ<><CEB4><EFBFBD><EFBFBD>';
|
|
|
|
|
|
FieldByName('ChkStatusQ').Value := 'δ<><CEB4><EFBFBD><EFBFBD>';
|
|
|
|
|
|
FieldByName('QtyFlag').Value := 1;
|
|
|
|
|
|
FieldByName('FactoryName').Value := Trim(FFactoryName);
|
|
|
|
|
|
FieldByName('FactoryNo').Value := Trim(FFactoryNo);
|
|
|
|
|
|
FieldByName('CRTime').Value := CDS_Sub.fieldbyname('CRTime').AsString;
|
|
|
|
|
|
if CDS_Sub.FieldByName('PriceType').Value = '<27><>' then
|
|
|
|
|
|
begin
|
|
|
|
|
|
FieldByName('Qty').Value := CDS_Sub.FieldByName('Qty').Asfloat;
|
|
|
|
|
|
FieldByName('QtyUnit').Value := 'M';
|
|
|
|
|
|
end
|
|
|
|
|
|
else
|
|
|
|
|
|
begin
|
|
|
|
|
|
FieldByName('Qty').Value := CDS_Sub.FieldByName('KGQty').Asfloat;
|
|
|
|
|
|
FieldByName('QtyUnit').Value := 'KG';
|
|
|
|
|
|
end;
|
|
|
|
|
|
FieldByName('PS').Value := CDS_Sub.FieldByName('PiQty').Asfloat;
|
|
|
|
|
|
FieldByName('YFType').Value := '<27>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>';
|
|
|
|
|
|
FieldByName('Price').Value := CDS_Sub.FieldByName('Price').Asfloat;
|
|
|
|
|
|
FieldByName('Money').Value := CDS_Sub.FieldByName('Money').Asfloat;
|
|
|
|
|
|
if CDS_Sub.FieldByName('IsTax').Value = '<27><>˰' then
|
|
|
|
|
|
begin
|
|
|
|
|
|
FieldByName('HanShui').Value := '<27><>˰';
|
|
|
|
|
|
end
|
|
|
|
|
|
else
|
|
|
|
|
|
begin
|
|
|
|
|
|
FieldByName('HanShui').Value := '<27><><EFBFBD><EFBFBD>˰';
|
|
|
|
|
|
end;
|
|
|
|
|
|
FieldByName('CKNO').Value := trim(CDS_Sub.fieldbyname('SPID').AsString);
|
|
|
|
|
|
FieldByName('SJQty').Value := CDS_Sub.FieldByName('Money').Asfloat;
|
|
|
|
|
|
FieldByName('MiQty').Value := CDS_Sub.FieldByName('Qty').Asfloat;
|
|
|
|
|
|
FieldByName('KGQty').Value := CDS_Sub.FieldByName('KGQty').Asfloat;
|
|
|
|
|
|
FieldByName('JSmoney').Value := CDS_Sub.FieldByName('Money').Asfloat;
|
|
|
|
|
|
FieldByName('HSmoney').Value := CDS_Sub.FieldByName('Money').Asfloat;
|
|
|
|
|
|
FieldByName('P_CodeName').Value := CDS_Sub.FieldByName('SPName').Asstring;
|
|
|
|
|
|
FieldByName('P_MF').Value := CDS_Sub.FieldByName('SPMF').Asstring;
|
|
|
|
|
|
FieldByName('P_KZ').Value := CDS_Sub.FieldByName('SPKZ').Asstring;
|
|
|
|
|
|
FieldByName('P_Color').Value := CDS_Sub.FieldByName('SPColor').Asstring;
|
|
|
|
|
|
// FieldByName('P_ColorNo').Value := Trim(MYColorNo.Text); CDS_Sub.FieldByName('ColorNo').Asstring;
|
|
|
|
|
|
FieldByName('P_HX').Value := CDS_Sub.FieldByName('SPHX').Asstring;
|
|
|
|
|
|
FieldByName('BZType').Value := '<27><>';
|
|
|
|
|
|
FieldByName('status').Value := '0';
|
|
|
|
|
|
Post;
|
|
|
|
|
|
end;
|
|
|
|
|
|
with ADOQueryCmd do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Close;
|
|
|
|
|
|
sql.Clear;
|
|
|
|
|
|
sql.Add('Update YS_Money_KC Set KCMoney=(select isnull(Sum(HSMoney*QtyFlag),0) from YS_Money_CR A where A.CRID=YS_Money_KC.CRID)');
|
|
|
|
|
|
sql.Add(' where CRID=' + CRID);
|
|
|
|
|
|
ExecSQL;
|
|
|
|
|
|
end;
|
|
|
|
|
|
Result := True;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2025-08-08 17:35:13 +08:00
|
|
|
|
procedure TfrmYMTRKInPut.InitMXGrid(SPID: string);
|
2025-10-20 11:30:39 +08:00
|
|
|
|
var
|
|
|
|
|
|
FilterSPID: string;
|
2025-08-08 17:35:13 +08:00
|
|
|
|
begin
|
2025-10-20 11:30:39 +08:00
|
|
|
|
if not Assigned(CDS_MX) then
|
|
|
|
|
|
Exit;
|
|
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
|
CDS_MX.DisableControls;
|
|
|
|
|
|
try
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>й<EFBFBD><D0B9><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
CDS_MX.Filtered := False;
|
|
|
|
|
|
CDS_MX.Filter := '';
|
|
|
|
|
|
|
|
|
|
|
|
// <20><>CDS_Sub<75><62>ȡSPID<49><44><EFBFBD><EFBFBD><EFBFBD>ù<EFBFBD><C3B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
|
|
FilterSPID := SPID;
|
|
|
|
|
|
|
|
|
|
|
|
if FilterSPID <> '' then
|
|
|
|
|
|
begin
|
|
|
|
|
|
CDS_MX.Filter := 'SPID = ''' + FilterSPID + '''';
|
|
|
|
|
|
CDS_MX.Filtered := True;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
// <20><>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD>й<EFBFBD><D0B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>¼
|
|
|
|
|
|
if not CDS_MX.Filtered then
|
|
|
|
|
|
CDS_MX.First;
|
|
|
|
|
|
|
|
|
|
|
|
finally
|
|
|
|
|
|
CDS_MX.EnableControls;
|
|
|
|
|
|
end;
|
|
|
|
|
|
except
|
|
|
|
|
|
on E: Exception do
|
|
|
|
|
|
begin
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӵ<EFBFBD><D3B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>Ϣ
|
|
|
|
|
|
MessageDlg('<27><>ʼ<EFBFBD><CABC>MXGridʱ<64><CAB1><EFBFBD><EFBFBD>: ' + E.Message, mtError, [mbOK], 0);
|
|
|
|
|
|
end;
|
2025-08-08 17:35:13 +08:00
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2025-08-12 16:22:08 +08:00
|
|
|
|
procedure TfrmYMTRKInPut.AddRows();
|
2025-08-08 17:35:13 +08:00
|
|
|
|
var
|
2025-08-12 16:22:08 +08:00
|
|
|
|
i, PiQty: Integer;
|
|
|
|
|
|
MaxNo, MMXID, SPID: string;
|
2025-08-08 17:35:13 +08:00
|
|
|
|
begin
|
2025-08-12 16:22:08 +08:00
|
|
|
|
if CDS_Sub.IsEmpty then
|
|
|
|
|
|
Exit;
|
|
|
|
|
|
SPID := Trim(CDS_Sub.fieldbyname('SPID').AsString);
|
|
|
|
|
|
PiQty := CDS_Sub.fieldbyname('PiQty').AsInteger;
|
|
|
|
|
|
|
2025-08-08 17:35:13 +08:00
|
|
|
|
try
|
|
|
|
|
|
for i := 1 to PiQty do
|
|
|
|
|
|
begin
|
2025-08-12 16:22:08 +08:00
|
|
|
|
if GetLSNo(ADOQueryTemp, MaxNo, 'MCM', 'YMT_CK_MX', 3, 1) = False then
|
|
|
|
|
|
begin
|
|
|
|
|
|
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!', '<27><>ʾ', 0);
|
|
|
|
|
|
Exit;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
MMXID := Trim(MaxNo);
|
2025-08-08 17:35:13 +08:00
|
|
|
|
with ADOQueryCmd do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Close;
|
|
|
|
|
|
SQL.Clear;
|
|
|
|
|
|
sql.Add('insert into YMT_CK_MX (MXID,SPID,MXQty)');
|
|
|
|
|
|
sql.Add('values(' + quotedstr(MMXID));
|
|
|
|
|
|
sql.Add(',' + quotedstr(Trim(SPID)));
|
|
|
|
|
|
sql.Add(',0');
|
|
|
|
|
|
sql.Add(')');
|
|
|
|
|
|
ExecSQL;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
InitMXGrid(SPID);
|
|
|
|
|
|
except
|
|
|
|
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!', '<27><>ʾ', 0);
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmYMTRKInPut.InitGrid();
|
2025-10-20 11:30:39 +08:00
|
|
|
|
var
|
|
|
|
|
|
SPIDList: string;
|
|
|
|
|
|
i: Integer;
|
2025-07-26 10:46:46 +08:00
|
|
|
|
begin
|
2025-10-20 11:30:39 +08:00
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD><D0B6><EFBFBD>ѡ<EFBFBD>е<EFBFBD>SPID<49><44><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IN<49><4E>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD>
|
|
|
|
|
|
if Assigned(FSelectedSPIDs) and (FSelectedSPIDs.Count > 0) then
|
2025-09-09 17:22:59 +08:00
|
|
|
|
begin
|
2025-10-20 11:30:39 +08:00
|
|
|
|
SPIDList := '';
|
|
|
|
|
|
for i := 0 to FSelectedSPIDs.Count - 1 do
|
|
|
|
|
|
begin
|
|
|
|
|
|
if i > 0 then
|
|
|
|
|
|
SPIDList := SPIDList + ',';
|
|
|
|
|
|
SPIDList := SPIDList + QuotedStr(FSelectedSPIDs[i]);
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
with ADOQueryTemp do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Close;
|
|
|
|
|
|
sql.Clear;
|
|
|
|
|
|
sql.Add(' select A.* ');
|
|
|
|
|
|
sql.Add(',OrderNO=(select OrderNO from JYOrder_Main JM where JM.MainId=A.ORDMainIdRK)');
|
|
|
|
|
|
sql.Add(' from YMT_CK_CR A');
|
|
|
|
|
|
sql.Add(' where SPID IN (' + SPIDList + ')');
|
|
|
|
|
|
Open;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end
|
|
|
|
|
|
else
|
|
|
|
|
|
begin
|
|
|
|
|
|
// ԭ<>еĵ<D0B5><C4B5><EFBFBD>SPID<49><44>ѯ<EFBFBD><EFBFBD>
|
|
|
|
|
|
with ADOQueryTemp do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Close;
|
|
|
|
|
|
sql.Clear;
|
|
|
|
|
|
sql.Add(' select A.* ');
|
|
|
|
|
|
sql.Add(',OrderNO=(select OrderNO from JYOrder_Main JM where JM.MainId=A.ORDMainIdRK)');
|
|
|
|
|
|
sql.Add(' from YMT_CK_CR A');
|
|
|
|
|
|
sql.Add(' where SPID=''' + Trim(FBCId) + '''');
|
|
|
|
|
|
Open;
|
|
|
|
|
|
end;
|
2025-09-09 17:22:59 +08:00
|
|
|
|
end;
|
2025-10-20 11:30:39 +08:00
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>뱣<EFBFBD>ֲ<EFBFBD><D6B2><EFBFBD>
|
2025-09-09 17:22:59 +08:00
|
|
|
|
SCreateCDS20(ADOQueryTemp, CDS_Sub);
|
|
|
|
|
|
SInitCDSData20(ADOQueryTemp, CDS_Sub);
|
|
|
|
|
|
if CDS_Sub.IsEmpty then
|
|
|
|
|
|
Exit;
|
2025-09-20 10:39:47 +08:00
|
|
|
|
|
2025-10-20 11:30:39 +08:00
|
|
|
|
// ע<>⣺<EFBFBD><E2A3BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>ģ<DEB8><C4A3><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD><D0B6><EFBFBD>SPID
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>δ<EFBFBD><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SPID<49><44><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2025-09-20 10:39:47 +08:00
|
|
|
|
InitMXGrid(CDS_Sub.fieldbyname('SPID').AsString);
|
2025-10-20 11:30:39 +08:00
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>뱣<EFBFBD>ֲ<EFBFBD><D6B2><EFBFBD>
|
2025-09-09 17:22:59 +08:00
|
|
|
|
with ADOQueryTemp do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Close;
|
|
|
|
|
|
sql.Clear;
|
|
|
|
|
|
sql.Add('select * from YMT_CK_CR where FZSPID=''' + Trim(CDS_Sub.fieldbyname('SPID').AsString) + '''');
|
|
|
|
|
|
sql.Add(' and CRQtyFlag=-1');
|
|
|
|
|
|
Open;
|
|
|
|
|
|
end;
|
2025-10-20 11:30:39 +08:00
|
|
|
|
|
2025-09-09 17:22:59 +08:00
|
|
|
|
if not ADOQueryTemp.IsEmpty then
|
|
|
|
|
|
begin
|
2025-10-20 11:30:39 +08:00
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2025-09-26 16:19:47 +08:00
|
|
|
|
v1Column4.Options.Focusing := False;
|
|
|
|
|
|
v1Column14.Options.Focusing := False;
|
2025-09-09 17:22:59 +08:00
|
|
|
|
v2Column1.Options.Focusing := False;
|
|
|
|
|
|
v1Column8.Options.Focusing := False;
|
|
|
|
|
|
v1Column7.Options.Focusing := False;
|
|
|
|
|
|
v1Column1.Options.Focusing := False;
|
|
|
|
|
|
v1Column10.Options.Focusing := False;
|
|
|
|
|
|
v1Column11.Options.Focusing := False;
|
|
|
|
|
|
Exit;
|
|
|
|
|
|
end
|
|
|
|
|
|
else
|
|
|
|
|
|
begin
|
2025-10-20 11:30:39 +08:00
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2025-09-26 16:19:47 +08:00
|
|
|
|
v1Column4.Options.Focusing := True;
|
|
|
|
|
|
v1Column14.Options.Focusing := True;
|
2025-09-09 17:22:59 +08:00
|
|
|
|
v2Column1.Options.Focusing := True;
|
|
|
|
|
|
v1Column8.Options.Focusing := True;
|
|
|
|
|
|
v1Column7.Options.Focusing := True;
|
|
|
|
|
|
v1Column1.Options.Focusing := True;
|
|
|
|
|
|
v1Column10.Options.Focusing := True;
|
|
|
|
|
|
v1Column11.Options.Focusing := True;
|
|
|
|
|
|
end;
|
2025-07-26 10:46:46 +08:00
|
|
|
|
end;
|
2025-10-20 11:30:39 +08:00
|
|
|
|
//procedure TfrmYMTRKInPut.InitGrid();
|
|
|
|
|
|
//begin
|
|
|
|
|
|
// with ADOQueryTemp do
|
|
|
|
|
|
// begin
|
|
|
|
|
|
// Close;
|
|
|
|
|
|
// sql.Clear;
|
|
|
|
|
|
// sql.Add(' select A.* ');
|
|
|
|
|
|
// sql.Add(',OrderNO=(select OrderNO from JYOrder_Main JM where JM.MainId=A.ORDMainIdRK)');
|
|
|
|
|
|
// sql.Add(' from YMT_CK_CR A');
|
|
|
|
|
|
// sql.Add(' where SPID=''' + Trim(FBCId) + '''');
|
|
|
|
|
|
// Open;
|
|
|
|
|
|
// end;
|
|
|
|
|
|
// SCreateCDS20(ADOQueryTemp, CDS_Sub);
|
|
|
|
|
|
// SInitCDSData20(ADOQueryTemp, CDS_Sub);
|
|
|
|
|
|
// if CDS_Sub.IsEmpty then
|
|
|
|
|
|
// Exit;
|
|
|
|
|
|
//
|
|
|
|
|
|
// InitMXGrid(CDS_Sub.fieldbyname('SPID').AsString);
|
|
|
|
|
|
// with ADOQueryTemp do
|
|
|
|
|
|
// begin
|
|
|
|
|
|
// Close;
|
|
|
|
|
|
// sql.Clear;
|
|
|
|
|
|
// sql.Add('select * from YMT_CK_CR where FZSPID=''' + Trim(CDS_Sub.fieldbyname('SPID').AsString) + '''');
|
|
|
|
|
|
// sql.Add(' and CRQtyFlag=-1');
|
|
|
|
|
|
// Open;
|
|
|
|
|
|
// end;
|
|
|
|
|
|
// if not ADOQueryTemp.IsEmpty then
|
|
|
|
|
|
// begin
|
|
|
|
|
|
// v1Column4.Options.Focusing := False;
|
|
|
|
|
|
// v1Column14.Options.Focusing := False;
|
|
|
|
|
|
// v2Column1.Options.Focusing := False;
|
|
|
|
|
|
// v1Column8.Options.Focusing := False;
|
|
|
|
|
|
// v1Column7.Options.Focusing := False;
|
|
|
|
|
|
// v1Column1.Options.Focusing := False;
|
|
|
|
|
|
// v1Column10.Options.Focusing := False;
|
|
|
|
|
|
// v1Column11.Options.Focusing := False;
|
|
|
|
|
|
// Exit;
|
|
|
|
|
|
// end
|
|
|
|
|
|
// else
|
|
|
|
|
|
// begin
|
|
|
|
|
|
// v1Column4.Options.Focusing := True;
|
|
|
|
|
|
// v1Column14.Options.Focusing := True;
|
|
|
|
|
|
// v2Column1.Options.Focusing := True;
|
|
|
|
|
|
// v1Column8.Options.Focusing := True;
|
|
|
|
|
|
// v1Column7.Options.Focusing := True;
|
|
|
|
|
|
// v1Column1.Options.Focusing := True;
|
|
|
|
|
|
// v1Column10.Options.Focusing := True;
|
|
|
|
|
|
// v1Column11.Options.Focusing := True;
|
|
|
|
|
|
// end;
|
|
|
|
|
|
//end;
|
2025-07-26 10:46:46 +08:00
|
|
|
|
|
|
|
|
|
|
procedure TfrmYMTRKInPut.FormClose(Sender: TObject; var Action: TCloseAction);
|
|
|
|
|
|
begin
|
|
|
|
|
|
Action := caFree;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmYMTRKInPut.TBAddClick(Sender: TObject);
|
|
|
|
|
|
var
|
|
|
|
|
|
MMaxno: string;
|
|
|
|
|
|
begin
|
|
|
|
|
|
if GetLSNo(ADOQueryCmd, MMaxno, 'DR', 'YMT_CK_CR', 3, 1) = False then
|
|
|
|
|
|
begin
|
|
|
|
|
|
Application.MessageBox('ȡ<><C8A1><EFBFBD>첼<EFBFBD><ECB2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!', '<27><>ʾ', 0);
|
|
|
|
|
|
Exit;
|
|
|
|
|
|
end;
|
|
|
|
|
|
if CDS_Sub.IsEmpty = False then
|
|
|
|
|
|
begin
|
|
|
|
|
|
CopyAddRowCDS(CDS_Sub);
|
|
|
|
|
|
with CDS_Sub do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Edit;
|
|
|
|
|
|
FieldByName('SPID').Value := Trim(MMaxno);
|
|
|
|
|
|
post;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end
|
|
|
|
|
|
else
|
|
|
|
|
|
begin
|
|
|
|
|
|
with CDS_Sub do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Append;
|
|
|
|
|
|
FieldByName('SPID').Value := Trim(MMaxno);
|
|
|
|
|
|
FieldByName('CRTime').Value := Trim(FormatDateTime('yyyy-MM-dd', Now));
|
2025-09-26 16:19:47 +08:00
|
|
|
|
FieldByName('QtyUnit').Value := 'M';
|
|
|
|
|
|
FieldByName('ToFactoryName').Value := '<27><><EFBFBD><EFBFBD><EFBFBD>ֿ<EFBFBD>';
|
2025-09-29 16:40:01 +08:00
|
|
|
|
FieldByName('PriceType').Value := '<27><>';
|
|
|
|
|
|
FieldByName('IsTax').Value := '<27><>˰';
|
|
|
|
|
|
FieldByName('Price').Value := '0';
|
|
|
|
|
|
FieldByName('Qty').Value := '0';
|
|
|
|
|
|
FieldByName('KGQty').Value := '0';
|
2025-07-26 10:46:46 +08:00
|
|
|
|
Post;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
function TfrmYMTRKInPut.SaveCKData(): Boolean;
|
|
|
|
|
|
var
|
2025-10-20 11:30:39 +08:00
|
|
|
|
FCRID, Maxno, MaxMXno, FFSPID, FFMXID: string;
|
|
|
|
|
|
MXIDs: string; // <20><><EFBFBD><EFBFBD><EFBFBD>ռ<EFBFBD><D5BC><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>MXID
|
2025-07-26 10:46:46 +08:00
|
|
|
|
begin
|
|
|
|
|
|
try
|
|
|
|
|
|
ADOQueryCmd.Connection.BeginTrans;
|
|
|
|
|
|
CDS_Sub.DisableControls;
|
2025-10-20 11:30:39 +08:00
|
|
|
|
// <20><>ʼ<EFBFBD><CABC>MXIDs<44><73>ÿ<EFBFBD><C3BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼʱ<CABC><CAB1><EFBFBD><EFBFBD>
|
|
|
|
|
|
MXIDs := '';
|
2025-07-26 10:46:46 +08:00
|
|
|
|
with CDS_Sub do
|
|
|
|
|
|
begin
|
|
|
|
|
|
First;
|
|
|
|
|
|
while not eof do
|
|
|
|
|
|
begin
|
2025-10-20 11:30:39 +08:00
|
|
|
|
|
2025-07-26 10:46:46 +08:00
|
|
|
|
with ADOQueryTemp do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Close;
|
|
|
|
|
|
sql.Clear;
|
|
|
|
|
|
sql.Add('select * from YMT_CK_CR where SPID=''' + Trim(CDS_Sub.fieldbyname('SPID').AsString) + '''');
|
|
|
|
|
|
open;
|
|
|
|
|
|
end;
|
|
|
|
|
|
FFSPID := Trim(ADOQueryTemp.fieldbyname('SPID').AsString);
|
2025-10-20 11:30:39 +08:00
|
|
|
|
|
2025-07-26 10:46:46 +08:00
|
|
|
|
if Trim(FFSPID) = '' then
|
|
|
|
|
|
begin
|
|
|
|
|
|
Maxno := Trim(CDS_Sub.fieldbyname('SPID').AsString);
|
|
|
|
|
|
end
|
|
|
|
|
|
else
|
|
|
|
|
|
begin
|
|
|
|
|
|
Maxno := Trim(FFSPID);
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
with ADOQueryCmd do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Close;
|
|
|
|
|
|
sql.Clear;
|
|
|
|
|
|
sql.Add('select * from YMT_CK_CR where SPID=''' + Trim(Maxno) + '''');
|
|
|
|
|
|
Open;
|
|
|
|
|
|
end;
|
2025-08-12 16:22:08 +08:00
|
|
|
|
|
2025-07-26 10:46:46 +08:00
|
|
|
|
with ADOQueryCmd do
|
|
|
|
|
|
begin
|
|
|
|
|
|
if Trim(FFSPID) = '' then
|
|
|
|
|
|
begin
|
|
|
|
|
|
Append;
|
|
|
|
|
|
end
|
|
|
|
|
|
else
|
|
|
|
|
|
begin
|
|
|
|
|
|
Edit;
|
|
|
|
|
|
end;
|
2025-10-20 11:30:39 +08:00
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
//////////<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2025-07-26 10:46:46 +08:00
|
|
|
|
FieldByName('SPID').Value := Trim(Maxno);
|
2025-09-26 16:19:47 +08:00
|
|
|
|
FieldByName('FZSPID').Value := Trim(Maxno);
|
2025-07-26 10:46:46 +08:00
|
|
|
|
FieldByName('CKName').Value := '<27><><EFBFBD>첼';
|
2025-09-26 16:19:47 +08:00
|
|
|
|
FieldByName('CustomerNo').Value := Trim(CDS_Sub.fieldbyname('CustomerNo').AsString);
|
2025-07-26 10:46:46 +08:00
|
|
|
|
FieldByName('FactoryNo').Value := Trim(CDS_Sub.fieldbyname('FactoryNo').AsString);
|
|
|
|
|
|
FieldByName('FromFactoryNo').Value := Trim(CDS_Sub.fieldbyname('FromFactoryNo').AsString);
|
|
|
|
|
|
FieldByName('ToFactoryNo').Value := Trim(CDS_Sub.fieldbyname('ToFactoryNo').AsString);
|
|
|
|
|
|
FieldByName('ORDMainIdRK').Value := Trim(CDS_Sub.fieldbyname('ORDMainIdRK').AsString);
|
|
|
|
|
|
FieldByName('ORDSubIdRK').Value := Trim(CDS_Sub.fieldbyname('ORDSubIdRK').AsString);
|
|
|
|
|
|
FieldByName('CRFlag').Value := '<27><><EFBFBD><EFBFBD>';
|
|
|
|
|
|
FieldByName('CRQtyFlag').Value := 1;
|
2025-08-12 16:22:08 +08:00
|
|
|
|
|
2025-07-26 10:46:46 +08:00
|
|
|
|
RTSetSaveDataCDS(ADOQueryCmd, Tv1, CDS_Sub, 'YMT_CK_CR', 2);
|
2025-10-20 11:30:39 +08:00
|
|
|
|
|
2025-07-26 10:46:46 +08:00
|
|
|
|
if Trim(FFSPID) = '' then
|
|
|
|
|
|
FieldByName('Filler').Value := Trim(DName)
|
|
|
|
|
|
else
|
|
|
|
|
|
begin
|
|
|
|
|
|
FieldByName('Editer').Value := Trim(DName);
|
|
|
|
|
|
FieldByName('EditTime').Value := SGetServerDate(ADOQueryTemp);
|
|
|
|
|
|
end;
|
2025-08-12 16:22:08 +08:00
|
|
|
|
|
2025-07-26 10:46:46 +08:00
|
|
|
|
if Trim(CDS_Sub.fieldbyname('OrderNo').AsString) <> '' then
|
|
|
|
|
|
begin
|
|
|
|
|
|
FieldByName('QCOrderNo').Value := Trim(CDS_Sub.fieldbyname('OrderNo').AsString);
|
|
|
|
|
|
end;
|
2025-10-20 11:30:39 +08:00
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////
|
2025-07-26 10:46:46 +08:00
|
|
|
|
Post;
|
|
|
|
|
|
end;
|
2025-08-12 16:22:08 +08:00
|
|
|
|
|
2025-10-20 11:30:39 +08:00
|
|
|
|
//////////<2F><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
YFData();
|
|
|
|
|
|
|
2025-07-26 10:46:46 +08:00
|
|
|
|
with ADOQueryCmd do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Close;
|
|
|
|
|
|
sql.Clear;
|
|
|
|
|
|
sql.Add('Update YMT_CK_CR Set MXKCQty=(select sum(isnull(Qty,0)*CRQtyFlag) from YMT_CK_CR A where A.FZSPID=YMT_CK_CR.SPID)');
|
|
|
|
|
|
sql.Add(',MXKCPiQty=(select sum(isnull(PiQty,0)*CRQtyFlag) from YMT_CK_CR A where A.FZSPID=YMT_CK_CR.SPID)');
|
|
|
|
|
|
sql.Add(' where SPID=''' + Trim(Maxno) + '''');
|
|
|
|
|
|
ExecSQL;
|
|
|
|
|
|
end;
|
2025-08-12 16:22:08 +08:00
|
|
|
|
|
2025-07-26 10:46:46 +08:00
|
|
|
|
with ADOQueryTemp do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Close;
|
|
|
|
|
|
sql.Clear;
|
|
|
|
|
|
sql.Add('select * from YMT_CK_CR where SPID=''' + Trim(Maxno) + '''');
|
|
|
|
|
|
Open;
|
|
|
|
|
|
end;
|
2025-08-12 16:22:08 +08:00
|
|
|
|
|
2025-07-26 10:46:46 +08:00
|
|
|
|
if ADOQueryTemp.FieldByName('MXKCQty').Value < 0 then
|
|
|
|
|
|
begin
|
|
|
|
|
|
CDS_Sub.DisableControls;
|
|
|
|
|
|
ADOQueryCmd.Connection.RollbackTrans;
|
|
|
|
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD>ڳ<EFBFBD><DAB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܱ<EFBFBD><DCB1><EFBFBD>!', '<27><>ʾ', 0);
|
|
|
|
|
|
Exit;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2025-10-20 11:30:39 +08:00
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
/// <20><><EFBFBD><EFBFBD><EFBFBD>ӱ<EFBFBD>
|
|
|
|
|
|
with CDS_MX do
|
|
|
|
|
|
begin
|
|
|
|
|
|
DisableControls; // <20><><EFBFBD><EFBFBD>CDS_MX<4D>ؼ<EFBFBD>
|
|
|
|
|
|
try
|
|
|
|
|
|
CDS_MX.Filter := 'SPID = ''' + Trim(Maxno) + '''';
|
|
|
|
|
|
First;
|
|
|
|
|
|
while not Eof do
|
|
|
|
|
|
begin
|
|
|
|
|
|
// <20><>ѯ<EFBFBD><D1AF>ϸ<EFBFBD><CFB8>¼<EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
with ADOQueryTemp do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Close;
|
|
|
|
|
|
SQL.Clear;
|
|
|
|
|
|
SQL.Add('select * from YMT_CK_MX where MXID=''' + Trim(CDS_MX.fieldbyname('MXID').AsString) + '''');
|
|
|
|
|
|
Open;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
FFMXID := Trim(ADOQueryTemp.fieldbyname('MXID').AsString);
|
|
|
|
|
|
|
|
|
|
|
|
if Trim(FFMXID) = '' then
|
|
|
|
|
|
MaxMXno := Trim(CDS_MX.fieldbyname('MXID').AsString)
|
|
|
|
|
|
else
|
|
|
|
|
|
MaxMXno := Trim(FFMXID);
|
|
|
|
|
|
|
|
|
|
|
|
// <><D7BC><EFBFBD><EFBFBD>ϸ<EFBFBD><CFB8><EFBFBD><EFBFBD>
|
|
|
|
|
|
with ADOQueryCmd do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Close;
|
|
|
|
|
|
SQL.Clear;
|
|
|
|
|
|
SQL.Add('select * from YMT_CK_MX where MXID=''' + Trim(MaxMXno) + '''');
|
|
|
|
|
|
Open;
|
|
|
|
|
|
|
|
|
|
|
|
if Trim(FFMXID) = '' then
|
|
|
|
|
|
Append
|
|
|
|
|
|
else
|
|
|
|
|
|
Edit;
|
|
|
|
|
|
|
|
|
|
|
|
FieldByName('SPID').Value := Trim(CDS_MX.fieldbyname('SPID').AsString);
|
|
|
|
|
|
FieldByName('MXID').Value := Trim(MaxMXno); // ȷ<><C8B7>MXID<49><44><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
|
|
RTSetSaveDataCDS(ADOQueryCmd, TvMX, CDS_MX, 'YMT_CK_MX', 0);
|
|
|
|
|
|
|
|
|
|
|
|
if Trim(FFMXID) = '' then
|
|
|
|
|
|
FieldByName('Filler').Value := Trim(DName)
|
|
|
|
|
|
else
|
|
|
|
|
|
begin
|
|
|
|
|
|
FieldByName('EditUser').Value := Trim(DName);
|
|
|
|
|
|
FieldByName('EditTime').Value := SGetServerDate(ADOQueryTemp);
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
Post;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD>MQty<74>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>0<EFBFBD><30><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ռ<EFBFBD>MXID
|
|
|
|
|
|
if CDS_MX.FieldByName('MQty').AsFloat > 0 then
|
|
|
|
|
|
begin
|
|
|
|
|
|
if MXIDs <> '' then
|
|
|
|
|
|
MXIDs := MXIDs + ',' + Trim(MaxMXno)
|
|
|
|
|
|
else
|
|
|
|
|
|
MXIDs := Trim(MaxMXno);
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
Next; // <20>ƶ<EFBFBD><C6B6><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѭ<EFBFBD><D1AD>
|
|
|
|
|
|
end;
|
|
|
|
|
|
finally
|
|
|
|
|
|
EnableControls; // <20>ָ<EFBFBD>CDS_MX<4D>ؼ<EFBFBD>״̬
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2025-07-26 10:46:46 +08:00
|
|
|
|
Edit;
|
|
|
|
|
|
FieldByName('SPID').Value := Trim(Maxno);
|
|
|
|
|
|
Post;
|
2025-10-20 11:30:39 +08:00
|
|
|
|
|
2025-07-26 10:46:46 +08:00
|
|
|
|
Next;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
CDS_Sub.EnableControls;
|
2025-10-20 11:30:39 +08:00
|
|
|
|
|
2025-07-26 10:46:46 +08:00
|
|
|
|
ADOQueryCmd.Connection.CommitTrans;
|
2025-10-20 11:30:39 +08:00
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD>ýӿ<C3BD>
|
|
|
|
|
|
if MXIDs <> '' then
|
|
|
|
|
|
begin
|
|
|
|
|
|
if not BatchStockIn(MXIDs, Trim(DCode)) then
|
|
|
|
|
|
begin
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD>ӿڵ<D3BF><DAB5><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD>ع<EFBFBD><D8B9><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
// ADOQueryCmd.Connection.RollbackTrans;
|
|
|
|
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӿڵ<D3BF><DAB5><EFBFBD>ʧ<EFBFBD><CAA7>!', '<27><>ʾ', 0);
|
|
|
|
|
|
Exit;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
2025-07-26 10:46:46 +08:00
|
|
|
|
Result := True;
|
|
|
|
|
|
except
|
|
|
|
|
|
Result := False;
|
2025-10-20 11:30:39 +08:00
|
|
|
|
|
2025-07-26 10:46:46 +08:00
|
|
|
|
ADOQueryCmd.Connection.RollbackTrans;
|
|
|
|
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣!', '<27><>ʾ', 0);
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmYMTRKInPut.TBCloseClick(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
WriteCxGrid('<27><><EFBFBD>첼<EFBFBD><ECB2BC><EFBFBD><EFBFBD><EFBFBD>Ǽ<EFBFBD>', Tv1, '<27><><EFBFBD>첼<EFBFBD>ֿ<EFBFBD>');
|
|
|
|
|
|
Close;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmYMTRKInPut.FormShow(Sender: TObject);
|
|
|
|
|
|
var
|
|
|
|
|
|
fsj: string;
|
|
|
|
|
|
begin
|
|
|
|
|
|
ReadCxGrid('<27><><EFBFBD>첼<EFBFBD><ECB2BC><EFBFBD><EFBFBD><EFBFBD>Ǽ<EFBFBD>', Tv1, '<27><><EFBFBD>첼<EFBFBD>ֿ<EFBFBD>');
|
2025-09-09 17:22:59 +08:00
|
|
|
|
InitGrid();
|
|
|
|
|
|
|
2025-10-20 11:30:39 +08:00
|
|
|
|
with ADOQueryTemp do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Close;
|
|
|
|
|
|
sql.Clear;
|
|
|
|
|
|
sql.Add('select * from YMT_CK_MX ');
|
|
|
|
|
|
Open;
|
|
|
|
|
|
end;
|
|
|
|
|
|
SCreateCDS20(ADOQueryTemp, CDS_MX);
|
|
|
|
|
|
SInitCDSData20(ADOQueryTemp, CDS_MX);
|
|
|
|
|
|
if PState = 0 then
|
|
|
|
|
|
InitMXGrid(' ')
|
|
|
|
|
|
else
|
|
|
|
|
|
InitMXGrid(Trim(CDS_Sub.fieldbyname('SPID').AsString));
|
2025-07-26 10:46:46 +08:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmYMTRKInPut.TBDelClick(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
if CDS_Sub.IsEmpty then
|
|
|
|
|
|
Exit;
|
|
|
|
|
|
if Trim(CDS_Sub.fieldbyname('SPID').AsString) <> '' then
|
|
|
|
|
|
begin
|
|
|
|
|
|
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
|
|
|
|
|
Exit;
|
|
|
|
|
|
with ADOQueryTemp do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Close;
|
|
|
|
|
|
sql.Clear;
|
|
|
|
|
|
sql.Add('select * from YMT_CK_CR where FZSPID=''' + Trim(CDS_Sub.fieldbyname('SPID').AsString) + '''');
|
|
|
|
|
|
sql.Add(' and CRQtyFlag=-1');
|
|
|
|
|
|
Open;
|
|
|
|
|
|
end;
|
|
|
|
|
|
if ADOQueryTemp.IsEmpty = False then
|
|
|
|
|
|
begin
|
|
|
|
|
|
Application.MessageBox('<27><><EFBFBD>г<EFBFBD><D0B3><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE>!', '<27><>ʾ', 0);
|
|
|
|
|
|
Exit;
|
|
|
|
|
|
end;
|
|
|
|
|
|
try
|
|
|
|
|
|
ADOQueryCmd.Connection.BeginTrans;
|
|
|
|
|
|
with ADOQueryCmd do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Close;
|
|
|
|
|
|
sql.Clear;
|
|
|
|
|
|
sql.Add(' delete YMT_CK_CR where SPID=''' + Trim(CDS_Sub.fieldbyname('SPID').AsString) + '''');
|
|
|
|
|
|
ExecSQL;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
ADOQueryCmd.Connection.CommitTrans;
|
|
|
|
|
|
CDS_Sub.Delete;
|
|
|
|
|
|
except
|
|
|
|
|
|
ADOQueryCmd.Connection.RollbackTrans;
|
|
|
|
|
|
Application.MessageBox('ɾ<><C9BE><EFBFBD>쳣!', '<27><>ʾ', 0);
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
else
|
|
|
|
|
|
begin
|
|
|
|
|
|
CDS_Sub.Delete;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmYMTRKInPut.TBSaveClick(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
if CDS_Sub.IsEmpty then
|
|
|
|
|
|
Exit;
|
2025-08-12 16:22:08 +08:00
|
|
|
|
// if CDS_Sub.Locate('CRTime', null, []) = True then
|
|
|
|
|
|
// begin
|
|
|
|
|
|
// Application.MessageBox('<27><><EFBFBD><EFBFBD>ʱ<EFBFBD>䲻<EFBFBD><E4B2BB>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
|
|
|
|
|
// Exit;
|
|
|
|
|
|
// end;
|
2025-10-20 11:30:39 +08:00
|
|
|
|
|
|
|
|
|
|
if CDS_Sub.Locate('CRType', null, []) = True then
|
|
|
|
|
|
begin
|
|
|
|
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ͳ<EFBFBD><CDB2><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
|
|
|
|
|
Exit;
|
|
|
|
|
|
end;
|
|
|
|
|
|
if CDS_Sub.Locate('SPName', null, []) = True then
|
|
|
|
|
|
begin
|
|
|
|
|
|
Application.MessageBox('Ʒ<><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
|
|
|
|
|
Exit;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2025-08-12 16:22:08 +08:00
|
|
|
|
// if CDS_Sub.Locate('OrderNo', null, []) = True then
|
|
|
|
|
|
// begin
|
|
|
|
|
|
// Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
|
|
|
|
|
// Exit;
|
|
|
|
|
|
// end;
|
|
|
|
|
|
// if CDS_Sub.Locate('ToFactoryName', null, []) = True then
|
|
|
|
|
|
// begin
|
|
|
|
|
|
// Application.MessageBox('<27><><EFBFBD>Ź<EFBFBD><C5B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
|
|
|
|
|
// Exit;
|
|
|
|
|
|
// end;
|
2025-10-20 11:30:39 +08:00
|
|
|
|
if (trim(CDS_Sub.fieldbyname('CRType').AsString) <> '<27>ڳ<EFBFBD><DAB3><EFBFBD><EFBFBD><EFBFBD>') and (trim(CDS_Sub.fieldbyname('CRType').AsString) <> '<27>ͻ<EFBFBD><CDBB>˻<EFBFBD>') then
|
|
|
|
|
|
begin
|
|
|
|
|
|
if CDS_Sub.Locate('FactoryName', null, []) = True then
|
|
|
|
|
|
begin
|
|
|
|
|
|
Application.MessageBox('<27><>Ӧ<EFBFBD>̲<EFBFBD><CCB2><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
|
|
|
|
|
Exit;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-08-12 16:22:08 +08:00
|
|
|
|
// if CDS_Sub.Locate('PiQty', null, []) = True then
|
|
|
|
|
|
// begin
|
|
|
|
|
|
// Application.MessageBox('ƥ<><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
|
|
|
|
|
// Exit;
|
|
|
|
|
|
// end;
|
|
|
|
|
|
// if CDS_Sub.Locate('Qty', null, []) = True then
|
|
|
|
|
|
// begin
|
|
|
|
|
|
// Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
|
|
|
|
|
// Exit;
|
|
|
|
|
|
// end;
|
|
|
|
|
|
// if CDS_Sub.Locate('QtyUnit', null, []) = True then
|
|
|
|
|
|
// begin
|
|
|
|
|
|
// Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
|
|
|
|
|
// Exit;
|
|
|
|
|
|
// end;
|
|
|
|
|
|
// if CDS_Sub.Locate('CRType;FromFactoryName', VarArrayOf(['<27><><EFBFBD><EFBFBD><EFBFBD>˻<EFBFBD>', Null]), [loPartialKey]) = True then
|
|
|
|
|
|
// begin
|
|
|
|
|
|
// Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>˻ص<CBBB><D8B5><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD><EFBFBD>Թ<EFBFBD><D4B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
|
|
|
|
|
// Exit;
|
|
|
|
|
|
// end;
|
2025-07-26 10:46:46 +08:00
|
|
|
|
if SaveCKData() then
|
|
|
|
|
|
begin
|
|
|
|
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>!', '<27><>ʾ', 0);
|
|
|
|
|
|
//ModalResult:=1;
|
|
|
|
|
|
Exit;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmYMTRKInPut.v1Column14PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|
|
|
|
|
begin
|
|
|
|
|
|
try
|
|
|
|
|
|
frmZdyAttachGYS := TfrmZdyAttachGYS.Create(Application);
|
|
|
|
|
|
with frmZdyAttachGYS do
|
|
|
|
|
|
begin
|
|
|
|
|
|
if ShowModal = 1 then
|
|
|
|
|
|
begin
|
2025-09-26 16:19:47 +08:00
|
|
|
|
|
2025-07-26 10:46:46 +08:00
|
|
|
|
with Self.CDS_Sub do
|
|
|
|
|
|
begin
|
|
|
|
|
|
edit;
|
2025-09-26 16:19:47 +08:00
|
|
|
|
FieldByName('FactoryNo').Value := Trim(frmZdyAttachGYS.CDS_HZ.fieldbyname('KHNo').AsString);
|
|
|
|
|
|
FieldByName('FactoryName').Value := Trim(frmZdyAttachGYS.CDS_HZ.fieldbyname('KHNameJC').AsString);
|
|
|
|
|
|
FieldByName('FromFactoryNo').Value := Trim(frmZdyAttachGYS.CDS_HZ.fieldbyname('KHNo').AsString);
|
|
|
|
|
|
FieldByName('FromFactoryName').Value := Trim(frmZdyAttachGYS.CDS_HZ.fieldbyname('KHNameJC').AsString);
|
2025-07-26 10:46:46 +08:00
|
|
|
|
//Post;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
finally
|
|
|
|
|
|
frmZdyAttachGYS.Free;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmYMTRKInPut.v2Column1PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
2025-09-26 16:19:47 +08:00
|
|
|
|
begin
|
|
|
|
|
|
try
|
|
|
|
|
|
frmMLMangeYHSel := TfrmMLMangeYHSel.Create(Application);
|
|
|
|
|
|
with frmMLMangeYHSel do
|
|
|
|
|
|
begin
|
|
|
|
|
|
if ShowModal = 1 then
|
|
|
|
|
|
begin
|
|
|
|
|
|
with Self.CDS_Sub do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Edit;
|
2025-09-30 15:36:41 +08:00
|
|
|
|
FieldByName('SPcode').Value := Trim(frmMLMangeYHSel.CDS_Main.fieldbyname('MLXXNO').AsString);
|
2025-09-26 16:19:47 +08:00
|
|
|
|
FieldByName('SPName').Value := Trim(frmMLMangeYHSel.CDS_Main.fieldbyname('MLName').AsString);
|
|
|
|
|
|
FieldByName('GYLXName').Value := Trim(frmMLMangeYHSel.CDS_Main.fieldbyname('GYLXName').AsString);
|
|
|
|
|
|
FieldByName('SPCF').Value := Trim(frmMLMangeYHSel.CDS_Main.fieldbyname('MLCF').AsString);
|
|
|
|
|
|
FieldByName('SPMF').Value := Trim(frmMLMangeYHSel.CDS_Main.fieldbyname('MLMF').AsString);
|
|
|
|
|
|
FieldByName('SPKZ').Value := Trim(frmMLMangeYHSel.CDS_Main.fieldbyname('MLkz').AsString);
|
|
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
finally
|
|
|
|
|
|
frmMLMangeYHSel.Free;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2025-07-26 10:46:46 +08:00
|
|
|
|
procedure TfrmYMTRKInPut.v1Column11PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|
|
|
|
|
begin
|
|
|
|
|
|
try
|
|
|
|
|
|
frmZdyAttachGYS := TfrmZdyAttachGYS.Create(Application);
|
|
|
|
|
|
with frmZdyAttachGYS do
|
|
|
|
|
|
begin
|
|
|
|
|
|
if ShowModal = 1 then
|
|
|
|
|
|
begin
|
|
|
|
|
|
with Self.CDS_Sub do
|
|
|
|
|
|
begin
|
|
|
|
|
|
edit;
|
2025-09-26 16:19:47 +08:00
|
|
|
|
FieldByName('ToFactoryNo').Value := Trim(frmZdyAttachGYS.CDS_HZ.fieldbyname('KHNo').AsString);
|
|
|
|
|
|
FieldByName('ToFactoryName').Value := Trim(frmZdyAttachGYS.CDS_HZ.fieldbyname('KHNameJC').AsString);
|
2025-07-26 10:46:46 +08:00
|
|
|
|
//Post;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
finally
|
|
|
|
|
|
frmZdyAttachGYS.Free;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmYMTRKInPut.v1Column16PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|
|
|
|
|
begin
|
|
|
|
|
|
try
|
|
|
|
|
|
frmZdyAttachGYS := TfrmZdyAttachGYS.Create(Application);
|
|
|
|
|
|
with frmZdyAttachGYS do
|
|
|
|
|
|
begin
|
|
|
|
|
|
if ShowModal = 1 then
|
|
|
|
|
|
begin
|
|
|
|
|
|
with Self.CDS_Sub do
|
|
|
|
|
|
begin
|
|
|
|
|
|
edit;
|
|
|
|
|
|
FieldByName('FromFactoryNo').Value := Trim(frmZdyAttachGYS.CDS_HZ.fieldbyname('ZdyCode').AsString);
|
|
|
|
|
|
FieldByName('FromFactoryName').Value := Trim(frmZdyAttachGYS.CDS_HZ.fieldbyname('ZdyName').AsString);
|
|
|
|
|
|
//Post;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
finally
|
|
|
|
|
|
frmZdyAttachGYS.Free;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmYMTRKInPut.v1Column18PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|
|
|
|
|
begin
|
2025-09-30 15:36:41 +08:00
|
|
|
|
try
|
|
|
|
|
|
frmKuWeiList := TfrmKuWeiList.Create(Application);
|
|
|
|
|
|
with frmKuWeiList do
|
|
|
|
|
|
begin
|
|
|
|
|
|
if ShowModal = 1 then
|
|
|
|
|
|
begin
|
|
|
|
|
|
with Self.CDS_Sub do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Edit;
|
|
|
|
|
|
FieldByName('KuWei').Value := Trim(frmKuWeiList.Order_Main.fieldbyname('KWName').AsString);
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
finally
|
|
|
|
|
|
frmKuWeiList.Free;
|
|
|
|
|
|
end;
|
2025-07-26 10:46:46 +08:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmYMTRKInPut.Button2Click(Sender: TObject);
|
|
|
|
|
|
var
|
|
|
|
|
|
CRType, FactoryName, RCGangNo, ToFactoryName, KuWei, QtyUnit, Note: string;
|
|
|
|
|
|
i, PiQty: Integer;
|
|
|
|
|
|
qty: Double;
|
|
|
|
|
|
begin
|
|
|
|
|
|
try
|
|
|
|
|
|
if CDS_Sub.IsEmpty then
|
|
|
|
|
|
Exit;
|
|
|
|
|
|
CDS_Sub.DisableControls;
|
|
|
|
|
|
with CDS_Sub do
|
|
|
|
|
|
begin
|
|
|
|
|
|
CRType := Trim(CDS_Sub.fieldbyname('CRType').AsString);
|
|
|
|
|
|
FactoryName := Trim(CDS_Sub.fieldbyname('FactoryName').AsString);
|
|
|
|
|
|
RCGangNo := Trim(CDS_Sub.fieldbyname('RCGangNo').AsString);
|
|
|
|
|
|
ToFactoryName := Trim(CDS_Sub.fieldbyname('ToFactoryName').AsString);
|
|
|
|
|
|
KuWei := Trim(CDS_Sub.fieldbyname('KuWei').AsString);
|
|
|
|
|
|
PiQty := CDS_Sub.fieldbyname('PiQty').AsInteger;
|
|
|
|
|
|
qty := CDS_Sub.fieldbyname('Qty').AsFloat;
|
|
|
|
|
|
QtyUnit := Trim(CDS_Sub.fieldbyname('QtyUnit').AsString);
|
|
|
|
|
|
Note := Trim(CDS_Sub.fieldbyname('Note').AsString);
|
|
|
|
|
|
end;
|
|
|
|
|
|
with CDS_Sub do
|
|
|
|
|
|
begin
|
|
|
|
|
|
First;
|
|
|
|
|
|
while not eof do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Edit;
|
|
|
|
|
|
if CheckBox1.Checked then
|
|
|
|
|
|
FieldByName('CRType').Value := CRType;
|
|
|
|
|
|
if CheckBox2.Checked then
|
|
|
|
|
|
FieldByName('FactoryName').Value := FactoryName;
|
|
|
|
|
|
if CheckBox3.Checked then
|
|
|
|
|
|
FieldByName('RCGangNo').Value := RCGangNo;
|
|
|
|
|
|
if CheckBox4.Checked then
|
|
|
|
|
|
FieldByName('ToFactoryName').Value := ToFactoryName;
|
|
|
|
|
|
if CheckBox5.Checked then
|
|
|
|
|
|
FieldByName('KuWei').Value := KuWei;
|
|
|
|
|
|
if CheckBox6.Checked then
|
|
|
|
|
|
FieldByName('PiQty').Value := PiQty;
|
|
|
|
|
|
if CheckBox7.Checked then
|
|
|
|
|
|
FieldByName('Qty').Value := qty;
|
|
|
|
|
|
if CheckBox8.Checked then
|
|
|
|
|
|
FieldByName('QtyUnit').Value := QtyUnit;
|
|
|
|
|
|
if CheckBox9.Checked then
|
|
|
|
|
|
FieldByName('Note').Value := Note;
|
|
|
|
|
|
Post;
|
|
|
|
|
|
Next;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
CDS_Sub.EnableControls;
|
|
|
|
|
|
except
|
|
|
|
|
|
Application.MessageBox('<27>滻<EFBFBD>쳣!', '<27><>ʾ', 0);
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmYMTRKInPut.ToolButton2Click(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
Panel4.Visible := True;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmYMTRKInPut.Image2Click(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
Panel4.Visible := False;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmYMTRKInPut.Button1Click(Sender: TObject);
|
|
|
|
|
|
var
|
|
|
|
|
|
i: Integer;
|
|
|
|
|
|
begin
|
|
|
|
|
|
for i := 0 to GroupBox1.ControlCount - 1 do
|
|
|
|
|
|
begin
|
|
|
|
|
|
if GroupBox1.Controls[i] is TCheckBox then
|
|
|
|
|
|
begin
|
|
|
|
|
|
TCheckBox(GroupBox1.Controls[i]).Checked := true;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmYMTRKInPut.ToolButton3Click(Sender: TObject);
|
|
|
|
|
|
var
|
2025-08-08 17:35:13 +08:00
|
|
|
|
i, PiQty: Integer;
|
|
|
|
|
|
MaxNo, MMXID, SPID: string;
|
2025-07-26 10:46:46 +08:00
|
|
|
|
begin
|
2025-08-08 17:35:13 +08:00
|
|
|
|
SPID := Trim(CDS_Sub.fieldbyname('SPID').AsString);
|
2025-08-12 16:22:08 +08:00
|
|
|
|
PiQty := StrToInt(Trim(CDS_Sub.fieldbyname('PiQty').AsString));
|
2025-07-26 10:46:46 +08:00
|
|
|
|
if GetLSNo(ADOQueryTemp, MaxNo, 'MCM', 'YMT_CK_MX', 3, 1) = False then
|
|
|
|
|
|
begin
|
|
|
|
|
|
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!', '<27><>ʾ', 0);
|
|
|
|
|
|
Exit;
|
|
|
|
|
|
end;
|
2025-08-08 17:35:13 +08:00
|
|
|
|
|
2025-07-26 10:46:46 +08:00
|
|
|
|
try
|
|
|
|
|
|
ADOQueryCmd.Connection.BeginTrans;
|
2025-08-12 16:22:08 +08:00
|
|
|
|
for i := 0 to PiQty - 1 do
|
2025-07-26 10:46:46 +08:00
|
|
|
|
begin
|
2025-08-12 16:22:08 +08:00
|
|
|
|
MMXID := Trim(MaxNo);
|
2025-07-26 10:46:46 +08:00
|
|
|
|
with ADOQueryCmd do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Close;
|
|
|
|
|
|
SQL.Clear;
|
2025-08-08 17:35:13 +08:00
|
|
|
|
sql.Add('insert into YMT_CK_MX (MXID,SPID,MXQty)');
|
2025-07-26 10:46:46 +08:00
|
|
|
|
sql.Add('values(' + quotedstr(MMXID));
|
2025-08-08 17:35:13 +08:00
|
|
|
|
sql.Add(',' + quotedstr(Trim(SPID)));
|
2025-07-26 10:46:46 +08:00
|
|
|
|
sql.Add(',0');
|
|
|
|
|
|
sql.Add(')');
|
|
|
|
|
|
ExecSQL;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
ADOQueryCmd.Connection.CommitTrans;
|
2025-08-08 17:35:13 +08:00
|
|
|
|
InitMXGrid(SPID);
|
2025-07-26 10:46:46 +08:00
|
|
|
|
except
|
|
|
|
|
|
ADOQueryCmd.Connection.RollbackTrans;
|
|
|
|
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!', '<27><>ʾ', 0);
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmYMTRKInPut.Tv1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
|
|
|
|
|
begin
|
|
|
|
|
|
|
|
|
|
|
|
InitMXGrid(Trim(CDS_Sub.fieldbyname('SPID').AsString));
|
|
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmYMTRKInPut.cxGridDBColumn8PropertiesEditValueChanged(Sender: TObject);
|
|
|
|
|
|
var
|
|
|
|
|
|
mvalue, FFieldName: string;
|
|
|
|
|
|
begin
|
|
|
|
|
|
|
|
|
|
|
|
mvalue := TcxTextEdit(Sender).EditingText;
|
|
|
|
|
|
FFieldName := Trim(TvMX.Controller.FocusedColumn.DataBinding.FilterFieldName);
|
|
|
|
|
|
with CDS_MX do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Edit;
|
|
|
|
|
|
FieldByName(FFieldName).Value := mvalue;
|
|
|
|
|
|
Post;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
with ADOQueryCmd do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Close;
|
|
|
|
|
|
SQL.Clear;
|
|
|
|
|
|
sql.Add('update YMT_CK_MX set ' + FFieldName + ' = ' + mvalue);
|
|
|
|
|
|
sql.Add(' where MXID=' + quotedstr(Trim(CDS_MX.FieldByName('MXID').AsString)));
|
|
|
|
|
|
ExecSQL;
|
|
|
|
|
|
end;
|
|
|
|
|
|
TvMX.Controller.EditingController.ShowEdit();
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmYMTRKInPut.ToolButton4Click(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
with ADOQueryCmd do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Close;
|
|
|
|
|
|
SQL.Clear;
|
|
|
|
|
|
sql.Add('delete YMT_CK_MX where MXID=' + quotedstr(Trim(CDS_MX.FieldByName('MXID').AsString)));
|
|
|
|
|
|
ExecSQL;
|
|
|
|
|
|
end;
|
|
|
|
|
|
CDS_MX.Delete;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmYMTRKInPut.TvMXCustomDrawIndicatorCell(Sender: TcxGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxCustomGridIndicatorItemViewInfo; var ADone: Boolean);
|
|
|
|
|
|
var
|
|
|
|
|
|
FValue: string;
|
|
|
|
|
|
FBounds: TRect;
|
|
|
|
|
|
begin
|
|
|
|
|
|
FBounds := AViewInfo.Bounds;
|
|
|
|
|
|
if (AViewInfo is TcxGridIndicatorRowItemViewInfo) then
|
|
|
|
|
|
begin
|
|
|
|
|
|
ACanvas.FillRect(FBounds);
|
|
|
|
|
|
ACanvas.DrawComplexFrame(FBounds, clBtnHighlight, clBtnShadow, [bBottom, bLeft, bRight], 1);
|
|
|
|
|
|
FValue := IntToStr(TcxGridIndicatorRowItemViewInfo(AViewInfo).GridRecord.Index + 1);
|
|
|
|
|
|
InflateRect(FBounds, -1, -1); //Platform specific. May not work on Linux.
|
|
|
|
|
|
ACanvas.Font.Color := clBlack;
|
|
|
|
|
|
ACanvas.Brush.Style := bsClear;
|
|
|
|
|
|
ACanvas.DrawText(FValue, FBounds, cxAlignCenter or cxAlignTop);
|
|
|
|
|
|
ADone := True;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmYMTRKInPut.TvMXKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
|
|
|
|
|
|
begin
|
|
|
|
|
|
TvMX.OptionsData.Editing := False;
|
|
|
|
|
|
if Key = 13 then
|
|
|
|
|
|
Key := 40;
|
|
|
|
|
|
TvMX.OptionsData.Editing := True;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2025-09-26 16:19:47 +08:00
|
|
|
|
procedure TfrmYMTRKInPut.v1Column21PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|
|
|
|
|
begin
|
|
|
|
|
|
try
|
|
|
|
|
|
frmZdyAttachkh := TfrmZdyAttachkh.Create(Application);
|
|
|
|
|
|
with frmZdyAttachkh do
|
|
|
|
|
|
begin
|
|
|
|
|
|
if ShowModal = 1 then
|
|
|
|
|
|
begin
|
|
|
|
|
|
|
|
|
|
|
|
with Self.CDS_Sub do
|
|
|
|
|
|
begin
|
|
|
|
|
|
edit;
|
|
|
|
|
|
FieldByName('CustomerNo').Value := Trim(frmZdyAttachkh.CDS_HZ.fieldbyname('KHNo').AsString);
|
|
|
|
|
|
FieldByName('CustomerNoName').Value := Trim(frmZdyAttachkh.CDS_HZ.fieldbyname('KHNameJC').AsString);
|
|
|
|
|
|
//Post;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
finally
|
|
|
|
|
|
frmZdyAttachkh.Free;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2025-09-30 15:36:41 +08:00
|
|
|
|
procedure TfrmYMTRKInPut.Tv1PricePropertiesEditValueChanged(Sender: TObject);
|
2025-09-29 16:40:01 +08:00
|
|
|
|
var
|
2025-09-30 15:36:41 +08:00
|
|
|
|
mvalue, FFieldName: string;
|
2025-09-29 16:40:01 +08:00
|
|
|
|
begin
|
|
|
|
|
|
mvalue := TcxCurrencyEdit(Sender).EditingText;
|
|
|
|
|
|
FFieldName := Trim(Tv1.Controller.FocusedColumn.DataBinding.FilterFieldName);
|
|
|
|
|
|
with CDS_Sub do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Edit;
|
|
|
|
|
|
FieldByName(FFieldName).Value := mvalue;
|
|
|
|
|
|
Post;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
with CDS_Sub do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Edit;
|
|
|
|
|
|
if FieldByName('PriceType').Value = '<27><>' then
|
|
|
|
|
|
FieldByName('Money').Value := FieldByName('Price').Asfloat * FieldByName('Qty').Asfloat
|
|
|
|
|
|
else
|
|
|
|
|
|
FieldByName('Money').Value := FieldByName('Price').Asfloat * FieldByName('KGQty').Asfloat;
|
|
|
|
|
|
Post;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2025-09-30 15:36:41 +08:00
|
|
|
|
procedure TfrmYMTRKInPut.Tv1PriceTypePropertiesEditValueChanged(Sender: TObject);
|
2025-09-29 16:40:01 +08:00
|
|
|
|
var
|
2025-09-30 15:36:41 +08:00
|
|
|
|
mvalue, FFieldName: string;
|
2025-09-29 16:40:01 +08:00
|
|
|
|
begin
|
|
|
|
|
|
mvalue := TcxComboBox(Sender).EditingText;
|
|
|
|
|
|
FFieldName := Trim(Tv1.Controller.FocusedColumn.DataBinding.FilterFieldName);
|
|
|
|
|
|
with CDS_Sub do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Edit;
|
|
|
|
|
|
FieldByName(FFieldName).Value := mvalue;
|
|
|
|
|
|
Post;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
with CDS_Sub do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Edit;
|
|
|
|
|
|
if FieldByName('PriceType').Value = '<27><>' then
|
|
|
|
|
|
FieldByName('Money').Value := FieldByName('Price').Asfloat * FieldByName('Qty').Asfloat
|
|
|
|
|
|
else
|
|
|
|
|
|
FieldByName('Money').Value := FieldByName('Price').Asfloat * FieldByName('KGQty').Asfloat;
|
|
|
|
|
|
Post;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2025-10-20 11:30:39 +08:00
|
|
|
|
procedure TfrmYMTRKInPut.BtnQuicklyAddClick(Sender: TObject);
|
|
|
|
|
|
var
|
|
|
|
|
|
Num, i: Integer;
|
|
|
|
|
|
MaxNo, MMXID, SPID: string;
|
|
|
|
|
|
begin
|
|
|
|
|
|
Num := StrToInt(Trim(AddNum.Text));
|
|
|
|
|
|
SPID := Trim(CDS_Sub.fieldbyname('SPID').AsString);
|
|
|
|
|
|
if SPID = '' then
|
|
|
|
|
|
Exit;
|
|
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
|
ADOQueryCmd.Connection.BeginTrans;
|
|
|
|
|
|
for i := 1 to Num do
|
|
|
|
|
|
begin
|
|
|
|
|
|
if GetLSNo(ADOQueryTemp, MaxNo, 'MCM', 'YMT_CK_MX', 3, 1) = False then
|
|
|
|
|
|
begin
|
|
|
|
|
|
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!', '<27><>ʾ', 0);
|
|
|
|
|
|
Exit;
|
|
|
|
|
|
end;
|
|
|
|
|
|
MMXID := Trim(MaxNo);
|
|
|
|
|
|
with CDS_MX do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Append;
|
|
|
|
|
|
FieldByName('MXID').Value := MMXID;
|
|
|
|
|
|
FieldByName('SPID').Value := SPID;
|
|
|
|
|
|
FieldByName('MQty').Value := '0';
|
|
|
|
|
|
FieldByName('KGQty').Value := '0';
|
|
|
|
|
|
Post;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
ADOQueryCmd.Connection.CommitTrans;
|
|
|
|
|
|
except
|
|
|
|
|
|
ADOQueryCmd.Connection.RollbackTrans;
|
|
|
|
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!', '<27><>ʾ', 0);
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmYMTRKInPut.TbAddRowClick(Sender: TObject);
|
|
|
|
|
|
var
|
|
|
|
|
|
MaxNo, MMXID, SPID: string;
|
|
|
|
|
|
begin
|
|
|
|
|
|
SPID := Trim(CDS_Sub.fieldbyname('SPID').AsString);
|
|
|
|
|
|
if SPID = '' then
|
|
|
|
|
|
Exit;
|
|
|
|
|
|
if GetLSNo(ADOQueryTemp, MaxNo, 'MCM', 'YMT_CK_MX', 3, 1) = False then
|
|
|
|
|
|
begin
|
|
|
|
|
|
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!', '<27><>ʾ', 0);
|
|
|
|
|
|
Exit;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
MMXID := Trim(MaxNo);
|
|
|
|
|
|
|
|
|
|
|
|
with CDS_MX do
|
|
|
|
|
|
begin
|
|
|
|
|
|
if IsEmpty = False then
|
|
|
|
|
|
begin
|
|
|
|
|
|
Append;
|
|
|
|
|
|
end
|
|
|
|
|
|
else
|
|
|
|
|
|
begin
|
|
|
|
|
|
Edit;
|
|
|
|
|
|
end;
|
|
|
|
|
|
FieldByName('MXID').Value := MMXID;
|
|
|
|
|
|
FieldByName('SPID').Value := SPID;
|
|
|
|
|
|
FieldByName('MQty').Value := '0';
|
|
|
|
|
|
FieldByName('KGQty').Value := '0';
|
|
|
|
|
|
Post;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmYMTRKInPut.TbDeleteRowClick(Sender: TObject);
|
|
|
|
|
|
var
|
|
|
|
|
|
Bookmark: TBookmark;
|
|
|
|
|
|
begin
|
|
|
|
|
|
if CDS_MX.IsEmpty then
|
|
|
|
|
|
begin
|
|
|
|
|
|
Application.MessageBox('<27><>ǰû<C7B0>п<EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD>ļ<EFBFBD>¼<EFBFBD><C2BC>', '<27><>ʾ', MB_ICONWARNING);
|
|
|
|
|
|
Exit;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
if Trim(CDS_MX.fieldbyname('MXID').AsString) <> '' then
|
|
|
|
|
|
begin
|
|
|
|
|
|
with ADOQueryTemp do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Close;
|
|
|
|
|
|
sql.Clear;
|
|
|
|
|
|
sql.Add('select * from YMT_FHSQ_Sub where MXID=''' + Trim(CDS_MX.fieldbyname('MXID').AsString) + '''');
|
|
|
|
|
|
Open;
|
|
|
|
|
|
end;
|
|
|
|
|
|
if ADOQueryTemp.IsEmpty = False then
|
|
|
|
|
|
begin
|
|
|
|
|
|
Application.MessageBox('<27><><EFBFBD>г<EFBFBD><D0B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE>!', '<27><>ʾ', 0);
|
|
|
|
|
|
Exit;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', 'ȷ<><C8B7>ɾ<EFBFBD><C9BE>', MB_ICONQUESTION + MB_YESNO) <> IDYES then
|
|
|
|
|
|
Exit;
|
|
|
|
|
|
|
|
|
|
|
|
// <20><>¼<EFBFBD><C2BC>ǰ<EFBFBD>У<EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Իص<D4BB><D8B5><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
|
|
|
|
|
|
Bookmark := CDS_MX.GetBookmark;
|
|
|
|
|
|
with ADOQueryCmd do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Close;
|
|
|
|
|
|
SQL.Clear;
|
|
|
|
|
|
sql.Add('delete YMT_CK_MX where MXID=' + quotedstr(Trim(CDS_MX.FieldByName('MXID').AsString)));
|
|
|
|
|
|
ExecSQL;
|
|
|
|
|
|
end;
|
|
|
|
|
|
with ADOQueryCmd do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Close;
|
|
|
|
|
|
SQL.Clear;
|
|
|
|
|
|
sql.Add('delete YMT_CK_CR where FromMXID=' + quotedstr(Trim(CDS_MX.FieldByName('MXID').AsString)));
|
|
|
|
|
|
ExecSQL;
|
|
|
|
|
|
end;
|
|
|
|
|
|
try
|
|
|
|
|
|
CDS_MX.Delete;
|
|
|
|
|
|
finally
|
|
|
|
|
|
if CDS_MX.BookmarkValid(Bookmark) then
|
|
|
|
|
|
CDS_MX.GotoBookmark(Bookmark);
|
|
|
|
|
|
CDS_MX.FreeBookmark(Bookmark);
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmYMTRKInPut.AddNumKeyPress(Sender: TObject; var Key: Char);
|
|
|
|
|
|
begin
|
|
|
|
|
|
if Key = #13 then
|
|
|
|
|
|
BtnQuicklyAdd.Click;
|
|
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmYMTRKInPut.FormDestroy(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
if Assigned(FSelectedSPIDs) then
|
|
|
|
|
|
FSelectedSPIDs.Free;
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmYMTRKInPut.FormCreate(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
FSelectedSPIDs := TStringList.Create;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2025-07-26 10:46:46 +08:00
|
|
|
|
end.
|
|
|
|
|
|
|