1075 lines
29 KiB
ObjectPascal
1075 lines
29 KiB
ObjectPascal
![]() |
unit U_DJBJYInput;
|
|||
|
|
|||
|
interface
|
|||
|
|
|||
|
uses
|
|||
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|||
|
Dialogs, StdCtrls, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData,
|
|||
|
cxDataStorage, cxEdit, DB, cxDBData, cxCalendar, cxGridLevel,
|
|||
|
cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxClasses,
|
|||
|
cxControls, cxGridCustomView, cxGrid, RM_Common, RM_Class, RM_GridReport,
|
|||
|
RM_System, RM_Dataset, ADODB, DBClient, cxGridCustomPopupMenu, cxGridPopupMenu,
|
|||
|
ExtCtrls, ComCtrls, ToolWin, cxTextEdit, Buttons, cxSplitter, cxCheckBox,
|
|||
|
MovePanel, cxLookAndFeels, cxLookAndFeelPainters, cxNavigator;
|
|||
|
|
|||
|
type
|
|||
|
TfrmDJBJYInput = class(TForm)
|
|||
|
cxStyleRepository1: TcxStyleRepository;
|
|||
|
cxStyle1: TcxStyle;
|
|||
|
cxStyle2: TcxStyle;
|
|||
|
cxGridPopupMenu1: TcxGridPopupMenu;
|
|||
|
DataSource1: TDataSource;
|
|||
|
Order_MJ: TClientDataSet;
|
|||
|
ADOQueryMain: TADOQuery;
|
|||
|
ADOCmd: TADOQuery;
|
|||
|
ADOTmp: TADOQuery;
|
|||
|
RMDB_Main: TRMDBDataSet;
|
|||
|
RM2: TRMGridReport;
|
|||
|
DataSource2: TDataSource;
|
|||
|
CDS_MJCD: TClientDataSet;
|
|||
|
DataSource3: TDataSource;
|
|||
|
CDS_MJID: TClientDataSet;
|
|||
|
Timer1: TTimer;
|
|||
|
ADOQueryPrint: TADOQuery;
|
|||
|
cxStyleRepository2: TcxStyleRepository;
|
|||
|
cxStyle3: TcxStyle;
|
|||
|
cxStyleRepository3: TcxStyleRepository;
|
|||
|
cxStyle4: TcxStyle;
|
|||
|
cxStyleRepository4: TcxStyleRepository;
|
|||
|
cxStyle5: TcxStyle;
|
|||
|
cxStyleRepository5: TcxStyleRepository;
|
|||
|
cxStyle6: TcxStyle;
|
|||
|
cxGridPopupMenu2: TcxGridPopupMenu;
|
|||
|
ADOQueryMainDSC: TADOQuery;
|
|||
|
Panel2: TPanel;
|
|||
|
Label9: TLabel;
|
|||
|
MJLen: TEdit;
|
|||
|
Label5: TLabel;
|
|||
|
BTPrint: TButton;
|
|||
|
Panel4: TPanel;
|
|||
|
Panel5: TPanel;
|
|||
|
Panel6: TPanel;
|
|||
|
Label1: TLabel;
|
|||
|
Label2: TLabel;
|
|||
|
Label16: TLabel;
|
|||
|
Label24: TLabel;
|
|||
|
Label25: TLabel;
|
|||
|
APID: TEdit;
|
|||
|
BTEdit: TButton;
|
|||
|
ToolBar1: TToolBar;
|
|||
|
TBClose: TToolButton;
|
|||
|
Button3: TButton;
|
|||
|
Label36: TLabel;
|
|||
|
MJStr4: TEdit;
|
|||
|
Label37: TLabel;
|
|||
|
MJXH: TEdit;
|
|||
|
Label38: TLabel;
|
|||
|
ComboBox2: TComboBox;
|
|||
|
Label3: TLabel;
|
|||
|
ADOTmp1: TADOQuery;
|
|||
|
lbl1: TLabel;
|
|||
|
BTAdd: TButton;
|
|||
|
GroupBox1: TGroupBox;
|
|||
|
cxGrid3: TcxGrid;
|
|||
|
Tv3: TcxGridDBTableView;
|
|||
|
cxGridDBColumn1: TcxGridDBColumn;
|
|||
|
v3Column1: TcxGridDBColumn;
|
|||
|
v3Column2: TcxGridDBColumn;
|
|||
|
v3Column6: TcxGridDBColumn;
|
|||
|
v3Column3: TcxGridDBColumn;
|
|||
|
cxGridLevel2: TcxGridLevel;
|
|||
|
procedure FormDestroy(Sender: TObject);
|
|||
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
procedure TBCloseClick(Sender: TObject);
|
|||
|
procedure Tv1CellClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
|||
|
procedure FormClick(Sender: TObject);
|
|||
|
procedure BTAddClick(Sender: TObject);
|
|||
|
procedure BTEditClick(Sender: TObject);
|
|||
|
procedure BTPrintClick(Sender: TObject);
|
|||
|
procedure Tv2CDQtyPropertiesEditValueChanged(Sender: TObject);
|
|||
|
procedure cxGridDBColumn2PropertiesChange(Sender: TObject);
|
|||
|
procedure Button20Click(Sender: TObject);
|
|||
|
procedure APIDKeyPress(Sender: TObject; var Key: Char);
|
|||
|
procedure Label9Click(Sender: TObject);
|
|||
|
procedure Button3Click(Sender: TObject);
|
|||
|
procedure MJQty4KeyPress(Sender: TObject; var Key: Char);
|
|||
|
procedure MJQty3Change(Sender: TObject);
|
|||
|
procedure MJStr4Exit(Sender: TObject);
|
|||
|
procedure ToolButton3Click(Sender: TObject);
|
|||
|
procedure MJLenKeyPress(Sender: TObject; var Key: Char);
|
|||
|
procedure Tv3CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
|||
|
private
|
|||
|
{ Private declarations }
|
|||
|
FInt, PState, PrintInt, SCInitGrid, FState, FCK, FFirstJ, FLastJ: Integer;
|
|||
|
FColumn, FBanZu, FAPID, FMainId, FSubId, FFFMJID: string;
|
|||
|
fRollType: string;
|
|||
|
isCommopen, IsJsMessage: boolean;
|
|||
|
MValue, FCDName: string;
|
|||
|
fxsws, fxsws1: string;
|
|||
|
FL: string;
|
|||
|
FJC: Double;
|
|||
|
procedure InitDDSL();
|
|||
|
procedure InitCDGridID();
|
|||
|
procedure AddCD(Fbtn: TButton);
|
|||
|
function SaveData(): Boolean;
|
|||
|
procedure BtnStatus(BSInt: Boolean);
|
|||
|
procedure AddCDNew(Fbtn: TSpeedButton);
|
|||
|
procedure PrtData(FMJID: string);
|
|||
|
public
|
|||
|
fmanage: string;
|
|||
|
FLen1: Double;
|
|||
|
{ Public declarations }
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
var
|
|||
|
frmDJBJYInput: TfrmDJBJYInput;
|
|||
|
newh, newh1: hwnd;
|
|||
|
|
|||
|
implementation
|
|||
|
|
|||
|
uses
|
|||
|
U_DataLink, U_Fun, U_ZDYHelp, U_iniParam;
|
|||
|
|
|||
|
{$R *.dfm}
|
|||
|
|
|||
|
procedure TfrmDJBJYInput.FormDestroy(Sender: TObject);
|
|||
|
begin
|
|||
|
frmDJBJYInput := nil;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDJBJYInput.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
begin
|
|||
|
Action := caFree;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDJBJYInput.InitCDGridID();
|
|||
|
begin
|
|||
|
with ADOQueryMain do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add('select ');
|
|||
|
sql.Add(' A.* from WFB_MJJY_DJB A where APID=''' + Trim(FAPID) + '''');
|
|||
|
sql.Add(' order by FillTime desc');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryMain, CDS_MJID);
|
|||
|
SInitCDSData20(ADOQueryMain, CDS_MJID);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDJBJYInput.InitDDSL();
|
|||
|
begin
|
|||
|
with ADOTmp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add('select sum(mjlen) as ZPLen,sum(MJQty4) as ZPJZ,sum(MJMaoz) as ZPMZ,count(mjid) as ZPPI from WFB_MJJY_DJB where apid=''' + trim(FAPID) + ''' and MJType=''<27><>Ʒ'' ');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
lbl1.Visible := True;
|
|||
|
lbl1.Caption := '<27><>Ʒƥ<C6B7><C6A5><EFBFBD><EFBFBD>' + ADOTmp.fieldbyname('ZPPI').AsString + ' <20><>Ʒ<EFBFBD><C6B7><EFBFBD>ȣ<EFBFBD>' + ADOTmp.fieldbyname('ZPLen').AsString;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDJBJYInput.TBCloseClick(Sender: TObject);
|
|||
|
var
|
|||
|
maxno: string;
|
|||
|
begin
|
|||
|
if CDS_MJCD.IsEmpty = False then
|
|||
|
begin
|
|||
|
if Trim(CDS_MJCD.FieldByName('MCID').AsString) = '' then
|
|||
|
begin
|
|||
|
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
Close;
|
|||
|
end;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
Close;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDJBJYInput.AddCD(Fbtn: TButton);
|
|||
|
begin
|
|||
|
if PState < 1 then
|
|||
|
Exit;
|
|||
|
if Order_MJ.IsEmpty then
|
|||
|
Exit;
|
|||
|
with CDS_MJCD do
|
|||
|
begin
|
|||
|
Append;
|
|||
|
FieldByName('cdname').Value := Trim(TButton(Fbtn).Caption);
|
|||
|
Post;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDJBJYInput.AddCDNew(Fbtn: TSpeedButton);
|
|||
|
begin
|
|||
|
with CDS_MJCD do
|
|||
|
begin
|
|||
|
Append;
|
|||
|
FieldByName('cdname').Value := Trim(TSpeedButton(Fbtn).Hint);
|
|||
|
Post;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDJBJYInput.Tv1CellClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
|||
|
begin
|
|||
|
FInt := 4;
|
|||
|
InitCDGridID();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDJBJYInput.FormClick(Sender: TObject);
|
|||
|
begin
|
|||
|
FInt := 4;
|
|||
|
end;
|
|||
|
|
|||
|
function TfrmDJBJYInput.SaveData(): Boolean;
|
|||
|
var
|
|||
|
maxno, FMJID, BZID, strsql: string;
|
|||
|
FMJLen: Double;
|
|||
|
FOrder: Integer;
|
|||
|
begin
|
|||
|
|
|||
|
result := false;
|
|||
|
if PState = 1 then
|
|||
|
FMJID := ''
|
|||
|
else if PState = 2 then
|
|||
|
FMJID := Trim(CDS_MJID.fieldbyname('MJID').AsString)
|
|||
|
else if PState < 1 then
|
|||
|
Exit;
|
|||
|
|
|||
|
if PState = 1 then
|
|||
|
begin
|
|||
|
|
|||
|
if fRollType = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
|
|||
|
begin
|
|||
|
with ADOCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select maxRoll=1+isnull(cast(max(mjxh) as int),0) ');
|
|||
|
sql.Add('from WFB_MJJY_DJB X where X.mainID=''' + trim(fmainId) + ''' ');
|
|||
|
Open;
|
|||
|
MJXH.Text := Trim(fieldbyname('maxRoll').AsString);
|
|||
|
end;
|
|||
|
end
|
|||
|
else if fRollType = '<27><><EFBFBD><EFBFBD><D7BA><EFBFBD><EFBFBD><EFBFBD>' then
|
|||
|
begin
|
|||
|
with ADOCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select maxRoll=1+isnull(cast(max(mjxh) as int),0) ');
|
|||
|
sql.Add('from WFB_MJJY_DJB X where X.subID=''' + trim(FSubId) + ''' ');
|
|||
|
sql.add('and X.MJStr4=' + quotedstr(trim(MJstr4.text)));
|
|||
|
Open;
|
|||
|
MJXH.Text := Trim(fieldbyname('maxRoll').AsString);
|
|||
|
end;
|
|||
|
end
|
|||
|
else if fRollType = '<27><EFBFBD><DEB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
|
|||
|
begin
|
|||
|
|
|||
|
end
|
|||
|
else if fRollType = '<27><>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
|
|||
|
begin
|
|||
|
with ADOCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select maxRoll=1+isnull(cast(max(mjxh) as int),(cast(''' + inttostr(FFirstJ) + ''' as int) - 1)) ');
|
|||
|
sql.Add('from WFB_MJJY_DJB X where X.subID=''' + trim(FSubId) + ''' ');
|
|||
|
// sql.add('and X.MJStr4=' + quotedstr(trim(MJstr4.text)));
|
|||
|
sql.add('and mjxh>=cast(''' + inttostr(FFirstJ) + ''' as int) ');
|
|||
|
sql.add('and mjxh<=cast(''' + inttostr(FLastJ) + ''' as int) ');
|
|||
|
Open;
|
|||
|
MJXH.Text := Trim(fieldbyname('maxRoll').AsString);
|
|||
|
if strtoint(mjxh.Text) > flastj then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27><><EFBFBD>ų<EFBFBD><C5B3><EFBFBD><EFBFBD><EFBFBD>Χ<EFBFBD><CEA7>', '<27><>ʾ', 0);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
with ADOCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select maxRoll=1+isnull(cast(max(mjxh) as int),0) ');
|
|||
|
sql.Add('from WFB_MJJY_DJB X where X.subID=''' + trim(FSubId) + ''' ');
|
|||
|
Open;
|
|||
|
MJXH.Text := Trim(fieldbyname('maxRoll').AsString);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
try
|
|||
|
ADOCmd.Connection.BeginTrans;
|
|||
|
|
|||
|
|
|||
|
///<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
with ADOCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
SQL.Add('select * from WFB_MJJY_DJB where MJId=''' + Trim(FMJID) + '''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
with ADOCmd do
|
|||
|
begin
|
|||
|
if Trim(FMJID) = '' then
|
|||
|
begin
|
|||
|
Append;
|
|||
|
if GetLSNo(ADOTmp, maxno, Trim(SCXFlag), 'WFB_MJJY_DJB', 4, 1) = False then
|
|||
|
begin
|
|||
|
ADOCmd.Connection.RollbackTrans;
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE><EFBFBD>쳣<EFBFBD><ECB3A3>', '<27><>ʾ', 0);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
maxno := Trim(FMJID);
|
|||
|
Edit;
|
|||
|
end;
|
|||
|
FieldByName('MainId').value := Trim(FMainId);
|
|||
|
FieldByName('SubId').value := Trim(FSubId);
|
|||
|
FieldByName('APId').value := Trim(FAPId);
|
|||
|
FieldByName('MJID').Value := Trim(maxno);
|
|||
|
FieldByName('MJStr2').Value := 'δ<><CEB4><EFBFBD><EFBFBD>';
|
|||
|
if trim(MJstr4.Text) = '' then
|
|||
|
begin
|
|||
|
FieldByName('MJstr4').Value := '0';
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
FieldByName('MJstr4').Value := Trim(MJstr4.Text);
|
|||
|
end;
|
|||
|
|
|||
|
if combobox2.ItemIndex = 2 then
|
|||
|
begin
|
|||
|
FieldByName('mjxh').Value := '0';
|
|||
|
end
|
|||
|
else if combobox2.ItemIndex = 3 then
|
|||
|
begin
|
|||
|
FieldByName('mjxh').Value := '0';
|
|||
|
end
|
|||
|
else if combobox2.ItemIndex = 4 then
|
|||
|
begin
|
|||
|
FieldByName('mjxh').Value := '0';
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
FieldByName('mjxh').Value := Trim(mjxh.Text);
|
|||
|
end;
|
|||
|
FieldByName('MJTypeOther').Value := Trim(Label9.Caption);
|
|||
|
|
|||
|
FieldByName('MJLen').Value := StrToFloatdef(trim(MJLen.Text), 0);
|
|||
|
|
|||
|
FieldByName('MJType').Value := '';
|
|||
|
|
|||
|
FieldByName('MJType').Value := combobox2.Text;
|
|||
|
|
|||
|
if Trim(FMJID) = '' then
|
|||
|
begin
|
|||
|
FieldByName('Filler').Value := Trim(DName);
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
FieldByName('Editer').Value := Trim(DName);
|
|||
|
FieldByName('EditTime').Value := SGetServerDateTime(ADOTmp);
|
|||
|
end;
|
|||
|
if Trim(SCXFlag) <> '' then
|
|||
|
begin
|
|||
|
FieldByName('JTType').Value := Trim(SCXFlag);
|
|||
|
end;
|
|||
|
|
|||
|
FieldByName('MJTypeOther').Value := Trim(Label9.Caption);
|
|||
|
Post;
|
|||
|
|
|||
|
end;
|
|||
|
if PState = 1 then
|
|||
|
begin
|
|||
|
if combobox2.ItemIndex = 2 then
|
|||
|
begin
|
|||
|
|
|||
|
end
|
|||
|
else if combobox2.ItemIndex = 3 then
|
|||
|
begin
|
|||
|
|
|||
|
end
|
|||
|
else if combobox2.ItemIndex = 4 then
|
|||
|
begin
|
|||
|
|
|||
|
end
|
|||
|
else if fRollType = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
|
|||
|
begin
|
|||
|
with ADOCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('update WFB_MJJY_DJB SET mjxh=1+isnull((select cast (max(mjxh) as int) from WFB_MJJY_DJB X where X.mainID=WFB_MJJY_DJB.mainID and X.MJID<>WFB_MJJY_DJB.MJID),0)');
|
|||
|
sql.Add('where MJID=''' + Trim(maxno) + '''');
|
|||
|
execsql;
|
|||
|
end;
|
|||
|
end
|
|||
|
else if fRollType = '<27><><EFBFBD><EFBFBD><D7BA><EFBFBD><EFBFBD><EFBFBD>' then
|
|||
|
begin
|
|||
|
with ADOCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('update WFB_MJJY_DJB SET mjxh=1+isnull((select cast (max(mjxh) as int) from WFB_MJJY_DJB X where X.subID=WFB_MJJY_DJB.subID and X.mjstr4=WFB_MJJY_DJB.mjstr4 and X.MJID<>WFB_MJJY_DJB.MJID),0)');
|
|||
|
sql.Add('where MJID=''' + Trim(maxno) + '''');
|
|||
|
execsql;
|
|||
|
end;
|
|||
|
end
|
|||
|
else if fRollType = '<27><EFBFBD><DEB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
|
|||
|
begin
|
|||
|
with ADOCmd do
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
end
|
|||
|
else if fRollType = '<27><>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
|
|||
|
begin
|
|||
|
with ADOCmd do
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
with ADOCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('update WFB_MJJY_DJB SET mjxh=1+isnull((select cast (max(mjxh) as int) from WFB_MJJY_DJB X where X.subID=WFB_MJJY_DJB.subID and X.MJID<>WFB_MJJY_DJB.MJID),0)');
|
|||
|
sql.Add('where MJID=''' + Trim(maxno) + '''');
|
|||
|
execsql;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
if combobox2.ItemIndex = 2 then
|
|||
|
begin
|
|||
|
if fRollType = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
|
|||
|
begin
|
|||
|
with ADOCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select maxRoll=1+isnull(cast(max(mjxh) as int),0) ');
|
|||
|
sql.Add('from WFB_MJJY_DJB X where X.mainID=''' + trim(fmainId) + ''' ');
|
|||
|
Open;
|
|||
|
MJXH.Text := Trim(fieldbyname('maxRoll').AsString);
|
|||
|
end;
|
|||
|
end
|
|||
|
else if fRollType = '<27><><EFBFBD><EFBFBD><D7BA><EFBFBD><EFBFBD><EFBFBD>' then
|
|||
|
begin
|
|||
|
with ADOCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select maxRoll=1+isnull(cast(max(mjxh) as int),0) ');
|
|||
|
sql.Add('from WFB_MJJY_DJB X where X.subID=''' + trim(FSubId) + ''' ');
|
|||
|
sql.add('and X.MJStr4=' + quotedstr(trim(MJstr4.text)));
|
|||
|
Open;
|
|||
|
MJXH.Text := Trim(fieldbyname('maxRoll').AsString);
|
|||
|
end;
|
|||
|
end
|
|||
|
else if fRollType = '<27><EFBFBD><DEB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
|
|||
|
begin
|
|||
|
|
|||
|
end
|
|||
|
else if fRollType = '<27><>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
|
|||
|
begin
|
|||
|
with ADOCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select maxRoll=1+isnull(cast(max(mjxh) as int),(cast(''' + inttostr(FFirstJ) + ''' as int) - 1)) ');
|
|||
|
sql.Add('from WFB_MJJY_DJB X where X.subID=''' + trim(FSubId) + ''' ');
|
|||
|
// sql.add('and X.MJStr4=' + quotedstr(trim(MJstr4.text)));
|
|||
|
sql.add('and mjxh>=cast(''' + inttostr(FFirstJ) + ''' as int) ');
|
|||
|
sql.add('and mjxh<=cast(''' + inttostr(FLastJ) + ''' as int) ');
|
|||
|
Open;
|
|||
|
MJXH.Text := Trim(fieldbyname('maxRoll').AsString);
|
|||
|
if strtoint(mjxh.Text) > flastj then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27><><EFBFBD>ų<EFBFBD><C5B3><EFBFBD><EFBFBD><EFBFBD>Χ<EFBFBD><CEA7>', '<27><>ʾ', 0);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
with ADOCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select maxRoll=1+isnull(cast(max(mjxh) as int),0) ');
|
|||
|
sql.Add('from WFB_MJJY_DJB X where X.subID=''' + trim(FSubId) + ''' ');
|
|||
|
Open;
|
|||
|
MJXH.Text := Trim(fieldbyname('maxRoll').AsString);
|
|||
|
end;
|
|||
|
end;
|
|||
|
end
|
|||
|
else if combobox2.ItemIndex = 3 then
|
|||
|
begin
|
|||
|
if fRollType = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
|
|||
|
begin
|
|||
|
with ADOCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select maxRoll=1+isnull(cast(max(mjxh) as int),0) ');
|
|||
|
sql.Add('from WFB_MJJY_DJB X where X.mainID=''' + trim(fmainId) + ''' ');
|
|||
|
Open;
|
|||
|
MJXH.Text := Trim(fieldbyname('maxRoll').AsString);
|
|||
|
end;
|
|||
|
end
|
|||
|
else if fRollType = '<27><><EFBFBD><EFBFBD><D7BA><EFBFBD><EFBFBD><EFBFBD>' then
|
|||
|
begin
|
|||
|
with ADOCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select maxRoll=1+isnull(cast(max(mjxh) as int),0) ');
|
|||
|
sql.Add('from WFB_MJJY_DJB X where X.subID=''' + trim(FSubId) + ''' ');
|
|||
|
sql.add('and X.MJStr4=' + quotedstr(trim(MJstr4.text)));
|
|||
|
Open;
|
|||
|
MJXH.Text := Trim(fieldbyname('maxRoll').AsString);
|
|||
|
end;
|
|||
|
end
|
|||
|
else if fRollType = '<27><EFBFBD><DEB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
|
|||
|
begin
|
|||
|
|
|||
|
end
|
|||
|
else if fRollType = '<27><>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
|
|||
|
begin
|
|||
|
with ADOCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select maxRoll=1+isnull(cast(max(mjxh) as int),(cast(''' + inttostr(FFirstJ) + ''' as int) - 1)) ');
|
|||
|
sql.Add('from WFB_MJJY_DJB X where X.subID=''' + trim(FSubId) + ''' ');
|
|||
|
// sql.add('and X.MJStr4=' + quotedstr(trim(MJstr4.text)));
|
|||
|
sql.add('and mjxh>=cast(''' + inttostr(FFirstJ) + ''' as int) ');
|
|||
|
sql.add('and mjxh<=cast(''' + inttostr(FLastJ) + ''' as int) ');
|
|||
|
Open;
|
|||
|
MJXH.Text := Trim(fieldbyname('maxRoll').AsString);
|
|||
|
if strtoint(mjxh.Text) > flastj then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27><><EFBFBD>ų<EFBFBD><C5B3><EFBFBD><EFBFBD><EFBFBD>Χ<EFBFBD><CEA7>', '<27><>ʾ', 0);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
with ADOCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select maxRoll=1+isnull(cast(max(mjxh) as int),0) ');
|
|||
|
sql.Add('from WFB_MJJY_DJB X where X.subID=''' + trim(FSubId) + ''' ');
|
|||
|
Open;
|
|||
|
MJXH.Text := Trim(fieldbyname('maxRoll').AsString);
|
|||
|
end;
|
|||
|
end;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
with ADOCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select MJXH from WFB_MJJY_DJB');
|
|||
|
sql.Add('where MJID=''' + Trim(maxno) + '''');
|
|||
|
open;
|
|||
|
if not IsEmpty then
|
|||
|
begin
|
|||
|
MJXH.Text := fieldbyname('mjxh').AsString;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
with ADOCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.add('exec P_Do_JYRK ''' + trim(maxno) + ''',''' + trim(DName) + ''' ');
|
|||
|
execsql;
|
|||
|
end;
|
|||
|
|
|||
|
FMJID := Trim(maxno);
|
|||
|
FFFMJID := Trim(maxno);
|
|||
|
|
|||
|
ADOCmd.Connection.CommitTrans;
|
|||
|
Result := True;
|
|||
|
except
|
|||
|
btprint.Enabled := true;
|
|||
|
Result := False;
|
|||
|
ADOCmd.Connection.RollbackTrans;
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDJBJYInput.BTAddClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if Trim(Label24.Caption) = '' then
|
|||
|
Exit;
|
|||
|
|
|||
|
PState := 1;
|
|||
|
InitCDGridID();
|
|||
|
BtnStatus(True);
|
|||
|
Label16.Caption := '<27><><EFBFBD><EFBFBD>';
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDJBJYInput.BTEditClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_MJID.IsEmpty then
|
|||
|
Exit;
|
|||
|
PState := 2;
|
|||
|
Label16.Caption := '<27><EFBFBD>';
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDJBJYInput.BTPrintClick(Sender: TObject);
|
|||
|
var
|
|||
|
fPrintFile: string;
|
|||
|
mvalue: Double;
|
|||
|
mvalue1: integer;
|
|||
|
i: Integer;
|
|||
|
FLen2: Double;
|
|||
|
begin
|
|||
|
|
|||
|
if (strtofloatdef(trim(MJLen.Text), 0) = 0) then
|
|||
|
begin
|
|||
|
application.MessageBox('<27><><EFBFBD>Ȳ<EFBFBD><C8B2><EFBFBD>Ϊ<EFBFBD>㣡', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
|
|||
|
if Trim(FAPID) = '' then
|
|||
|
Exit;
|
|||
|
|
|||
|
if trim(MJXH.text) = '' then
|
|||
|
begin
|
|||
|
application.MessageBox('<27><><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>', '<27><>ʾ');
|
|||
|
exit;
|
|||
|
end;
|
|||
|
|
|||
|
if trim(Label9.Caption) = '' then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27><><EFBFBD>ȵ<EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
|
|||
|
if ComboBox2.Text = '' then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27><><EFBFBD>Ͳ<EFBFBD><CDB2><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
|
|||
|
with ADOTmp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add('select sum(mjlen) as ZPLen,count(mjid) as ZPPI from WFB_MJJY_DJB where apid=''' + trim(FAPID) + ''' ');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
|
|||
|
FLen2 := StrToFloatDef(ADOTmp.fieldbyname('ZPLen').asstring, 0);
|
|||
|
|
|||
|
FLen2 := StrToFloatDef(Format('%.2f', [FLen2 + StrToFloatDef(MJLen.Text, 0)]), 0);
|
|||
|
|
|||
|
if FLen2 > FLen1 then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>첼<EFBFBD><ECB2BC><EFBFBD><EFBFBD><EFBFBD>Ǽǵ<C7BC><C7B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܱ<EFBFBD><DCB1><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
|
|||
|
btprint.Enabled := false;
|
|||
|
|
|||
|
if SaveData() then
|
|||
|
begin
|
|||
|
|
|||
|
MJLen.Text := '';
|
|||
|
ComboBox2.ItemIndex := 0;
|
|||
|
|
|||
|
if combobox2.ItemIndex = 0 then
|
|||
|
MJXH.Text := inttostr(strTointdef(trim(MJXH.Text), 0) + 1);
|
|||
|
if combobox2.ItemIndex = 1 then
|
|||
|
MJXH.Text := inttostr(strTointdef(trim(MJXH.Text), 0) + 1);
|
|||
|
|
|||
|
if PState = 2 then
|
|||
|
begin
|
|||
|
apid.Text := FAPID;
|
|||
|
Button3.Click;
|
|||
|
end;
|
|||
|
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
btprint.Enabled := true;
|
|||
|
exit;
|
|||
|
end;
|
|||
|
|
|||
|
btprint.Enabled := true;
|
|||
|
Label16.Caption := '';
|
|||
|
BTAdd.Click;
|
|||
|
InitDDSL();
|
|||
|
MJLen.SetFocus;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDJBJYInput.PrtData(FMJID: string);
|
|||
|
var
|
|||
|
fPrintFile: string;
|
|||
|
Txt, fImagePath: string;
|
|||
|
Moudle: THandle;
|
|||
|
Makebar: TMakebar;
|
|||
|
Mixtext: TMixtext;
|
|||
|
begin
|
|||
|
|
|||
|
with ADOQueryPrint do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add('select A.MJID,A.mjstr3,QtyUnit=A.MJTypeOther,B.orderNo,B.customerNoName,B.LBName,B.conno ');
|
|||
|
sql.Add(',EngColor=(select max(Note) from KH_Zdy X where X.ZDYName=C.PRTColor and X.Type=''OrdColor'' ) ');
|
|||
|
sql.Add(',B.MPRTCF,C.*,A.* ');
|
|||
|
sql.Add(' from WFB_MJJY_DJB A');
|
|||
|
sql.Add(' inner join JYOrder_Main B On A.Mainid=B.Mainid');
|
|||
|
sql.Add(' inner join JYOrder_Sub C on A.SubId=C.SubId');
|
|||
|
SQL.Add(' where A.MJID=''' + Trim(FMJID) + '''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
|
|||
|
try
|
|||
|
Moudle := LoadLibrary('MakeQRBarcode.dll');
|
|||
|
@Makebar := GetProcAddress(Moudle, 'Make');
|
|||
|
@Mixtext := GetProcAddress(Moudle, 'MixText');
|
|||
|
Txt := Trim(ADOQueryPrint.fieldbyname('MJID').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);
|
|||
|
CDS_MJID.EnableControls;
|
|||
|
exit;
|
|||
|
end;
|
|||
|
if Trim(ADOQueryPrint.fieldbyname('Slbname').AsString) <> '' then
|
|||
|
begin
|
|||
|
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + Trim(ADOQueryPrint.fieldbyname('Slbname').AsString);
|
|||
|
ExportFtErpFile(Trim(ADOQueryPrint.fieldbyname('Slbname').AsString), ADOCmd);
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\ͨ<>ñ<EFBFBD>ǩ.rmf';
|
|||
|
ExportFtErpFile('ͨ<>ñ<EFBFBD>ǩ.rmf', ADOCmd);
|
|||
|
end;
|
|||
|
|
|||
|
if FileExists(fPrintFile) then
|
|||
|
begin
|
|||
|
RMVariables['QRBARCODE'] := fImagePath;
|
|||
|
RM2.LoadFromFile(fPrintFile);
|
|||
|
|
|||
|
RM2.PrintReport;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + fPrintFile), '<27><>ʾ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDJBJYInput.BtnStatus(BSInt: Boolean);
|
|||
|
begin
|
|||
|
// Tv2.OptionsSelection.CellSelect:=BSInt;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDJBJYInput.Tv2CDQtyPropertiesEditValueChanged(Sender: TObject);
|
|||
|
var
|
|||
|
mvalue: string;
|
|||
|
begin
|
|||
|
try
|
|||
|
mvalue := TcxTextEdit(Sender).EditingText;
|
|||
|
if Trim(mvalue) <> '' then
|
|||
|
begin
|
|||
|
CDS_MJCD.Edit;
|
|||
|
CDS_MJCD.FieldByName('CDQty').Value := mvalue;
|
|||
|
CDS_MJCD.Post;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
CDS_MJCD.Edit;
|
|||
|
CDS_MJCD.FieldByName('CDQty').Value := 0;
|
|||
|
CDS_MJCD.Post;
|
|||
|
end;
|
|||
|
CDS_MJCD.Edit;
|
|||
|
CDS_MJCD.FieldByName('CDQtyS').Value := mvalue;
|
|||
|
except
|
|||
|
Application.MessageBox('<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>֣<EFBFBD>', '<27><>ʾ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDJBJYInput.cxGridDBColumn2PropertiesChange(Sender: TObject);
|
|||
|
var
|
|||
|
fsj: string;
|
|||
|
begin
|
|||
|
|
|||
|
fsj := Trim(Order_MJ.fieldbyname('SubId').AsString);
|
|||
|
Order_MJ.DisableControls;
|
|||
|
with Order_MJ do
|
|||
|
begin
|
|||
|
First;
|
|||
|
while not Eof do
|
|||
|
begin
|
|||
|
if Trim(Order_MJ.fieldbyname('SubId').AsString) <> fsj then
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
FieldByName('SSel').Value := False;
|
|||
|
end;
|
|||
|
Next;
|
|||
|
end;
|
|||
|
end;
|
|||
|
Order_MJ.EnableControls;
|
|||
|
Order_MJ.Locate('SubId', fsj, []);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDJBJYInput.Button20Click(Sender: TObject);
|
|||
|
var
|
|||
|
fPrintFile: string;
|
|||
|
i: Integer;
|
|||
|
begin
|
|||
|
if CDS_MJID.IsEmpty then
|
|||
|
Exit;
|
|||
|
PrtData(Trim(CDS_MJID.fieldbyname('MJID').AsString));
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDJBJYInput.APIDKeyPress(Sender: TObject; var Key: Char);
|
|||
|
begin
|
|||
|
if Key = #13 then
|
|||
|
begin
|
|||
|
Button3.Click;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDJBJYInput.Label9Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if trim(Label9.Caption) = 'M' then
|
|||
|
begin
|
|||
|
Label9.Caption := 'Y';
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
Label9.Caption := 'M';
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDJBJYInput.Button3Click(Sender: TObject);
|
|||
|
var
|
|||
|
FBaoID: string;
|
|||
|
begin
|
|||
|
fRollType := '';
|
|||
|
with ADOTmp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select B.*,B.OrderNo OrderNoM,C.*,D.gangno GN,D.firstJ,D.lastJ, ');
|
|||
|
sql.add('maxMJxh=case when B.Orddefstr15=''<27><>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' then isnull((select max(mjxh) from WFB_MJJY_DJB X where X.SubID=C.subID and cast(X.mjxh as int)>=cast(D.firstJ as int) and cast(X.mjxh as int)<=cast(D.lastJ as int)),(cast(D.firstJ as int)-1))');
|
|||
|
sql.Add('else isnull((select max(mjxh) from WFB_MJJY_DJB X where X.SubID=C.subID),0) end,');
|
|||
|
sql.Add('maxBaoNO=1+isnull((select max(cast(baoNO as int)) from WFB_MJJY_DJB X where X.subID=C.subID ),0)');
|
|||
|
sql.Add('from JYOrder_Sub C');
|
|||
|
SQL.Add('inner join JYOrder_Main B on B.MainId=C.MainId ');
|
|||
|
sql.add('inner join CK_SXPB_CR D on D.ORDSubIdCK=C.subid and D.SPID=''' + Trim(APID.Text) + '''');
|
|||
|
sql.Add('where exists(select SPID from CK_SXPB_CR X where X.OrdsubIDCK=C.subID and X.SPID=''' + Trim(APID.Text) + ''' )');
|
|||
|
// showmessage(sql.text);
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if ADOTmp.IsEmpty = False then
|
|||
|
begin
|
|||
|
|
|||
|
fRollType := trim(ADOTmp.fieldbyname('Orddefstr15').AsString);
|
|||
|
Label24.Visible := True;
|
|||
|
Label24.Caption := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:' + Trim(ADOTmp.fieldbyname('OrderNoM').AsString);
|
|||
|
Label38.Visible := True;
|
|||
|
Label38.Caption := '<27><>ɫ:' + Trim(ADOTmp.fieldbyname('PRTColor').AsString);
|
|||
|
Label25.Visible := True;
|
|||
|
Label25.Caption := 'ɫ<><C9AB>:' + Trim(ADOTmp.fieldbyname('SOrddefstr1').AsString);
|
|||
|
Label2.Visible := true;
|
|||
|
Label2.Caption := '<27><><EFBFBD>ͺ<EFBFBD>:' + Trim(ADOTmp.fieldbyname('PRTHX').AsString);
|
|||
|
FAPID := Trim(APID.Text);
|
|||
|
|
|||
|
FMainId := Trim(ADOTmp.fieldbyname('MainId').AsString);
|
|||
|
FSubId := Trim(ADOTmp.fieldbyname('SubId').AsString);
|
|||
|
MJXH.Text := inttostr(ADOTmp.fieldbyname('maxMJxh').AsInteger + 1);
|
|||
|
FJC := StrToFloatDef(ADOTmp.fieldbyname('jiaChang').asstring, 0);
|
|||
|
fxsws := Trim(ADOTmp.fieldbyname('xsws').AsString);
|
|||
|
fxsws1 := Trim(ADOTmp.fieldbyname('xsws1').AsString);
|
|||
|
|
|||
|
MJStr4.Text := '1';
|
|||
|
|
|||
|
if trim(ADOTmp.fieldbyname('Orddefstr15').AsString) = '<27><>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
|
|||
|
begin
|
|||
|
FFirstJ := ADOTmp.fieldbyname('firstJ').AsInteger;
|
|||
|
FlastJ := ADOTmp.fieldbyname('lastJ').AsInteger;
|
|||
|
end;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
Label2.Visible := False;
|
|||
|
Label2.Caption := '';
|
|||
|
APID.Text := '';
|
|||
|
FAPID := '';
|
|||
|
FMainId := '';
|
|||
|
FSubId := '';
|
|||
|
MJStr4.Text := '';
|
|||
|
fRollType := '';
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
|
|||
|
InitDDSL();
|
|||
|
|
|||
|
APID.Text := '';
|
|||
|
BTAdd.Click;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDJBJYInput.MJQty4KeyPress(Sender: TObject; var Key: Char);
|
|||
|
begin
|
|||
|
if Key = #13 then
|
|||
|
begin
|
|||
|
// BTPrint.Click;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDJBJYInput.MJQty3Change(Sender: TObject);
|
|||
|
begin
|
|||
|
// MJQty3.Text:=JsXj(MJQty3.Text);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDJBJYInput.MJStr4Exit(Sender: TObject);
|
|||
|
begin
|
|||
|
if Pstate = 1 then
|
|||
|
begin
|
|||
|
if fRollType = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
|
|||
|
begin
|
|||
|
with ADOCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select maxRoll=1+isnull(cast(max(mjxh) as int),0) ');
|
|||
|
sql.Add('from WFB_MJJY_DJB X where X.mainID=''' + trim(fMainID) + ''' ');
|
|||
|
// sql.add('and X.MJStr4='+quotedstr(trim(MJstr4.text)));
|
|||
|
Open;
|
|||
|
MJXH.Text := Trim(fieldbyname('maxRoll').AsString);
|
|||
|
end;
|
|||
|
end
|
|||
|
else if fRollType = '<27><><EFBFBD><EFBFBD><D7BA><EFBFBD><EFBFBD><EFBFBD>' then
|
|||
|
begin
|
|||
|
with ADOCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select maxRoll=1+isnull(cast(max(mjxh) as int),0) ');
|
|||
|
sql.Add('from WFB_MJJY_DJB X where X.subID=''' + trim(FSubId) + ''' ');
|
|||
|
sql.add('and X.MJStr4=' + quotedstr(trim(MJstr4.text)));
|
|||
|
Open;
|
|||
|
MJXH.Text := Trim(fieldbyname('maxRoll').AsString);
|
|||
|
end;
|
|||
|
end
|
|||
|
else if fRollType = '<27><EFBFBD><DEB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
|
|||
|
begin
|
|||
|
|
|||
|
end
|
|||
|
else if fRollType = '<27><>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
|
|||
|
begin
|
|||
|
with ADOCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select maxRoll=1+isnull(cast(max(mjxh) as int),(cast(''' + inttostr(FFirstJ) + ''' as int) - 1)) ');
|
|||
|
sql.Add('from WFB_MJJY_DJB X where X.subID=''' + trim(FSubId) + ''' ');
|
|||
|
// sql.add('and X.MJStr4=' + quotedstr(trim(MJstr4.text)));
|
|||
|
sql.add('and mjxh>=cast(''' + inttostr(FFirstJ) + ''' as int) ');
|
|||
|
sql.add('and mjxh<=cast(''' + inttostr(FLastJ) + ''' as int) ');
|
|||
|
Open;
|
|||
|
MJXH.Text := Trim(fieldbyname('maxRoll').AsString);
|
|||
|
if strtoint(mjxh.Text) > flastj then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27><><EFBFBD>ų<EFBFBD><C5B3><EFBFBD><EFBFBD><EFBFBD>Χ<EFBFBD><CEA7>', '<27><>ʾ', 0);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
with ADOCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select maxRoll=1+isnull(cast(max(mjxh) as int),0) ');
|
|||
|
sql.Add('from WFB_MJJY_DJB X where X.subID=''' + trim(FSubId) + ''' ');
|
|||
|
Open;
|
|||
|
MJXH.Text := Trim(fieldbyname('maxRoll').AsString);
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDJBJYInput.ToolButton3Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_MJID.IsEmpty then
|
|||
|
exit;
|
|||
|
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
|||
|
Exit;
|
|||
|
|
|||
|
with ADOCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('delete WFB_MJJY_DJB where MJID=''' + trim(CDS_MJID.fieldbyName('MJID').AsString) + ''' ');
|
|||
|
execsql;
|
|||
|
end;
|
|||
|
InitCDGridID();
|
|||
|
InitDDSL();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDJBJYInput.MJLenKeyPress(Sender: TObject; var Key: Char);
|
|||
|
begin
|
|||
|
if Key = #13 then
|
|||
|
begin
|
|||
|
BTPrint.Click;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDJBJYInput.Tv3CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
|||
|
begin
|
|||
|
if CDS_MJID.IsEmpty then
|
|||
|
exit;
|
|||
|
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
|||
|
Exit;
|
|||
|
|
|||
|
with ADOCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('delete WFB_MJJY_DJB where MJID=''' + trim(CDS_MJID.fieldbyName('MJID').AsString) + ''' ');
|
|||
|
execsql;
|
|||
|
end;
|
|||
|
InitCDGridID();
|
|||
|
InitDDSL();
|
|||
|
end;
|
|||
|
|
|||
|
end.
|
|||
|
|