2648 lines
70 KiB
ObjectPascal
2648 lines
70 KiB
ObjectPascal
unit U_MJJYTH;
|
||
|
||
interface
|
||
|
||
uses
|
||
Windows, Messages, SysUtils, strutils, 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
|
||
TfrmMJJYTH = class(TForm)
|
||
cxStyleRepository1: TcxStyleRepository;
|
||
cxStyle1: TcxStyle;
|
||
cxStyle2: TcxStyle;
|
||
cxGridPopupMenu1: TcxGridPopupMenu;
|
||
DataSource1: TDataSource;
|
||
Order_MJ: TClientDataSet;
|
||
ADOQueryMain: TADOQuery;
|
||
ADOCmd: 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;
|
||
RM3: TRMGridReport;
|
||
ADOTmp: TADOQuery;
|
||
Panel6: TPanel;
|
||
Label16: TLabel;
|
||
Label35: TLabel;
|
||
Label24: TLabel;
|
||
Label25: TLabel;
|
||
Label3: TLabel;
|
||
BTAdd: TButton;
|
||
BTEdit: TButton;
|
||
Edit7: TEdit;
|
||
SMRK: TEdit;
|
||
Label2: TLabel;
|
||
Panel2: TPanel;
|
||
SpeedButton13: TSpeedButton;
|
||
SpeedButton14: TSpeedButton;
|
||
SpeedButton15: TSpeedButton;
|
||
PageControl1: TPageControl;
|
||
TabSheet1: TTabSheet;
|
||
Panel7: TPanel;
|
||
Label5: TLabel;
|
||
Label37: TLabel;
|
||
MJLen: TEdit;
|
||
BTPrint: TButton;
|
||
GangNo: TEdit;
|
||
Button5: TButton;
|
||
Panel3: TPanel;
|
||
SpeedButton1: TSpeedButton;
|
||
SpeedButton2: TSpeedButton;
|
||
SpeedButton3: TSpeedButton;
|
||
SpeedButton4: TSpeedButton;
|
||
SpeedButton5: TSpeedButton;
|
||
SpeedButton6: TSpeedButton;
|
||
SpeedButton7: TSpeedButton;
|
||
SpeedButton8: TSpeedButton;
|
||
SpeedButton9: TSpeedButton;
|
||
SpeedButton10: TSpeedButton;
|
||
SpeedButton11: TSpeedButton;
|
||
SpeedButton12: TSpeedButton;
|
||
TabSheet2: TTabSheet;
|
||
TabSheet3: TTabSheet;
|
||
cxGrid3: TcxGrid;
|
||
Tv3: TcxGridDBTableView;
|
||
cxGangNo: TcxGridDBColumn;
|
||
v3JYNo: TcxGridDBColumn;
|
||
v3JYLen: TcxGridDBColumn;
|
||
cxGridLevel2: TcxGridLevel;
|
||
ComboBox1: TComboBox;
|
||
Panel1: TPanel;
|
||
Label9: TLabel;
|
||
Label6: TLabel;
|
||
Label7: TLabel;
|
||
Label11: TLabel;
|
||
Label15: TLabel;
|
||
Label30: TLabel;
|
||
Label31: TLabel;
|
||
Label32: TLabel;
|
||
Label33: TLabel;
|
||
JYLen: TEdit;
|
||
JYKG: TEdit;
|
||
JYPZ: TEdit;
|
||
JYJZ: TEdit;
|
||
Panel4: TPanel;
|
||
SpeedButton16: TSpeedButton;
|
||
SpeedButton17: TSpeedButton;
|
||
SpeedButton18: TSpeedButton;
|
||
SpeedButton19: TSpeedButton;
|
||
SpeedButton20: TSpeedButton;
|
||
SpeedButton21: TSpeedButton;
|
||
SpeedButton22: TSpeedButton;
|
||
SpeedButton23: TSpeedButton;
|
||
SpeedButton24: TSpeedButton;
|
||
SpeedButton25: TSpeedButton;
|
||
SpeedButton26: TSpeedButton;
|
||
SpeedButton27: TSpeedButton;
|
||
cxGrid1: TcxGrid;
|
||
TV2: TcxGridDBTableView;
|
||
vJYNo: TcxGridDBColumn;
|
||
cxGridDBJYLen: TcxGridDBColumn;
|
||
v3JYKG: TcxGridDBColumn;
|
||
v3JYJZ: TcxGridDBColumn;
|
||
cxGridLevel1: TcxGridLevel;
|
||
Panel8: TPanel;
|
||
SpeedButton29: TSpeedButton;
|
||
SpeedButton30: TSpeedButton;
|
||
SpeedButton31: TSpeedButton;
|
||
SpeedButton32: TSpeedButton;
|
||
SpeedButton33: TSpeedButton;
|
||
SpeedButton34: TSpeedButton;
|
||
cxGrid2: TcxGrid;
|
||
TV1: TcxGridDBTableView;
|
||
cxGridDBGangNo: TcxGridDBColumn;
|
||
cxGridDBSJZQty: TcxGridDBColumn;
|
||
cxGridDBMQQty: TcxGridDBColumn;
|
||
cxGridDBCQty: TcxGridDBColumn;
|
||
cxGridLevel3: TcxGridLevel;
|
||
Button1: TButton;
|
||
Button2: TButton;
|
||
ComboBox2: TComboBox;
|
||
ADOQuery1: TADOQuery;
|
||
Button3: TButton;
|
||
DataSource4: TDataSource;
|
||
DataSource5: TDataSource;
|
||
JY_CP: TClientDataSet;
|
||
JY_HZ: TClientDataSet;
|
||
Edit1: TEdit;
|
||
Panel5: TPanel;
|
||
SpeedButton28: TSpeedButton;
|
||
SpeedButton35: TSpeedButton;
|
||
SpeedButton36: TSpeedButton;
|
||
SpeedButton37: TSpeedButton;
|
||
SpeedButton38: TSpeedButton;
|
||
SpeedButton39: TSpeedButton;
|
||
cxGrid4: TcxGrid;
|
||
TV4: TcxGridDBTableView;
|
||
cxGridDBColumn1: TcxGridDBColumn;
|
||
cSJZQty: TcxGridDBColumn;
|
||
cxGridLevel4: TcxGridLevel;
|
||
DataSource6: TDataSource;
|
||
DB_HZ: TClientDataSet;
|
||
Panel9: TPanel;
|
||
Label8: TLabel;
|
||
ComboBox3: TComboBox;
|
||
Label10: TLabel;
|
||
Label12: TLabel;
|
||
Edit2: TEdit;
|
||
Label13: TLabel;
|
||
Label14: TLabel;
|
||
Label17: TLabel;
|
||
XS: TEdit;
|
||
Edit16: TEdit;
|
||
Label47: TLabel;
|
||
ComboBox4: TComboBox;
|
||
Button4: TButton;
|
||
Button6: TButton;
|
||
ScrollBox1: TScrollBox;
|
||
btn1: TSpeedButton;
|
||
btn2: TSpeedButton;
|
||
btn3: TSpeedButton;
|
||
btn4: TSpeedButton;
|
||
SpeedButton40: TSpeedButton;
|
||
SpeedButton41: TSpeedButton;
|
||
SpeedButton42: TSpeedButton;
|
||
SpeedButton43: TSpeedButton;
|
||
SpeedButton44: TSpeedButton;
|
||
SpeedButton45: TSpeedButton;
|
||
SpeedButton46: TSpeedButton;
|
||
SpeedButton47: TSpeedButton;
|
||
SpeedButton48: TSpeedButton;
|
||
SpeedButton49: TSpeedButton;
|
||
SpeedButton50: TSpeedButton;
|
||
SpeedButton51: TSpeedButton;
|
||
SpeedButton52: TSpeedButton;
|
||
SpeedButton53: TSpeedButton;
|
||
SpeedButton54: TSpeedButton;
|
||
SpeedButton55: TSpeedButton;
|
||
SpeedButton56: TSpeedButton;
|
||
SpeedButton57: TSpeedButton;
|
||
SpeedButton58: TSpeedButton;
|
||
SpeedButton59: TSpeedButton;
|
||
SpeedButton60: TSpeedButton;
|
||
SpeedButton61: TSpeedButton;
|
||
SpeedButton62: TSpeedButton;
|
||
SpeedButton63: TSpeedButton;
|
||
SpeedButton64: TSpeedButton;
|
||
SpeedButton65: TSpeedButton;
|
||
SpeedButton66: TSpeedButton;
|
||
SpeedButton67: TSpeedButton;
|
||
SpeedButton68: TSpeedButton;
|
||
SpeedButton69: TSpeedButton;
|
||
SpeedButton70: TSpeedButton;
|
||
Button7: TButton;
|
||
Button8: TButton;
|
||
Label18: TLabel;
|
||
Label1: TLabel;
|
||
SpeedButton71: TSpeedButton;
|
||
SpeedButton72: TSpeedButton;
|
||
SpeedButton73: TSpeedButton;
|
||
SpeedButton74: TSpeedButton;
|
||
SpeedButton75: TSpeedButton;
|
||
SpeedButton76: TSpeedButton;
|
||
Label4: TLabel;
|
||
SpeedButton77: TSpeedButton;
|
||
SpeedButton78: TSpeedButton;
|
||
SpeedButton79: TSpeedButton;
|
||
SpeedButton80: TSpeedButton;
|
||
SpeedButton81: TSpeedButton;
|
||
SpeedButton82: TSpeedButton;
|
||
Panel10: TPanel;
|
||
SpeedButton83: TSpeedButton;
|
||
SpeedButton84: TSpeedButton;
|
||
SpeedButton85: TSpeedButton;
|
||
SpeedButton86: TSpeedButton;
|
||
SpeedButton87: TSpeedButton;
|
||
SpeedButton88: TSpeedButton;
|
||
SpeedButton89: TSpeedButton;
|
||
SpeedButton90: TSpeedButton;
|
||
SpeedButton91: TSpeedButton;
|
||
SpeedButton92: TSpeedButton;
|
||
SpeedButton93: TSpeedButton;
|
||
SpeedButton94: TSpeedButton;
|
||
SpeedButton95: TSpeedButton;
|
||
SpeedButton96: TSpeedButton;
|
||
SpeedButton97: TSpeedButton;
|
||
SpeedButton98: TSpeedButton;
|
||
SpeedButton99: TSpeedButton;
|
||
SpeedButton100: TSpeedButton;
|
||
SpeedButton101: TSpeedButton;
|
||
SpeedButton102: TSpeedButton;
|
||
SpeedButton103: TSpeedButton;
|
||
SpeedButton104: TSpeedButton;
|
||
SpeedButton105: TSpeedButton;
|
||
SpeedButton106: TSpeedButton;
|
||
SpeedButton107: TSpeedButton;
|
||
SpeedButton108: TSpeedButton;
|
||
SpeedButton109: TSpeedButton;
|
||
SpeedButton110: TSpeedButton;
|
||
SpeedButton111: TSpeedButton;
|
||
SpeedButton112: TSpeedButton;
|
||
SpeedButton113: TSpeedButton;
|
||
SpeedButton114: TSpeedButton;
|
||
SpeedButton115: TSpeedButton;
|
||
SpeedButton116: TSpeedButton;
|
||
SpeedButton117: TSpeedButton;
|
||
SpeedButton118: TSpeedButton;
|
||
SpeedButton119: TSpeedButton;
|
||
SpeedButton120: TSpeedButton;
|
||
SpeedButton121: TSpeedButton;
|
||
SpeedButton122: TSpeedButton;
|
||
SpeedButton123: TSpeedButton;
|
||
SpeedButton124: TSpeedButton;
|
||
SpeedButton125: TSpeedButton;
|
||
SpeedButton126: TSpeedButton;
|
||
SpeedButton127: TSpeedButton;
|
||
SpeedButton128: TSpeedButton;
|
||
SpeedButton129: TSpeedButton;
|
||
SpeedButton130: TSpeedButton;
|
||
SpeedButton131: TSpeedButton;
|
||
SpeedButton132: TSpeedButton;
|
||
SpeedButton133: TSpeedButton;
|
||
SpeedButton134: TSpeedButton;
|
||
SpeedButton135: TSpeedButton;
|
||
SpeedButton136: TSpeedButton;
|
||
SpeedButton137: TSpeedButton;
|
||
SpeedButton138: TSpeedButton;
|
||
SpeedButton139: TSpeedButton;
|
||
SpeedButton140: TSpeedButton;
|
||
SpeedButton141: TSpeedButton;
|
||
SpeedButton142: TSpeedButton;
|
||
SpeedButton143: TSpeedButton;
|
||
SpeedButton144: TSpeedButton;
|
||
SpeedButton145: TSpeedButton;
|
||
SpeedButton146: TSpeedButton;
|
||
Button9: TButton;
|
||
Button10: TButton;
|
||
SpeedButton147: TSpeedButton;
|
||
Label19: TLabel;
|
||
SpeedButton148: TSpeedButton;
|
||
ClientDataSet1: TClientDataSet;
|
||
CPFlag: TEdit;
|
||
Label20: TLabel;
|
||
procedure FormDestroy(Sender: TObject);
|
||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||
procedure FormShow(Sender: TObject);
|
||
procedure FormClick(Sender: TObject);
|
||
procedure BTPrintClick(Sender: TObject);
|
||
procedure SpeedButton1Click(Sender: TObject);
|
||
procedure SpeedButton12Click(Sender: TObject);
|
||
procedure SpeedButton13Click(Sender: TObject);
|
||
procedure cxGridDBColumn2PropertiesChange(Sender: TObject);
|
||
procedure Button5Click(Sender: TObject);
|
||
procedure SMRKKeyPress(Sender: TObject; var Key: Char);
|
||
procedure MJstr3KeyPress(Sender: TObject; var Key: Char);
|
||
procedure Label9Click(Sender: TObject);
|
||
procedure JYJZExit(Sender: TObject);
|
||
procedure JYJZChange(Sender: TObject);
|
||
procedure JYKGChange(Sender: TObject);
|
||
procedure Edit7Click(Sender: TObject);
|
||
procedure JYJZKeyPress(Sender: TObject; var Key: Char);
|
||
procedure FormCreate(Sender: TObject);
|
||
procedure SpeedButton14Click(Sender: TObject);
|
||
procedure SpeedButton15Click(Sender: TObject);
|
||
procedure PageControl1Change(Sender: TObject);
|
||
procedure Button3Click(Sender: TObject);
|
||
procedure GangNoClick(Sender: TObject);
|
||
procedure SpeedButton29Click(Sender: TObject);
|
||
procedure JYLenClick(Sender: TObject);
|
||
procedure Button1Click(Sender: TObject);
|
||
procedure Button2Click(Sender: TObject);
|
||
procedure TV2CellClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
||
procedure SpeedButton28Click(Sender: TObject);
|
||
procedure Edit2Click(Sender: TObject);
|
||
procedure JYLenChange(Sender: TObject);
|
||
procedure Edit16Click(Sender: TObject);
|
||
procedure TV4CellClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
||
procedure Button4Click(Sender: TObject);
|
||
procedure Button6Click(Sender: TObject);
|
||
procedure btn1Click(Sender: TObject);
|
||
procedure Button8Click(Sender: TObject);
|
||
procedure Button7Click(Sender: TObject);
|
||
procedure Button9Click(Sender: TObject);
|
||
procedure SpeedButton83Click(Sender: TObject);
|
||
procedure SpeedButton148Click(Sender: TObject);
|
||
procedure CPFlagClick(Sender: TObject);
|
||
private
|
||
{ Private declarations }
|
||
FMainId, FSubId, FInt, FZHID, MD,FGuiZe: string;
|
||
FOrdQty: Double;
|
||
isCommopen, isCommopenDZC, IsJsMessage, IsCzMessage: boolean;
|
||
procedure InitCDGridID();
|
||
procedure InitSub(MSubID: string);
|
||
function SaveData(): Boolean;
|
||
procedure PrtData(FMJID: string);
|
||
procedure PrtDataMD(FMJID: string);
|
||
procedure PrtDataJY(FMJID: string);
|
||
function SaveDataMD(): Boolean;
|
||
procedure OpenCom(DllName: string);
|
||
procedure OpenComDZC(DllName: string);
|
||
procedure CloseCom(DllName: string);
|
||
function CLnum(fMjlen: string): double;
|
||
procedure On1201(var Message: Tmessage); message 1201;
|
||
procedure On1301(var Message: Tmessage); message 1301;
|
||
procedure SSetEditDataADONew(yClientDataset: TADOQuery; mClientDataset: TADOQuery);
|
||
procedure InitPerson();
|
||
function YFData(FFJYID: string): Boolean;
|
||
public
|
||
fmanage: string;
|
||
{ Public declarations }
|
||
|
||
end;
|
||
|
||
var
|
||
frmMJJYTH: TfrmMJJYTH;
|
||
newh, newh1: hwnd;
|
||
|
||
implementation
|
||
|
||
uses
|
||
U_DataLink, U_Fun, U_ZDYHelp, U_iniParam, U_SCColor;
|
||
|
||
{$R *.dfm}
|
||
procedure TfrmMJJYTH.InitSub(MSubID: string);
|
||
begin
|
||
with ADOQuery1 do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.add('select A.*,B.* ');
|
||
sql.Add('from ML_OrderMainNew A ');
|
||
sql.Add('inner join ML_OrderSubidNew B on B.NewMLID=A.NewMLID ');
|
||
sql.Add('where B.NewSubid=''' + trim(MSubID) + '''');
|
||
Open;
|
||
end;
|
||
if ADOQuery1.IsEmpty then
|
||
begin
|
||
SMRK.Text := '';
|
||
Application.MessageBox('û<>и<EFBFBD><D0B8><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ');
|
||
exit;
|
||
end;
|
||
FMainId := Trim(ADOQuery1.fieldbyname('NewMLID').AsString);
|
||
FSubId := Trim(ADOQuery1.fieldbyname('NewSubid').AsString);
|
||
FGuiZe:= Trim(ADOQuery1.fieldbyname('CPBQGuiZe').AsString);
|
||
FOrdQty := ADOQuery1.fieldbyname('Qty').AsFloat;
|
||
Label24.Caption := Trim(ADOQuery1.fieldbyname('MLOrderNo').AsString);
|
||
Label25.Caption := Trim(ADOQuery1.fieldbyname('MLColor').AsString);
|
||
Label18.Caption := Trim(ADOQuery1.fieldbyname('MLColorNo').AsString);
|
||
Label3.Caption := Trim(ADOQuery1.fieldbyname('MLHX').AsString);
|
||
Label9.Caption := Trim(ADOQuery1.fieldbyname('QtyUnit').AsString);
|
||
Label13.Caption := Trim(ADOQuery1.fieldbyname('Qty').AsString) + Trim(ADOQuery1.fieldbyname('QtyUnit').AsString);
|
||
JYPZ.Text := Trim(ADOQuery1.fieldbyname('PiZhong').AsString);
|
||
XS.Text := Trim(ADOQuery1.fieldbyname('XS').AsString);
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from JTJY_New where NewSubid=''' + Trim(FSubId) + '''');
|
||
open;
|
||
end;
|
||
SCreateCDS20(ADOCmd, Order_MJ);
|
||
SInitCDSData20(ADOCmd, Order_MJ);
|
||
Panel2.Visible := True;
|
||
SMRK.Text := '';
|
||
end;
|
||
|
||
procedure TfrmMJJYTH.SSetEditDataADONew(yClientDataset: TADOQuery; mClientDataset: TADOQuery);
|
||
var
|
||
i: integer;
|
||
k: integer;
|
||
mfieldName: string;
|
||
begin
|
||
if yClientDataset.IsEmpty then
|
||
exit;
|
||
k := 1;
|
||
try
|
||
mClientDataset.DisableControls;
|
||
mClientDataset.Filtered := false;
|
||
with mClientDataset do
|
||
begin
|
||
Append;
|
||
for i := 0 to yClientDataset.FieldCount - 1 do
|
||
begin
|
||
mfieldName := trim(yClientDataset.fields[i].FieldName);
|
||
fieldbyname(mfieldName).Value := yClientDataset.Fields[i].Value;
|
||
end;
|
||
post;
|
||
inc(k);
|
||
end;
|
||
if not mClientDataset.IsEmpty then
|
||
begin
|
||
mClientDataset.First;
|
||
end;
|
||
finally
|
||
mClientDataset.First;
|
||
mClientDataset.EnableControls;
|
||
end;
|
||
end;
|
||
|
||
function TfrmMJJYTH.CLnum(fMjlen: string): double;
|
||
var
|
||
i, m: integer;
|
||
num1: double;
|
||
begin
|
||
i := strtoint(rightstr(fMjlen, 1));
|
||
m := strtoint(leftstr(fMjlen, length(fMjlen) - 2));
|
||
if (i >= 3) and (i < 8) then
|
||
num1 := strtofloat(inttostr(m) + '.5')
|
||
else if i >= 8 then
|
||
num1 := m + 1
|
||
else
|
||
num1 := m;
|
||
result := num1;
|
||
end;
|
||
|
||
procedure TfrmMJJYTH.CloseCom(DllName: string);
|
||
type
|
||
TMyFunc = function(sCommName: PAnsiChar): HWND; stdcall;
|
||
var
|
||
Tf1: TMyFunc;
|
||
Tp1: TFarProc;
|
||
Th1: Thandle;
|
||
begin
|
||
Th1 := LoadLibrary(Pchar(trim(DllName)));
|
||
if Th1 > 0 then
|
||
begin
|
||
try
|
||
Tp1 := GetProcAddress(Th1, 'CommClose');
|
||
if Tp1 <> nil then
|
||
begin
|
||
Tf1 := TMyFunc(Tp1);
|
||
newh1 := Tf1('Comm1');
|
||
end
|
||
else
|
||
begin
|
||
|
||
end;
|
||
finally
|
||
// FreeLibrary(Th1);
|
||
end;
|
||
end
|
||
else
|
||
begin
|
||
application.MessageBox(Pchar('<27>Ҳ<EFBFBD><D2B2><EFBFBD> ' + trim(DllName) + ' <20>ļ<EFBFBD><C4BC><EFBFBD>'), '<27><>ʾ');
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmMJJYTH.OpenCom(DllName: string);
|
||
type
|
||
TMyFunc = function(fhandle: hwnd; sCommName: PAnsiChar; IntTime: integer; IsMessage: integer): HWND; stdcall;
|
||
var
|
||
Tf: TMyFunc;
|
||
Tp: TFarProc;
|
||
Th: Thandle;
|
||
begin
|
||
Th := LoadLibrary(Pchar(trim(DllName)));
|
||
if Th > 0 then
|
||
begin
|
||
try
|
||
Tp := GetProcAddress(Th, 'CommOpen');
|
||
if Tp <> nil then
|
||
begin
|
||
Tf := TMyFunc(Tp);
|
||
newh := Tf(self.Handle, 'Comm1', 500, 1);
|
||
if newh < 1 then
|
||
begin
|
||
application.MessageBox(Pchar('<27><EFBFBD><F2BFAAB4><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>'), '<27><>ʾ');
|
||
end
|
||
else
|
||
IsCommOpen := true;
|
||
end
|
||
else
|
||
begin
|
||
IsCommOpen := false;
|
||
end;
|
||
finally
|
||
// FreeLibrary(Th);
|
||
end;
|
||
end
|
||
else
|
||
begin
|
||
IsCommOpen := false;
|
||
application.MessageBox(Pchar('<27>Ҳ<EFBFBD><D2B2><EFBFBD> ' + trim(DllName) + ' <20>ļ<EFBFBD><C4BC><EFBFBD>'), '<27><>ʾ');
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmMJJYTH.OpenComDZC(DllName: string);
|
||
type
|
||
TMyFunc = function(fhandle: hwnd; sCommName: PAnsiChar; IntTime: integer; IsMessage: integer): HWND; stdcall;
|
||
var
|
||
Tf: TMyFunc;
|
||
Tp: TFarProc;
|
||
Th: Thandle;
|
||
begin
|
||
Th := LoadLibrary(Pchar(trim(DllName)));
|
||
if Th > 0 then
|
||
begin
|
||
try
|
||
Tp := GetProcAddress(Th, 'CommOpen');
|
||
if Tp <> nil then
|
||
begin
|
||
Tf := TMyFunc(Tp);
|
||
newh := Tf(self.Handle, 'Comm1', 500, 1);
|
||
if newh < 1 then
|
||
begin
|
||
application.MessageBox(Pchar('<27><EFBFBD><F2BFAAB4><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>'), '<27><>ʾ');
|
||
end
|
||
else
|
||
isCommopenDZC := true;
|
||
end
|
||
else
|
||
begin
|
||
isCommopenDZC := false;
|
||
end;
|
||
finally
|
||
// FreeLibrary(Th);
|
||
end;
|
||
end
|
||
else
|
||
begin
|
||
isCommopenDZC := false;
|
||
application.MessageBox(Pchar('<27>Ҳ<EFBFBD><D2B2><EFBFBD> ' + trim(DllName) + ' <20>ļ<EFBFBD><C4BC><EFBFBD>'), '<27><>ʾ');
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmMJJYTH.FormDestroy(Sender: TObject);
|
||
begin
|
||
frmMJJYTH := nil;
|
||
end;
|
||
|
||
procedure TfrmMJJYTH.On1201(var Message: Tmessage);
|
||
var
|
||
i1, i2: integer;
|
||
unitname: string;
|
||
fdata: double;
|
||
begin
|
||
i1 := Message.WParam;
|
||
i2 := Message.LParam;
|
||
if IsCzMessage then
|
||
begin
|
||
if trim(Edit2.Text) = '<27><>' then
|
||
begin
|
||
JYJZ.Text := format('%.1f', [i1 / 100000]);
|
||
end;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmMJJYTH.On1301(var Message: Tmessage);
|
||
var
|
||
i1, i2: integer;
|
||
unitname: string;
|
||
fdata: double;
|
||
begin
|
||
i1 := Message.WParam;
|
||
i2 := Message.LParam;
|
||
if IsJsMessage then
|
||
begin
|
||
if trim(Edit7.Text) = '<27><>' then
|
||
begin
|
||
if PageControl1.TabIndex = 0 then
|
||
begin
|
||
MJLen.Text := floattostr(CLnum(format('%.1f', [i1 / 100000])));
|
||
if i2 = 0 then
|
||
Label9.Caption := 'M'
|
||
else
|
||
Label9.Caption := 'Y';
|
||
end;
|
||
if PageControl1.TabIndex = 2 then
|
||
begin
|
||
JYLen.Text := floattostr(CLnum(format('%.1f', [i1 / 100000])));
|
||
if i2 = 0 then
|
||
Label9.Caption := 'M'
|
||
else
|
||
Label9.Caption := 'Y';
|
||
|
||
end;
|
||
end;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmMJJYTH.FormClose(Sender: TObject; var Action: TCloseAction);
|
||
begin
|
||
if isCommopen then
|
||
begin
|
||
closeCom(JCYDLL);
|
||
end;
|
||
Action := caFree;
|
||
end;
|
||
|
||
procedure TfrmMJJYTH.InitCDGridID();
|
||
begin
|
||
with ADOQueryMain do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select A.*');
|
||
sql.Add(' from JTJY_New A where NewSubid=''' + Trim(FSubid) + '''');
|
||
sql.Add(' and JTType=''' + Trim(label2.Caption) + '''');
|
||
sql.Add(' and Filler=''' + Trim(DName) + '''');
|
||
sql.Add(' and RKType=''δ<><CEB4><EFBFBD><EFBFBD>'' ');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryMain, CDS_MJID);
|
||
SInitCDSData20(ADOQueryMain, CDS_MJID);
|
||
end;
|
||
|
||
procedure TfrmMJJYTH.FormShow(Sender: TObject);
|
||
begin
|
||
ReadINIFile();
|
||
if trim(Edit7.Text) = '<27><>' then
|
||
IsJsMessage := true;
|
||
if Trim(Edit2.Text) = '<27><>' then
|
||
IsCzMessage := True;
|
||
//IF trim(fmanage)<>'<27><>Ȩ<EFBFBD><C8A8>' then
|
||
begin
|
||
OpenCom(JCYDLL);
|
||
OpenComDZC(DllName);
|
||
end;
|
||
SMRK.SetFocus;
|
||
end;
|
||
|
||
procedure TfrmMJJYTH.InitPerson();
|
||
var
|
||
BB: array[0..100] of string;
|
||
CC: array[0..100] of string;
|
||
i, j: Integer;
|
||
begin
|
||
if Copy(Trim(SMRK.Text), 1, 2) = 'ML' then
|
||
begin
|
||
with ADOTmp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select MLColor,MLColorNo,NewSubid from ML_OrderSubidNew where NewMLID=''' + Trim(SMRK.Text) + ''' '); //order by ZDYName
|
||
Open;
|
||
end;
|
||
if ADOTmp.IsEmpty then
|
||
begin
|
||
Application.MessageBox('<27><>ά<EFBFBD><CEAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
end
|
||
else
|
||
begin
|
||
with ADOTmp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select A.MLColor,A.MLColorNo,A.NewSubid from ML_OrderSubidNew A ');
|
||
sql.Add(' inner join JTJY_New B on A.NewSubid=B.NewSubid');
|
||
sql.Add(' where B.JYID=''' + Trim(SMRK.Text) + ''' ');
|
||
Open;
|
||
end;
|
||
if ADOTmp.IsEmpty then
|
||
begin
|
||
Application.MessageBox('<27><>ά<EFBFBD><CEAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
end;
|
||
|
||
with ADOTmp do
|
||
begin
|
||
First;
|
||
i := 0;
|
||
while not Eof do
|
||
begin
|
||
BB[i] := Trim(fieldbyname('MLColorNo').AsString) + #13 + Trim(fieldbyname('MLColor').AsString);
|
||
CC[i] := Trim(fieldbyname('NewSubid').AsString);
|
||
i := i + 1;
|
||
Next;
|
||
end;
|
||
end;
|
||
i := i - 1;
|
||
if i > 35 then
|
||
begin
|
||
i := 35;
|
||
end;
|
||
for j := 0 to i do
|
||
begin
|
||
with ScrollBox1 do
|
||
begin
|
||
TSpeedButton(Controls[j]).Visible := True;
|
||
TSpeedButton(Controls[j]).Caption := BB[j];
|
||
TSpeedButton(Controls[j]).Hint := CC[j];
|
||
end;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmMJJYTH.FormClick(Sender: TObject);
|
||
begin
|
||
FInt := '0';
|
||
end;
|
||
|
||
function TfrmMJJYTH.SaveData(): Boolean;
|
||
var
|
||
maxno, FJYID, BZID, strsql: string;
|
||
FMJLen: Double;
|
||
FOrder, FWZ: Integer;
|
||
begin
|
||
if FInt = '1' then
|
||
begin
|
||
FJYID := '';
|
||
end;
|
||
if FInt = '2' then
|
||
begin
|
||
FJYID := Trim(JY_CP.fieldbyname('JYID').AsString);
|
||
end;
|
||
try
|
||
ADOCmd.Connection.BeginTrans;
|
||
///<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('select * from JTJY_New where JYID=''' + Trim(FJYID) + '''');
|
||
Open;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
if IsEmpty then
|
||
begin
|
||
Append;
|
||
if GetLSNo(ADOTmp, maxno, Trim(MD), 'JTJY_New', 4, 1) = False then
|
||
begin
|
||
ADOCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE><EFBFBD>쳣<EFBFBD><ECB3A3>', '<27><>ʾ', 0);
|
||
Button1.Enabled := true;
|
||
Button2.Enabled := true;
|
||
exit;
|
||
end;
|
||
FieldByName('Filler').Value := Trim(DName);
|
||
end
|
||
else
|
||
begin
|
||
maxno := Trim(FJYID);
|
||
Edit;
|
||
FieldByName('Editer').Value := Trim(DName);
|
||
FieldByName('EditTime').Value := SGetServerDateTime(ADOTmp);
|
||
end;
|
||
FieldByName('NewMLID').value := Trim(FMainId);
|
||
FieldByName('NewSubid').value := Trim(FSubId);
|
||
FieldByName('JYID').Value := Trim(maxno);
|
||
FieldByName('RKType').Value := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
||
FieldByName('gangNo').Value := Trim(edit1.Text);
|
||
FieldByName('JYLen').Value := Trim(JYLen.Text);
|
||
FieldByName('JYKG').Value := StrToFloatDef(JYKG.Text, 0);
|
||
FieldByName('JYPZ').Value := StrToFloatDef(JYPZ.Text, 0);
|
||
FieldByName('JYJZ').Value := StrToFloatDef(JYJZ.Text, 0);
|
||
FieldByName('XS').Value := StrToFloatDef(XS.Text, 0);
|
||
FieldByName('JYType').Value := Trim(Label2.Caption);
|
||
FieldByName('JYOrderNo').Value := Trim(label24.Caption);
|
||
FieldByName('JYColHX').Value := Trim(label3.Caption);
|
||
FieldByName('JYColor').Value := Trim(label25.Caption);
|
||
FieldByName('JYUnit').Value := Trim(Label9.Caption);
|
||
Post;
|
||
end;
|
||
if FInt = '1' then
|
||
begin
|
||
if Trim(FGuiZe)='<27><><EFBFBD><EFBFBD>1' then
|
||
begin
|
||
if Trim(Label2.Caption)='<27><>Ʒ' then
|
||
begin
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('update JTJY_New SET JYNo=1+isnull((select cast(max(X.JYNo) as int) from JTJY_New X ');
|
||
sql.Add('where X.NewSubid=JTJY_New.NewSubid and X.JYID<>JTJY_New.JYID and X.JYType=''<27><>Ʒ''),0) ');
|
||
sql.Add('where JYID=''' + Trim(maxno) + '''');
|
||
execsql;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add(' exec P_Update_JYID :JYID');
|
||
Parameters.ParamByName('JYID').Value:=Trim(maxno);
|
||
ExecSQL;
|
||
end;
|
||
end;
|
||
end else
|
||
begin
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('update JTJY_New SET JYNo=1+isnull((select cast(max(X.JYNo) as int) from JTJY_New X ');
|
||
sql.Add('where X.NewSubid=JTJY_New.NewSubid and X.JYType=JTJY_New.JYType ');
|
||
SQL.Add('and X.GangNo=JTJY_New.GangNo and X.JYID<>JTJY_New.JYID),0) ');
|
||
sql.Add('where JYID=''' + Trim(maxno) + '''');
|
||
execsql;
|
||
end;
|
||
end;
|
||
|
||
if JY_CP.IsEmpty then
|
||
begin
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from JTJY_New where NewSubid=''' + trim(FSubId) + ''' and JYType=''' + trim(Label2.Caption) + '''');
|
||
SQL.Add(' and GangNo=''' + trim(edit1.Text) + '''');
|
||
open;
|
||
end;
|
||
SCreateCDS20(ADOCmd, JY_CP);
|
||
SInitCDSData20(ADOCmd, JY_CP);
|
||
end
|
||
else
|
||
begin
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from JTJY_New where JYID=''' + trim(maxno) + '''');
|
||
open;
|
||
end;
|
||
SInitCDSData20(ADOCmd, JY_CP);
|
||
end;
|
||
JY_CP.Locate('JYID', Trim(maxno), []);
|
||
end;
|
||
if FInt = '2' then
|
||
begin
|
||
with JY_CP do
|
||
begin
|
||
edit;
|
||
FieldByName('JYJZ').Value := Trim(JYJZ.Text);
|
||
FieldByName('JYKG').Value := Trim(JYKG.Text);
|
||
FieldByName('JYLen').Value := Trim(JYLen.Text);
|
||
end;
|
||
end;
|
||
FJYID := Trim(maxno);
|
||
//<2F><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('exec P_Do_MLJYCRK ''' + Trim(maxno) + '''');
|
||
execsql;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add(' exec P_Update_OrderSub :SubId');
|
||
Parameters.ParamByName('SubId').Value := Trim(FSubId);
|
||
ExecSQL;
|
||
end;
|
||
|
||
////////////////<2F><><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>////////////////////
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add(' select ZHID from ML_OrderZuHe where MLType=''<27><>'' and SSGS =''<27>Լ<EFBFBD>'' and NewMLID=''' + Trim(FMainId) + '''');
|
||
Open;
|
||
end;
|
||
if Trim(Label2.Caption) = '<27><>Ʒ' then
|
||
begin
|
||
if ADOCmd.IsEmpty = false then
|
||
begin
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add(' exec ZDCK_Mian :MainID,:SubId,:DName');
|
||
Parameters.ParamByName('MainID').Value := Trim(FMainId);
|
||
Parameters.ParamByName('SubID').Value := Trim(FSubId);
|
||
Parameters.ParamByName('DName').Value := Trim(DName);
|
||
ExecSQL;
|
||
end;
|
||
end;
|
||
end;
|
||
////////////////<2F><><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>////////////////////
|
||
with ADOCmd do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('select * ');
|
||
sql.Add('from ML_OrderSubidNew A where NewSubid=''' + Trim(FSubid) + ''' ');
|
||
sql.Add(' and isnull(JYQty,0)>(isnull(MBQty,0)*1.02)');
|
||
sql.Add(' and isnull(MBQty,0)>100 ');
|
||
open;
|
||
end;
|
||
if ADOCmd.IsEmpty = False then
|
||
begin
|
||
ADOCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϻ<EFBFBD><CFBB><EFBFBD>2%<25><><EFBFBD><EFBFBD><EFBFBD>ܴ<EFBFBD>ӡ!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
|
||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>&<26>IJ<DEB7><C4B2><EFBFBD><EFBFBD><EFBFBD>
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
//ʵ<><CAB5>
|
||
sql.Add('Update ML_OrderZuHe Set MLJYQty=(select sum(JYLen) from JTJY_New A where A.NewMLID=ML_OrderZuHe.NewMLID and A.JYType=''<27><>Ʒ'') ');
|
||
sql.Add(' where NewMLID=''' + Trim(FMainId) + '''');
|
||
sql.Add(' and isnull(MLName,'''')<>'''' and SSGS=''<27>Լ<EFBFBD>'' ');
|
||
|
||
ExecSQL;
|
||
end;
|
||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>&<26>IJ<DEB7><C4B2><EFBFBD><EFBFBD><EFBFBD>
|
||
if Label2.Caption = '<27>˻<EFBFBD>' then
|
||
begin
|
||
if YFData(FJYID) = False then
|
||
begin
|
||
ADOCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>˻<EFBFBD><CBBB><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
end;
|
||
ADOCmd.Connection.CommitTrans;
|
||
Result := True;
|
||
except
|
||
Result := False;
|
||
ADOCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
|
||
end;
|
||
end;
|
||
|
||
function TfrmMJJYTH.YFData(FFJYID: string): Boolean;
|
||
var
|
||
YFID, FFactoryName, FFactoryNo, FDate: string;
|
||
begin
|
||
Result := False;
|
||
with ADOTmp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select A.*,B.*,FDate=getdate() from ML_OrderSubidNew A');
|
||
sql.Add('inner join ML_OrderMainNew B on A.NewMLID=B.NewMLID');
|
||
sql.Add(' where NewSubid=''' + Trim(FSubId) + '''');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOTmp, ClientDataSet1);
|
||
SInitCDSData20(ADOTmp, ClientDataSet1);
|
||
if Trim(ClientDataSet1.fieldbyname('MLPrice').AsString) = '' then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD>ϵ<EFBFBD><CFB5>۲<EFBFBD><DBB2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD><D5A3><EFBFBD><EFBFBD><EFBFBD>ָʾ<D6B8><CABE><EFBFBD>в<EFBFBD><D0B2>䵥<EFBFBD><E4B5A5><EFBFBD><EFBFBD>Ϣ!', '<27><>ʾ', 0);
|
||
Result := False;
|
||
end;
|
||
FFactoryName := Trim(ClientDataSet1.fieldbyname('KHName').AsString);
|
||
FFactoryNo := Trim(ClientDataSet1.fieldbyname('KHNO').AsString);
|
||
FDate := Trim(FormatDateTime('yyyy-MM-dd', ClientDataSet1.fieldbyname('FDate').AsDateTime));
|
||
|
||
with ADOTmp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from YS_Money_CR where FactoryNo=' + quotedstr(Trim(FFactoryNo)));
|
||
sql.Add(' and SubId=''' + Trim(FSubId) + '''');
|
||
sql.Add(' and CRTime=''' + Trim(FDate) + '''');
|
||
Open;
|
||
end;
|
||
YFID := Trim(ADOTmp.fieldbyname('YFID').AsString);
|
||
if Trim(YFID) = '' then
|
||
begin
|
||
if GetLSNo(ADOCmd, YFID, 'YS', 'YS_Money_CR', 4, 1) = False then
|
||
begin
|
||
Application.MessageBox('ȡӦ<C8A1><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from YS_Money_CR where YFID=''' + Trim(YFID) + '''');
|
||
Open;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
Append;
|
||
FieldByName('YFID').Value := Trim(YFID);
|
||
FieldByName('CRID').Value := -99999;
|
||
FieldByName('Filler').Value := Trim(DName);
|
||
FieldByName('SubId').Value := Trim(FSubId);
|
||
FieldByName('CRType').Value := 'Ӧ<>տ<EFBFBD><D5BF>Ǽ<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 := StrToDate(FDate);
|
||
FieldByName('YFType').Value := '<27>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>';
|
||
FieldByName('Price').Value := ClientDataSet1.fieldbyname('MLPrice').Value;
|
||
FieldByName('HSPrice').Value := ClientDataSet1.fieldbyname('MLPrice').Value;
|
||
FieldByName('Note').Value := '<27>˻<EFBFBD>';
|
||
FieldByName('QtyUnit').Value := Trim(ClientDataSet1.fieldbyname('QtyUnit').AsString);
|
||
FieldByName('P_CodeName').Value := Trim(ClientDataSet1.fieldbyname('MLCodeName').AsString);
|
||
FieldByName('BZType').Value := Trim(ClientDataSet1.fieldbyname('BZType').AsString);
|
||
FieldByName('P_Color').Value := Trim(ClientDataSet1.fieldbyname('MLColor').AsString);
|
||
FieldByName('P_HX').Value := Trim(ClientDataSet1.fieldbyname('MLHX').AsString);
|
||
FieldByName('status').Value := '0';
|
||
Post;
|
||
end;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('Update JTJY_New Set YFID=''' + Trim(YFID) + '''');
|
||
sql.Add(' where JYID=''' + Trim(FFJYID) + '''');
|
||
ExecSQL;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add(' exec P_Update_THData :YFID');
|
||
Parameters.ParamByName('YFID').Value := Trim(YFID);
|
||
ExecSQL;
|
||
end;
|
||
Result := True;
|
||
end;
|
||
|
||
function TfrmMJJYTH.SaveDataMD(): Boolean;
|
||
var
|
||
maxno, FJYID, BZID, strsql: string;
|
||
FMJLen: Double;
|
||
FOrder, FWZ: Integer;
|
||
begin
|
||
if FInt = '1' then
|
||
begin
|
||
FJYID := '';
|
||
end;
|
||
if FInt = '2' then
|
||
begin
|
||
FJYID := Trim(Order_MJ.fieldbyname('JYID').AsString);
|
||
end;
|
||
try
|
||
ADOCmd.Connection.BeginTrans;
|
||
///<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('select * from JTJY_New where JYID=''' + Trim(FJYID) + '''');
|
||
Open;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
if IsEmpty then
|
||
begin
|
||
Append;
|
||
if GetLSNo(ADOTmp, maxno, Trim(MD), 'JTJY_New', 4, 1) = False then
|
||
begin
|
||
ADOCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE><EFBFBD>쳣<EFBFBD><ECB3A3>', '<27><>ʾ', 0);
|
||
BTPrint.Enabled := true;
|
||
Button5.Enabled := true;
|
||
exit;
|
||
end;
|
||
FieldByName('Filler').Value := Trim(DName);
|
||
end
|
||
else
|
||
begin
|
||
maxno := Trim(FJYID);
|
||
Edit;
|
||
FieldByName('Editer').Value := Trim(DName);
|
||
FieldByName('EditTime').Value := SGetServerDateTime(ADOTmp);
|
||
end;
|
||
FieldByName('NewMLID').value := Trim(FMainId);
|
||
FieldByName('NewSubid').value := Trim(FSubId);
|
||
FieldByName('JYID').Value := Trim(maxno);
|
||
FieldByName('RKType').Value := 'δ<><CEB4><EFBFBD><EFBFBD>';
|
||
FieldByName('gangNo').Value := Trim(GangNo.Text);
|
||
FieldByName('JYLen').Value := Trim(MJLen.Text);
|
||
FieldByName('JYKG').Value := 0;
|
||
FieldByName('JYPZ').Value := 0;
|
||
FieldByName('JYJZ').Value := 0;
|
||
FieldByName('JYType').Value := Trim(Label2.Caption);
|
||
FieldByName('JYOrderNo').Value := Trim(label24.Caption);
|
||
FieldByName('JYColHX').Value := Trim(label3.Caption);
|
||
FieldByName('JYColor').Value := Trim(label25.Caption);
|
||
Post;
|
||
end;
|
||
if FInt = '1' then
|
||
begin
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('update JTJY_New SET JYNo=1+isnull((select cast(max(X.JYNo) as int) from JTJY_New X ');
|
||
sql.Add('where X.NewSubid=JTJY_New.NewSubid and X.JYType=JTJY_New.JYType ');
|
||
SQL.Add('and X.GangNo=JTJY_New.GangNo and X.JYID<>JTJY_New.JYID),0) ');
|
||
sql.Add('where JYID=''' + Trim(maxno) + '''');
|
||
execsql;
|
||
end;
|
||
if Order_MJ.IsEmpty then
|
||
begin
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from JTJY_New where NewSubid=''' + trim(FSubId) + ''' and JYType=''' + trim(Label2.Caption) + '''');
|
||
SQL.Add(' and GangNo=''' + trim(GangNo.Text) + '''');
|
||
open;
|
||
end;
|
||
SCreateCDS20(ADOCmd, Order_MJ);
|
||
SInitCDSData20(ADOCmd, Order_MJ);
|
||
end
|
||
else
|
||
begin
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from JTJY_New where JYID=''' + trim(maxno) + '''');
|
||
open;
|
||
end;
|
||
SInitCDSData20(ADOCmd, Order_MJ);
|
||
end;
|
||
Order_MJ.Locate('JYID', Trim(maxno), []);
|
||
end;
|
||
if FInt = '2' then
|
||
begin
|
||
with Order_MJ do
|
||
begin
|
||
edit;
|
||
FieldByName('GangNo').Value := Trim(GangNo.Text);
|
||
FieldByName('JYLen').Value := Trim(MJLen.Text);
|
||
end;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add(' exec P_Update_OrderSub :SubId');
|
||
Parameters.ParamByName('SubId').Value := Trim(FSubId);
|
||
ExecSQL;
|
||
end;
|
||
FJYID := Trim(maxno);
|
||
ADOCmd.Connection.CommitTrans;
|
||
Result := True;
|
||
except
|
||
Result := False;
|
||
ADOCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmMJJYTH.BTPrintClick(Sender: TObject);
|
||
var
|
||
fPrintFile: string;
|
||
mvalue: Double;
|
||
i: Integer;
|
||
begin
|
||
BTPrint.Enabled := False;
|
||
if (FMainId = '') or (FSubId = '') then
|
||
begin
|
||
BTPrint.Enabled := true;
|
||
application.MessageBox('<27><>ɨ<EFBFBD><C9A8>ָʾ<D6B8><CABE>', '<27><>ʾ');
|
||
exit;
|
||
end;
|
||
if Trim(GangNo.Text) = '' then
|
||
begin
|
||
Application.MessageBox('<27>Ų<D7BA><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
with ADOQueryPrint do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('select Sum(JYLen) MJLen ');
|
||
sql.Add('from JTJY_New A where NewSubid=''' + Trim(FSubid) + ''' ');
|
||
sql.Add('and JYType=''' + trim(Label2.Caption) + '''');
|
||
open;
|
||
end;
|
||
if FOrdQty * 1.5 < ADOQueryPrint.FieldByName('MJLen').AsFloat + strtofloat(MJLen.Text) then
|
||
begin
|
||
if Application.MessageBox('<27><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1.5<EFBFBD><EFBFBD>,ȷ<><C8B7>Ҫ<EFBFBD>ύ<EFBFBD><E1BDBB>', '<27><>ʾ', 1) = 2 then
|
||
begin
|
||
BTPrint.Enabled := true;
|
||
Exit;
|
||
end;
|
||
end;
|
||
if MJLen.Text = '' then
|
||
begin
|
||
application.MessageBox('<27><><EFBFBD>Ȳ<EFBFBD><C8B2><EFBFBD>Ϊ<EFBFBD><CEAA>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
BTPrint.Enabled := true;
|
||
exit;
|
||
end;
|
||
if strtofloatdef(trim(MJLen.Text), 0) < 0.0 then
|
||
begin
|
||
application.MessageBox('<27><><EFBFBD>Ȳ<EFBFBD><C8B2><EFBFBD>С<EFBFBD><D0A1>0<EFBFBD><30>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
BTPrint.Enabled := true;
|
||
exit;
|
||
end;
|
||
FInt := '1';
|
||
if SaveDataMD() then
|
||
begin
|
||
MJLen.Text := '';
|
||
PrtDataMD(Trim(Order_MJ.fieldbyname('JYID').AsString));
|
||
if Label2.Caption = '<27>ײ<EFBFBD>' then
|
||
begin
|
||
SpeedButton13.Click;
|
||
end;
|
||
if Label2.Caption = '<27>沼' then
|
||
begin
|
||
SpeedButton14.Click;
|
||
end;
|
||
end;
|
||
BTPrint.Enabled := true;
|
||
MJLen.SetFocus;
|
||
end;
|
||
|
||
procedure TfrmMJJYTH.PrtDataMD(FMJID: string);
|
||
var
|
||
fPrintFile: string;
|
||
Txt, fImagePath: string;
|
||
Moudle: THandle;
|
||
Makebar: TMakebar;
|
||
Mixtext: TMixtext;
|
||
i: Integer;
|
||
begin
|
||
if Trim(Edit16.Text) = '' then
|
||
Exit;
|
||
with ADOQueryPrint do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select A.*,B.*,C.*,ZH.*,ZHXHNo=ZH.XHNo ');
|
||
sql.Add(',KHNameJC=(select KHNameJC from KH_Main KM where KM.KHNO=B.KHNO)');
|
||
SQL.Add('from JTJY_New A ');
|
||
SQL.Add('inner join ML_OrderMainNew B on B.NewMLID=A.NewMLID ');
|
||
SQL.Add('inner join ML_OrderSubidNew C on C.NewSubid=A.NewSubid ');
|
||
sql.Add('left join ML_OrderZuHe ZH on B.NewMLID=ZH.NewMLID');
|
||
sql.Add('where A.JYID=''' + trim(FMJID) + '''');
|
||
sql.Add(' order by ZH.XHNo');
|
||
Open;
|
||
end;
|
||
try
|
||
Moudle := LoadLibrary('MakeQRBarcode.dll');
|
||
@Makebar := GetProcAddress(Moudle, 'Make');
|
||
@Mixtext := GetProcAddress(Moudle, 'MixText');
|
||
Txt := Trim(ADOQueryPrint.fieldbyname('JYID').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);
|
||
BTPrint.Enabled := true;
|
||
Button5.Enabled := true;
|
||
exit;
|
||
end;
|
||
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + trim(Label2.Caption) + '<27><>ǩ.rmf';
|
||
if FileExists(fPrintFile) then
|
||
begin
|
||
RMVariables['QRBARCODE'] := fImagePath;
|
||
RM2.LoadFromFile(fPrintFile);
|
||
//RM2.ShowReport;
|
||
for i := 1 to StrToInt(ComboBox1.Text) do
|
||
begin
|
||
RM2.PrintReport;
|
||
end;
|
||
end
|
||
else
|
||
begin
|
||
Application.MessageBox('û<><C3BB><EFBFBD>ұ<EFBFBD>ǩ<EFBFBD><C7A9>ʽ', '<27><>ʾ', 0);
|
||
BTPrint.Enabled := true;
|
||
Button5.Enabled := true;
|
||
exit;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmMJJYTH.PrtData(FMJID: string);
|
||
var
|
||
fPrintFile, BQName, FKHNO: string;
|
||
Txt, fImagePath: string;
|
||
Moudle: THandle;
|
||
Makebar: TMakebar;
|
||
Mixtext: TMixtext;
|
||
i: Integer;
|
||
begin
|
||
if Trim(Edit16.Text) = '' then
|
||
Exit;
|
||
with ADOQueryPrint do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select A.*,B.*,C.*,CPBQName1=CPBQName ');
|
||
sql.Add(',KHNameJC=(select KHNameJC from KH_Main KM where KM.KHNO=B.KHNO)');
|
||
SQL.Add('from JTJY_New A ');
|
||
SQL.Add('inner join ML_OrderMainNew B on B.NewMLID=A.NewMLID ');
|
||
SQL.Add('inner join ML_OrderSubidNew C on C.NewSubid=A.NewSubid ');
|
||
sql.Add('where A.JYID=''' + trim(FMJID) + '''');
|
||
Open;
|
||
end;
|
||
BQName := Trim(ADOQueryPrint.fieldbyname('CPBQName1').AsString);
|
||
FKHNO := Trim(ADOQueryPrint.fieldbyname('KHNO').AsString);
|
||
if Trim(BQName) = '' then
|
||
begin
|
||
with ADOTmp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select Top 1* from ML_OrderMainNew where KHNO=''' + Trim(FKHNO) + ''' and isnull(CPBQName,'''')<>'''' ');
|
||
sql.Add(' order by FillTime desc ');
|
||
Open;
|
||
end;
|
||
BQName := Trim(ADOQueryPrint.fieldbyname('CPBQName').AsString);
|
||
if Trim(BQName) = '' then
|
||
begin
|
||
BQName := 'ͨ<>ñ<EFBFBD>ǩ';
|
||
end;
|
||
end;
|
||
try
|
||
Moudle := LoadLibrary('MakeQRBarcode.dll');
|
||
@Makebar := GetProcAddress(Moudle, 'Make');
|
||
@Mixtext := GetProcAddress(Moudle, 'MixText');
|
||
Txt := Trim(ADOQueryPrint.fieldbyname('JYID').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);
|
||
Button1.Enabled := true;
|
||
Button2.Enabled := true;
|
||
exit;
|
||
end;
|
||
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + trim(BQName) + '.rmf';
|
||
if FileExists(fPrintFile) then
|
||
begin
|
||
RMVariables['QRBARCODE'] := fImagePath;
|
||
RM2.LoadFromFile(fPrintFile);
|
||
for i := 1 to StrToInt(ComboBox4.Text) do
|
||
begin
|
||
RM2.PrintReport;
|
||
end;
|
||
end
|
||
else
|
||
begin
|
||
Application.MessageBox('û<><C3BB><EFBFBD>ұ<EFBFBD>ǩ<EFBFBD><C7A9>ʽ', '<27><>ʾ', 0);
|
||
Button1.Enabled := true;
|
||
Button2.Enabled := true;
|
||
exit;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmMJJYTH.PrtDataJY(FMJID: string);
|
||
var
|
||
fPrintFile: string;
|
||
Txt, fImagePath: string;
|
||
Moudle: THandle;
|
||
Makebar: TMakebar;
|
||
Mixtext: TMixtext;
|
||
begin
|
||
with ADOQueryPrint do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('exec P_Print_JY_Label ');
|
||
sql.Add('@MJID=' + quotedstr(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);
|
||
BTPrint.Enabled := true;
|
||
exit;
|
||
end;
|
||
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǩ.rmf';
|
||
if FileExists(fPrintFile) then
|
||
begin
|
||
RMVariables['QRBARCODE'] := fImagePath;
|
||
RM2.LoadFromFile(fPrintFile);
|
||
//Rm2.DefaultCopies:=strtointdef(trim(ComboBox1.Text),1);
|
||
//RM2.ShowReport;
|
||
RM2.PrintReport;
|
||
end
|
||
else
|
||
begin
|
||
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + ExtractFilePath(Application.ExeName) + 'Report\' + Trim(ADOQueryPrint.fieldbyname('LBName').AsString)), '<27><>ʾ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmMJJYTH.SpeedButton1Click(Sender: TObject);
|
||
var
|
||
fsj: string;
|
||
begin
|
||
fsj := Trim(TSpeedButton(Sender).Hint);
|
||
if Trim(fsj) = '' then
|
||
Exit;
|
||
fsj := Trim(TEdit(FindComponent(Trim(TSpeedButton(Sender).Hint))).Text);
|
||
TEdit(FindComponent(Trim(TSpeedButton(Sender).Hint))).Text := fsj + Trim(TSpeedButton(Sender).Caption);
|
||
TEdit(FindComponent(Trim(TSpeedButton(Sender).Hint))).SelectAll;
|
||
end;
|
||
|
||
procedure TfrmMJJYTH.SpeedButton12Click(Sender: TObject);
|
||
var
|
||
fsj: string;
|
||
begin
|
||
fsj := Trim(TEdit(FindComponent(Trim(TSpeedButton(Sender).Hint))).Text);
|
||
if Trim(fsj) = '' then
|
||
Exit;
|
||
TEdit(FindComponent(Trim(TSpeedButton(Sender).Hint))).Text := Copy(fsj, 1, Length(fsj) - 1);
|
||
TEdit(FindComponent(Trim(TSpeedButton(Sender).Hint))).SelectAll;
|
||
end;
|
||
|
||
procedure TfrmMJJYTH.SpeedButton13Click(Sender: TObject);
|
||
var
|
||
AA: array[0..100] of string;
|
||
i, j: Integer;
|
||
begin
|
||
Label2.Caption := '<27>ײ<EFBFBD>';
|
||
MD := 'DB';
|
||
PageControl1.TabIndex := 0;
|
||
with ADOQueryPrint do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('select A.GangNo,A.NewSubid,Sum(A.JYLen) SJZQty ');
|
||
sql.Add('from JTJY_New A where NewSubid=''' + Trim(FSubid) + ''' ');
|
||
sql.Add('and JYType=''<27>ײ<EFBFBD>'' ');
|
||
SQL.Add('group by A.GangNo,A.NewSubid');
|
||
open;
|
||
end;
|
||
SCreateCDS20(ADOQueryPrint, DB_HZ);
|
||
SInitCDSData20(ADOQueryPrint, DB_HZ);
|
||
with DB_HZ do
|
||
begin
|
||
First;
|
||
i := 0;
|
||
while not Eof do
|
||
begin
|
||
AA[i] := Trim(fieldbyname('GangNo').AsString);
|
||
i := i + 1;
|
||
Next;
|
||
end;
|
||
end;
|
||
if i < 12 then
|
||
begin
|
||
with Panel5 do
|
||
begin
|
||
for j := 0 to i - 1 do
|
||
begin
|
||
if Controls[j] is TSpeedButton then
|
||
begin
|
||
TSpeedButton(Controls[j]).Visible := true;
|
||
TSpeedButton(Controls[j]).Hint := AA[j];
|
||
TSpeedButton(Controls[j]).Caption := AA[j];
|
||
end;
|
||
end;
|
||
end;
|
||
end
|
||
else
|
||
begin
|
||
with Panel5 do
|
||
begin
|
||
for j := 0 to 11 do
|
||
begin
|
||
if Controls[j] is TSpeedButton then
|
||
begin
|
||
TSpeedButton(Controls[j]).Visible := true;
|
||
TSpeedButton(Controls[j]).Hint := AA[j];
|
||
TSpeedButton(Controls[j]).Caption := AA[j];
|
||
end;
|
||
end;
|
||
end;
|
||
end;
|
||
if DB_HZ.IsEmpty = False then
|
||
begin
|
||
with Panel10 do
|
||
begin
|
||
for j := 0 to i - 1 do
|
||
begin
|
||
if Controls[j] is TSpeedButton then
|
||
begin
|
||
TSpeedButton(Controls[j]).Visible := true;
|
||
TSpeedButton(Controls[j]).Hint := AA[j];
|
||
TSpeedButton(Controls[j]).Caption := AA[j];
|
||
end;
|
||
end;
|
||
end;
|
||
end;
|
||
MJLen.SetFocus;
|
||
panel2.Visible := false;
|
||
end;
|
||
|
||
procedure TfrmMJJYTH.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 TfrmMJJYTH.Button5Click(Sender: TObject);
|
||
begin
|
||
PrtDataMD(Trim(Order_MJ.fieldbyname('JYID').AsString));
|
||
end;
|
||
|
||
procedure TfrmMJJYTH.SMRKKeyPress(Sender: TObject; var Key: Char);
|
||
var
|
||
MSubID: string;
|
||
begin
|
||
if Key <> #13 then
|
||
Exit;
|
||
InitPerson();
|
||
if btn1.Visible = False then
|
||
Exit;
|
||
Label19.Visible := False;
|
||
ScrollBox1.Visible := True;
|
||
ScrollBox1.Left := 70;
|
||
|
||
end;
|
||
|
||
procedure TfrmMJJYTH.MJstr3KeyPress(Sender: TObject; var Key: Char);
|
||
begin
|
||
if Key = #13 then
|
||
begin
|
||
Button1.SetFocus;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmMJJYTH.Label9Click(Sender: TObject);
|
||
begin
|
||
if trim(Label9.Caption) = 'M' then
|
||
begin
|
||
Label9.Caption := 'Y';
|
||
end
|
||
else
|
||
begin
|
||
Label9.Caption := 'M';
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmMJJYTH.JYJZExit(Sender: TObject);
|
||
begin
|
||
if (trim(JYKG.Text) = '') and (trim(JYJZ.Text) = '') then
|
||
exit;
|
||
if (trim(JYKG.Text) = '') and (trim(JYPZ.Text) = '') then
|
||
exit;
|
||
if (trim(JYJZ.Text) = '') and (trim(JYPZ.Text) = '') then
|
||
exit;
|
||
|
||
if (trim(JYPZ.Text) = '') then
|
||
exit;
|
||
|
||
if (trim(JYJZ.Text) <> '') then
|
||
begin
|
||
JYKG.Text := floattostr(strtofloatdef(trim(JYPZ.Text), 0) + strtofloatdef(trim(JYJZ.Text), 0));
|
||
exit;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmMJJYTH.JYJZChange(Sender: TObject);
|
||
var
|
||
FReal: Double;
|
||
begin
|
||
if Trim(JYJZ.Text) = '' then
|
||
begin
|
||
JYKG.Text := '';
|
||
Exit;
|
||
end;
|
||
if TryStrToFloat(JYJZ.Text, FReal) = False then
|
||
Exit;
|
||
if Trim(JYPZ.Text) <> '' then
|
||
begin
|
||
if TryStrToFloat(JYPZ.Text, FReal) = True then
|
||
JYKG.Text := FloatToStr(StrToFloat(JYJZ.Text) + StrToFloat(JYPZ.Text));
|
||
end
|
||
else
|
||
begin
|
||
JYKG.Text := JYJZ.Text;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmMJJYTH.JYKGChange(Sender: TObject);
|
||
var
|
||
FReal: Double;
|
||
begin
|
||
if Trim(JYKG.Text) = '' then
|
||
begin
|
||
JYJZ.Text := '';
|
||
Exit;
|
||
end;
|
||
if TryStrToFloat(JYKG.Text, FReal) = False then
|
||
Exit;
|
||
if Trim(JYPZ.Text) <> '' then
|
||
begin
|
||
if TryStrToFloat(JYPZ.Text, FReal) = False then
|
||
Exit;
|
||
JYJZ.Text := FloatToStr(StrToFloat(JYKG.Text) - StrToFloat(JYPZ.Text));
|
||
end
|
||
else
|
||
begin
|
||
JYJZ.Text := JYKG.Text;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmMJJYTH.Edit7Click(Sender: TObject);
|
||
begin
|
||
if Trim(Edit7.Text) = '' then
|
||
begin
|
||
Edit7.Text := '<27><>';
|
||
if not IsCommOpen then
|
||
OpenCom(JCYDLL);
|
||
IsJsMessage := true;
|
||
end
|
||
else
|
||
begin
|
||
Edit7.Text := '';
|
||
IsJsMessage := False;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmMJJYTH.JYJZKeyPress(Sender: TObject; var Key: Char);
|
||
begin
|
||
if Key = #13 then
|
||
begin
|
||
BTPrint.Click;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmMJJYTH.FormCreate(Sender: TObject);
|
||
begin
|
||
IsCommopen := false;
|
||
IsJsMessage := false;
|
||
IsCzMessage := false;
|
||
end;
|
||
|
||
procedure TfrmMJJYTH.SpeedButton14Click(Sender: TObject);
|
||
var
|
||
AA: array[0..100] of string;
|
||
i, j: Integer;
|
||
begin
|
||
Label2.Caption := '<27>沼';
|
||
MD := 'MB';
|
||
PageControl1.TabIndex := 0;
|
||
with ADOQueryPrint do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('select A.GangNo,A.NewSubid,Sum(A.JYLen) SJZQty ');
|
||
sql.Add('from JTJY_New A where NewSubid=''' + Trim(FSubid) + ''' ');
|
||
sql.Add('and JYType=''<27>沼'' ');
|
||
SQL.Add('group by A.GangNo,A.NewSubid');
|
||
//ShowMessage(sql.Text);
|
||
open;
|
||
end;
|
||
SCreateCDS20(ADOQueryPrint, DB_HZ);
|
||
SInitCDSData20(ADOQueryPrint, DB_HZ);
|
||
with DB_HZ do
|
||
begin
|
||
First;
|
||
i := 0;
|
||
while not Eof do
|
||
begin
|
||
AA[i] := Trim(fieldbyname('GangNo').AsString);
|
||
i := i + 1;
|
||
Next;
|
||
end;
|
||
end;
|
||
if i < 12 then
|
||
begin
|
||
with Panel5 do
|
||
begin
|
||
for j := 0 to i - 1 do
|
||
begin
|
||
if Controls[j] is TSpeedButton then
|
||
begin
|
||
TSpeedButton(Controls[j]).Visible := true;
|
||
TSpeedButton(Controls[j]).Hint := AA[j];
|
||
TSpeedButton(Controls[j]).Caption := AA[j];
|
||
end;
|
||
end;
|
||
end;
|
||
end
|
||
else
|
||
begin
|
||
with Panel5 do
|
||
begin
|
||
for j := 0 to 11 do
|
||
begin
|
||
if Controls[j] is TSpeedButton then
|
||
begin
|
||
TSpeedButton(Controls[j]).Visible := true;
|
||
TSpeedButton(Controls[j]).Hint := AA[j];
|
||
TSpeedButton(Controls[j]).Caption := AA[j];
|
||
end;
|
||
end;
|
||
end;
|
||
end;
|
||
with Panel10 do
|
||
begin
|
||
for j := 0 to i - 1 do
|
||
begin
|
||
if Controls[j] is TSpeedButton then
|
||
begin
|
||
TSpeedButton(Controls[j]).Visible := true;
|
||
TSpeedButton(Controls[j]).Hint := AA[j];
|
||
TSpeedButton(Controls[j]).Caption := AA[j];
|
||
end;
|
||
end;
|
||
end;
|
||
MJLen.SetFocus;
|
||
panel2.Visible := false;
|
||
end;
|
||
|
||
procedure TfrmMJJYTH.SpeedButton15Click(Sender: TObject);
|
||
var
|
||
AA: array[0..100] of string;
|
||
i, j: Integer;
|
||
begin
|
||
Label2.Caption := '<27><>Ʒ';
|
||
if ADOQuery1.IsEmpty = False then
|
||
begin
|
||
Label19.Visible := True;
|
||
Label19.Caption := ADOQuery1.fieldbyname('MLBZNote').AsString;
|
||
end;
|
||
|
||
MD := 'CP';
|
||
PageControl1.TabIndex := 2;
|
||
with ADOQueryPrint do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('select AA.*,CQty=SJZQty-MQQty from (select A.GangNo,A.NewSubid,Sum(A.JYLen) SJZQty ');
|
||
sql.Add(',MQQty=(select Sum(B.JYLen) from JTJY_New B where B.NewSubid=A.NewSubid ');
|
||
sql.Add('and B.JYType=''<27><>Ʒ'' and B.GangNo=A.GangNo)');
|
||
sql.Add('from JTJY_New A where NewSubid=''' + Trim(FSubid) + ''' ');
|
||
sql.Add('and JYType=''<27>沼'' ');
|
||
SQL.Add('group by A.GangNo,A.NewSubid) AA');
|
||
//ShowMessage(sql.Text);
|
||
open;
|
||
end;
|
||
SCreateCDS20(ADOQueryPrint, JY_HZ);
|
||
SInitCDSData20(ADOQueryPrint, JY_HZ);
|
||
with JY_HZ do
|
||
begin
|
||
First;
|
||
i := 0;
|
||
while not Eof do
|
||
begin
|
||
AA[i] := Trim(fieldbyname('GangNo').AsString);
|
||
i := i + 1;
|
||
Next;
|
||
end;
|
||
end;
|
||
if i < 12 then
|
||
begin
|
||
with Panel8 do
|
||
begin
|
||
for j := 0 to i - 1 do
|
||
begin
|
||
if Controls[j] is TSpeedButton then
|
||
begin
|
||
TSpeedButton(Controls[j]).Visible := true;
|
||
TSpeedButton(Controls[j]).Hint := AA[j];
|
||
TSpeedButton(Controls[j]).Caption := AA[j];
|
||
end;
|
||
end;
|
||
end;
|
||
end
|
||
else
|
||
begin
|
||
with Panel8 do
|
||
begin
|
||
for j := 0 to 11 do
|
||
begin
|
||
if Controls[j] is TSpeedButton then
|
||
begin
|
||
TSpeedButton(Controls[j]).Visible := true;
|
||
TSpeedButton(Controls[j]).Hint := AA[j];
|
||
TSpeedButton(Controls[j]).Caption := AA[j];
|
||
end;
|
||
end;
|
||
end;
|
||
end;
|
||
|
||
if JY_HZ.IsEmpty = False then
|
||
begin
|
||
with Panel10 do
|
||
begin
|
||
for j := 0 to i - 1 do
|
||
begin
|
||
if Controls[j] is TSpeedButton then
|
||
begin
|
||
TSpeedButton(Controls[j]).Visible := true;
|
||
TSpeedButton(Controls[j]).Hint := AA[j];
|
||
TSpeedButton(Controls[j]).Caption := AA[j];
|
||
end;
|
||
end;
|
||
end;
|
||
end;
|
||
|
||
JYLen.SetFocus;
|
||
panel2.Visible := false;
|
||
end;
|
||
|
||
procedure TfrmMJJYTH.PageControl1Change(Sender: TObject);
|
||
begin
|
||
if not IsCommOpen then
|
||
OpenCom(JCYDLL);
|
||
IsJsMessage := true;
|
||
end;
|
||
|
||
procedure TfrmMJJYTH.Button3Click(Sender: TObject);
|
||
begin
|
||
close;
|
||
end;
|
||
|
||
procedure TfrmMJJYTH.GangNoClick(Sender: TObject);
|
||
var
|
||
i: Integer;
|
||
begin
|
||
with Panel3 do
|
||
begin
|
||
for i := 0 to ControlCount - 1 do
|
||
begin
|
||
if Controls[i] is TSpeedButton then
|
||
begin
|
||
TSpeedButton(Controls[i]).Hint := Trim(TEdit(Sender).Name);
|
||
end;
|
||
end;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmMJJYTH.SpeedButton29Click(Sender: TObject);
|
||
var
|
||
i: Integer;
|
||
begin
|
||
with Panel8 do
|
||
begin
|
||
for i := 0 to ControlCount - 1 do
|
||
begin
|
||
if Controls[i] is TSpeedButton then
|
||
begin
|
||
TSpeedButton(Controls[i]).Font.Color := clWindowText;
|
||
end;
|
||
end;
|
||
end;
|
||
TSpeedButton(Sender).Font.Color := clRed;
|
||
Edit1.Text := TSpeedButton(Sender).Caption;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('select * from JTJY_New where NewSubid=''' + Trim(FSubid) + '''');
|
||
sql.Add(' and GangNo=''' + Trim(Edit1.Text) + '''');
|
||
SQL.Add(' and JYType=''' + trim(Label2.Caption) + '''');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOCmd, JY_CP);
|
||
SInitCDSData20(ADOCmd, JY_CP);
|
||
end;
|
||
|
||
procedure TfrmMJJYTH.JYLenClick(Sender: TObject);
|
||
var
|
||
i: Integer;
|
||
begin
|
||
with Panel4 do
|
||
begin
|
||
for i := 0 to ControlCount - 1 do
|
||
begin
|
||
if Controls[i] is TSpeedButton then
|
||
begin
|
||
TSpeedButton(Controls[i]).Hint := Trim(TEdit(Sender).Name);
|
||
end;
|
||
end;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmMJJYTH.Button1Click(Sender: TObject);
|
||
var
|
||
fPrintFile: string;
|
||
mvalue: Double;
|
||
i: Integer;
|
||
begin
|
||
button1.Enabled := False;
|
||
if (FMainId = '') or (FSubId = '') then
|
||
begin
|
||
button1.Enabled := true;
|
||
application.MessageBox('<27><>ɨ<EFBFBD><C9A8>ָʾ<D6B8><CABE>', '<27><>ʾ');
|
||
exit;
|
||
end;
|
||
if trim(Edit1.Text) = '' then
|
||
begin
|
||
button1.Enabled := true;
|
||
application.MessageBox('<27>Ų<D7BA><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>', '<27><>ʾ');
|
||
exit;
|
||
end;
|
||
if Trim(Label2.Caption) = '<27><>Ʒ' then
|
||
begin
|
||
with ADOQueryPrint do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('select Sum(JYLen) JYLen ');
|
||
sql.Add('from JTJY_New A where NewSubid=''' + Trim(FSubid) + ''' ');
|
||
sql.Add('and JYType=''' + trim(Label2.Caption) + '''');
|
||
open;
|
||
end;
|
||
if FOrdQty * 1.5 < ADOQueryPrint.FieldByName('JYLen').AsFloat + strtofloat(JYLen.Text) then
|
||
begin
|
||
if Application.MessageBox('<27><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1.5<EFBFBD><EFBFBD>,ȷ<><C8B7>Ҫ<EFBFBD>ύ<EFBFBD><E1BDBB>', '<27><>ʾ', 1) = 2 then
|
||
begin
|
||
button1.Enabled := true;
|
||
Exit;
|
||
end;
|
||
end;
|
||
end;
|
||
|
||
if JYLen.Text = '' then
|
||
begin
|
||
application.MessageBox('<27><><EFBFBD>Ȳ<EFBFBD><C8B2><EFBFBD>Ϊ<EFBFBD><CEAA>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
button1.Enabled := true;
|
||
exit;
|
||
end;
|
||
if Trim(JYPZ.Text) <> '' then
|
||
begin
|
||
if TryStrToFloat(JYPZ.Text, mvalue) = False then
|
||
begin
|
||
Application.MessageBox('Ƥ<>طǷ<D8B7><C7B7><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
end;
|
||
if Trim(XS.Text) <> '' then
|
||
begin
|
||
if TryStrToFloat(XS.Text, mvalue) = False then
|
||
begin
|
||
Application.MessageBox('ϵ<><CFB5><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
end;
|
||
if Trim(JYJZ.Text) <> '' then
|
||
begin
|
||
if TryStrToFloat(JYJZ.Text, mvalue) = False then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD>طǷ<D8B7><C7B7><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
end;
|
||
if Trim(JYKG.Text) <> '' then
|
||
begin
|
||
if TryStrToFloat(JYKG.Text, mvalue) = False then
|
||
begin
|
||
Application.MessageBox('ë<>طǷ<D8B7><C7B7><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
end;
|
||
|
||
if strtofloatdef(trim(JYLen.Text), 0) < 0.0 then
|
||
begin
|
||
application.MessageBox('<27><><EFBFBD>Ȳ<EFBFBD><C8B2><EFBFBD>С<EFBFBD><D0A1>0<EFBFBD><30>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
button1.Enabled := true;
|
||
exit;
|
||
end;
|
||
FInt := '1';
|
||
if SaveData() then
|
||
begin
|
||
JYLen.Text := '';
|
||
JYJZ.Text := '';
|
||
JYKG.Text := '';
|
||
PrtData(Trim(JY_CP.fieldbyname('JYID').AsString));
|
||
end
|
||
else
|
||
begin
|
||
Exit;
|
||
end;
|
||
if Trim(Label2.Caption) = '<27><>Ʒ' then
|
||
begin
|
||
with ADOQueryPrint do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('select AA.*,CQty=SJZQty-MQQty from (select A.GangNo,A.NewSubid,Sum(A.JYLen) SJZQty ');
|
||
sql.Add(',MQQty=(select Sum(B.JYLen) from JTJY_New B where B.NewSubid=A.NewSubid ');
|
||
sql.Add('and B.JYType=''<27><>Ʒ'' and B.GangNo=A.GangNo) ');
|
||
sql.Add('from JTJY_New A where NewSubid=''' + Trim(FSubid) + ''' ');
|
||
sql.Add('and JYType=''<27>沼'' ');
|
||
SQL.Add('group by A.GangNo,A.NewSubid) AA');
|
||
//ShowMessage(sql.Text);
|
||
open;
|
||
end;
|
||
SCreateCDS20(ADOQueryPrint, JY_HZ);
|
||
SInitCDSData20(ADOQueryPrint, JY_HZ);
|
||
end;
|
||
|
||
button1.Enabled := true;
|
||
JYLen.SetFocus;
|
||
end;
|
||
|
||
procedure TfrmMJJYTH.Button2Click(Sender: TObject);
|
||
begin
|
||
if JY_CP.IsEmpty then
|
||
Exit;
|
||
PrtData(Trim(JY_CP.fieldbyname('JYID').AsString));
|
||
end;
|
||
|
||
procedure TfrmMJJYTH.TV2CellClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
||
var
|
||
i: Integer;
|
||
begin
|
||
{with ADOTmp do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('select * from JTJY_New where JYID=''' + Trim(JY_CP.fieldbyname('JYID').AsString) + '''');
|
||
Open;
|
||
end;
|
||
JYLen.Text := FloatToStr(ADOTmp.fieldbyname('JYLen').asfloat);
|
||
JYPZ.Text := FloatToStr(ADOTmp.fieldbyname('JYPZ').asfloat);
|
||
JYJZ.Text := FloatToStr(ADOTmp.fieldbyname('JYJZ').asfloat);
|
||
JYKG.Text := FloatToStr(ADOTmp.fieldbyname('JYKG').asfloat);
|
||
edit1.Text := Trim(ADOTmp.fieldbyname('GangNo').AsString);
|
||
with Panel8 do
|
||
begin
|
||
for i := 0 to ControlCount - 1 do
|
||
begin
|
||
if Controls[i] is TSpeedButton then
|
||
begin
|
||
if TSpeedButton(Controls[i]).Caption = Trim(Edit1.Text) then
|
||
begin
|
||
TSpeedButton(Controls[i]).Font.Color := clRed;
|
||
end
|
||
else
|
||
TSpeedButton(Controls[i]).Font.Color := clWindowText;
|
||
end;
|
||
end;
|
||
end; }
|
||
end;
|
||
|
||
procedure TfrmMJJYTH.SpeedButton28Click(Sender: TObject);
|
||
var
|
||
i: Integer;
|
||
begin
|
||
with Panel5 do
|
||
begin
|
||
for i := 0 to ControlCount - 1 do
|
||
begin
|
||
if Controls[i] is TSpeedButton then
|
||
begin
|
||
TSpeedButton(Controls[i]).Font.Color := clWindowText;
|
||
end;
|
||
end;
|
||
end;
|
||
TSpeedButton(Sender).Font.Color := clRed;
|
||
GangNo.Text := TSpeedButton(Sender).Caption;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('select * from JTJY_New where NewSubid=''' + Trim(FSubid) + '''');
|
||
sql.Add(' and GangNo=''' + Trim(GangNo.Text) + '''');
|
||
SQL.Add(' and JYType=''' + trim(Label2.Caption) + '''');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOCmd, Order_MJ);
|
||
SInitCDSData20(ADOCmd, Order_MJ);
|
||
end;
|
||
|
||
procedure TfrmMJJYTH.Edit2Click(Sender: TObject);
|
||
begin
|
||
if Trim(Edit2.Text) = '' then
|
||
begin
|
||
Edit2.Text := '<27><>';
|
||
if not isCommopenDZC then
|
||
OpenComDZC(DllName);
|
||
IsCzMessage := true;
|
||
end
|
||
else
|
||
begin
|
||
Edit2.Text := '';
|
||
IsCzMessage := False;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmMJJYTH.JYLenChange(Sender: TObject);
|
||
var
|
||
FCD, FPZ, FJZ, FMZ, FXS: string;
|
||
begin
|
||
FCD := Trim(JYLen.Text);
|
||
if Trim(FCD) = '' then
|
||
begin
|
||
FCD := '0';
|
||
end;
|
||
FPZ := Trim(JYPZ.Text);
|
||
if Trim(FPZ) = '' then
|
||
begin
|
||
FPZ := '0';
|
||
end;
|
||
FXS := Trim(XS.Text);
|
||
if Trim(FXS) = '' then
|
||
begin
|
||
FXS := '0';
|
||
end;
|
||
if Trim(FXS) <> '' then
|
||
begin
|
||
JYJZ.Text := FloatToStr(StrToFloat(FCD) * StrToFloat(FXS));
|
||
JYKG.Text := FloatToStr(StrToFloat(FCD) * StrToFloat(FXS) + StrToFloat(FPZ));
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmMJJYTH.Edit16Click(Sender: TObject);
|
||
begin
|
||
if Trim(Edit16.Text) = '' then
|
||
begin
|
||
Edit16.Text := '<27><>';
|
||
end
|
||
else
|
||
begin
|
||
Edit16.Text := '';
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmMJJYTH.TV4CellClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
||
begin
|
||
with ADOTmp do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('select * from JTJY_New where NewSubId=''' + Trim(FSubId) + '''');
|
||
sql.Add(' and GangNo=''' + Trim(DB_HZ.fieldbyname('GangNo').AsString) + '''');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOTmp, Order_MJ);
|
||
SInitCDSData20(ADOTmp, Order_MJ);
|
||
end;
|
||
|
||
procedure TfrmMJJYTH.Button4Click(Sender: TObject);
|
||
var
|
||
fPrintFile: string;
|
||
i: Integer;
|
||
begin
|
||
if Trim(MJLen.Text) = '' then
|
||
Exit;
|
||
with ADOQueryPrint do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select MJLEN=' + MJLen.Text);
|
||
Open;
|
||
end;
|
||
|
||
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\<5C>ձ<EFBFBD>ǩ.rmf';
|
||
if FileExists(fPrintFile) then
|
||
begin
|
||
|
||
RM2.LoadFromFile(fPrintFile);
|
||
for i := 1 to StrToInt(ComboBox1.Text) do
|
||
begin
|
||
RM2.PrintReport;
|
||
end;
|
||
|
||
end
|
||
else
|
||
begin
|
||
Application.MessageBox('û<><C3BB><EFBFBD>ұ<EFBFBD>ǩ<EFBFBD><C7A9>ʽ', '<27><>ʾ', 0);
|
||
BTPrint.Enabled := true;
|
||
Button5.Enabled := true;
|
||
exit;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmMJJYTH.Button6Click(Sender: TObject);
|
||
var
|
||
strsql: string;
|
||
begin
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϻ<EFBFBD><CFBA><EFBFBD><EFBFBD>ݲ<EFBFBD><DDB2>ָܻ<DCBB><D6B8><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
||
Exit;
|
||
try
|
||
ADOCmd.Connection.BeginTrans;
|
||
with ADOTmp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from CK_MLCP_CR where MJID=' + quotedstr(Trim(Order_MJ.fieldbyname('JYID').AsString)));
|
||
sql.Add('and CRFlag=''<27><><EFBFBD><EFBFBD>'' ');
|
||
Open;
|
||
end;
|
||
if ADOTmp.RecordCount >= 1 then
|
||
begin
|
||
ADOCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27>ѳ<EFBFBD><D1B3>ⲻ<EFBFBD><E2B2BB>ɾ<EFBFBD><C9BE>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
with ADOTmp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from JTJY_New where JYID=' + quotedstr(Trim(Order_MJ.fieldbyname('JYID').AsString)));
|
||
sql.Add('and DATEDIFF(MI,filltime,GETDATE())<10 ');
|
||
Open;
|
||
end;
|
||
if ADOTmp.IsEmpty then
|
||
begin
|
||
ADOCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><>¼<EFBFBD><C2BC>ʱ!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('delete JTJY_New where JYID=''' + Trim(Order_MJ.fieldbyname('JYID').AsString) + '''');
|
||
sql.Add('delete CK_MLCP_CR where MJID=''' + Trim(Order_MJ.fieldbyname('JYID').AsString) + '''');
|
||
sql.Add('delete CK_MLCP_KC where MJID=''' + Trim(Order_MJ.fieldbyname('JYID').AsString) + '''');
|
||
ExecSQL;
|
||
end;
|
||
strsql := '<27><>ID<49><44>' + trim(Order_MJ.FieldByName('JYID').AsString);
|
||
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('insert into SY_SysLog(operor,opertime,Model,acction,opevent,result) values( ');
|
||
sql.Add(' ' + quotedstr(trim(DName)));
|
||
sql.Add(',getdate() ');
|
||
sql.Add(',' + quotedstr(trim(self.Caption)));
|
||
sql.Add(',' + quotedstr(trim('<27><><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE>')));
|
||
sql.Add(',' + quotedstr(trim(strsql)));
|
||
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
||
sql.Add(')');
|
||
ExecSQL;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add(' exec P_Update_OrderSub :SubId');
|
||
Parameters.ParamByName('SubId').Value := Trim(FSubId);
|
||
ExecSQL;
|
||
end;
|
||
Order_MJ.Delete;
|
||
ADOCmd.Connection.CommitTrans;
|
||
except
|
||
ADOCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('ɾ<><C9BE>ʧ<EFBFBD><CAA7>!', '<27><>ʾ', 0);
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmMJJYTH.btn1Click(Sender: TObject);
|
||
begin
|
||
ScrollBox1.Visible := False;
|
||
InitSub(TSpeedButton(Sender).Hint);
|
||
end;
|
||
|
||
procedure TfrmMJJYTH.Button8Click(Sender: TObject);
|
||
var
|
||
strsql, FYFID: string;
|
||
begin
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϻ<EFBFBD><CFBA><EFBFBD><EFBFBD>ݲ<EFBFBD><DDB2>ָܻ<DCBB><D6B8><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
||
Exit;
|
||
try
|
||
ADOCmd.Connection.BeginTrans;
|
||
with ADOTmp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from CK_MLCP_CR where MJID=' + quotedstr(Trim(JY_CP.fieldbyname('JYID').AsString)));
|
||
sql.Add('and CRFlag=''<27><><EFBFBD><EFBFBD>'' ');
|
||
Open;
|
||
end;
|
||
if ADOTmp.RecordCount >= 1 then
|
||
begin
|
||
ADOCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27>ѳ<EFBFBD><D1B3>ⲻ<EFBFBD><E2B2BB>ɾ<EFBFBD><C9BE>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
with ADOTmp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from JTJY_New where JYID=' + quotedstr(Trim(JY_CP.fieldbyname('JYID').AsString)));
|
||
sql.Add('and DATEDIFF(MI,filltime,GETDATE())<10 ');
|
||
Open;
|
||
end;
|
||
if ADOTmp.IsEmpty then
|
||
begin
|
||
ADOCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><>¼<EFBFBD><C2BC>ʱ!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
with ADOTmp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from JTJY_New where JYID=''' + Trim(JY_CP.fieldbyname('JYID').AsString) + '''');
|
||
Open;
|
||
end;
|
||
FYFID := Trim(ADOTmp.fieldbyname('YFID').AsString);
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('delete JTJY_New where JYID=''' + Trim(JY_CP.fieldbyname('JYID').AsString) + '''');
|
||
sql.Add('delete CK_MLCP_CR where MJID=''' + Trim(JY_CP.fieldbyname('JYID').AsString) + '''');
|
||
sql.Add('delete CK_MLCP_KC where MJID=''' + Trim(JY_CP.fieldbyname('JYID').AsString) + '''');
|
||
ExecSQL;
|
||
end;
|
||
|
||
if Trim(FYFID) <> '' then
|
||
begin
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add(' exec P_Update_THData :YFID');
|
||
Parameters.ParamByName('YFID').Value := Trim(FYFID);
|
||
ExecSQL;
|
||
end;
|
||
end;
|
||
strsql := '<27><>ID<49><44>' + trim(JY_CP.FieldByName('JYID').AsString);
|
||
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('insert into SY_SysLog(operor,opertime,Model,acction,opevent,result) values( ');
|
||
sql.Add(' ' + quotedstr(trim(DName)));
|
||
sql.Add(',getdate() ');
|
||
sql.Add(',' + quotedstr(trim(self.Caption)));
|
||
sql.Add(',' + quotedstr(trim('<27><><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE>')));
|
||
sql.Add(',' + quotedstr(trim(strsql)));
|
||
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
||
sql.Add(')');
|
||
ExecSQL;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add(' exec P_Update_OrderSub :SubId');
|
||
Parameters.ParamByName('SubId').Value := Trim(FSubId);
|
||
ExecSQL;
|
||
end;
|
||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>&<26>IJ<DEB7><C4B2><EFBFBD><EFBFBD><EFBFBD>
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
//ʵ<><CAB5>
|
||
sql.Add('Update ML_OrderZuHe Set MLJYQty=(select sum(JYLen) from JTJY_New A where A.NewMLID=ML_OrderZuHe.NewMLID and A.JYType=''<27><>Ʒ'') ');
|
||
sql.Add(' where NewMLID=''' + Trim(FMainId) + '''');
|
||
sql.Add(' and isnull(MLName,'''')<>'''' and SSGS=''<27>Լ<EFBFBD>'' ');
|
||
|
||
ExecSQL;
|
||
end;
|
||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>&<26>IJ<DEB7><C4B2><EFBFBD><EFBFBD><EFBFBD>
|
||
Order_MJ.Delete;
|
||
ADOCmd.Connection.CommitTrans;
|
||
except
|
||
ADOCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('ɾ<><C9BE>ʧ<EFBFBD><CAA7>!', '<27><>ʾ', 0);
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmMJJYTH.Button7Click(Sender: TObject);
|
||
var
|
||
fPrintFile: string;
|
||
i: Integer;
|
||
begin
|
||
if Trim(JYLen.Text) = '' then
|
||
Exit;
|
||
with ADOQueryPrint do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select MJLEN=' + JYLen.Text);
|
||
sql.Add(',JYKG=' + JYKG.Text);
|
||
sql.Add(',JYJZ=' + JYJZ.Text);
|
||
Open;
|
||
end;
|
||
|
||
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\<5C>ձ<EFBFBD>ǩ.rmf';
|
||
if FileExists(fPrintFile) then
|
||
begin
|
||
|
||
RM2.LoadFromFile(fPrintFile);
|
||
for i := 1 to StrToInt(ComboBox1.Text) do
|
||
begin
|
||
RM2.PrintReport;
|
||
end;
|
||
|
||
end
|
||
else
|
||
begin
|
||
Application.MessageBox('û<><C3BB><EFBFBD>ұ<EFBFBD>ǩ<EFBFBD><C7A9>ʽ', '<27><>ʾ', 0);
|
||
BTPrint.Enabled := true;
|
||
Button5.Enabled := true;
|
||
exit;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmMJJYTH.Button9Click(Sender: TObject);
|
||
begin
|
||
if SpeedButton83.Visible = False then
|
||
Exit;
|
||
if Panel2.Visible = True then
|
||
Exit;
|
||
Panel10.Visible := True;
|
||
Panel10.Left := 5;
|
||
end;
|
||
|
||
procedure TfrmMJJYTH.SpeedButton83Click(Sender: TObject);
|
||
var
|
||
i: Integer;
|
||
begin
|
||
with Panel10 do
|
||
begin
|
||
for i := 0 to ControlCount - 1 do
|
||
begin
|
||
if Controls[i] is TSpeedButton then
|
||
begin
|
||
TSpeedButton(Controls[i]).Font.Color := clWindowText;
|
||
end;
|
||
end;
|
||
end;
|
||
TSpeedButton(Sender).Font.Color := clRed;
|
||
if PageControl1.ActivePageIndex = 0 then
|
||
begin
|
||
GangNo.Text := TSpeedButton(Sender).Caption;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('select * from JTJY_New where NewSubid=''' + Trim(FSubid) + '''');
|
||
sql.Add(' and GangNo=''' + Trim(GangNo.Text) + '''');
|
||
SQL.Add(' and JYType=''' + trim(Label2.Caption) + '''');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOCmd, Order_MJ);
|
||
SInitCDSData20(ADOCmd, Order_MJ);
|
||
end
|
||
else if PageControl1.ActivePageIndex = 2 then
|
||
begin
|
||
Edit1.Text := TSpeedButton(Sender).Caption;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('select * from JTJY_New where NewSubid=''' + Trim(FSubid) + '''');
|
||
sql.Add(' and GangNo=''' + Trim(Edit1.Text) + '''');
|
||
SQL.Add(' and JYType=''' + trim(Label2.Caption) + '''');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOCmd, JY_CP);
|
||
SInitCDSData20(ADOCmd, JY_CP);
|
||
end;
|
||
Panel10.Visible := False;
|
||
end;
|
||
|
||
procedure TfrmMJJYTH.SpeedButton148Click(Sender: TObject);
|
||
var
|
||
AA: array[0..100] of string;
|
||
i, j: Integer;
|
||
begin
|
||
// Label2.Caption := '<27><>Ʒ';
|
||
Label2.Caption := '<27>˻<EFBFBD>';
|
||
if ADOQuery1.IsEmpty = False then
|
||
begin
|
||
Label19.Visible := True;
|
||
Label19.Caption := ADOQuery1.fieldbyname('MLBZNote').AsString;
|
||
end;
|
||
|
||
MD := 'CP';
|
||
PageControl1.TabIndex := 2;
|
||
with ADOQueryPrint do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('select AA.*,CQty=SJZQty-MQQty from (select A.GangNo,A.NewSubid,Sum(A.JYLen) SJZQty ');
|
||
sql.Add(',MQQty=(select Sum(B.JYLen) from JTJY_New B where B.NewSubid=A.NewSubid ');
|
||
sql.Add('and B.JYType=''<27><>Ʒ'' and B.GangNo=A.GangNo)');
|
||
sql.Add('from JTJY_New A where NewSubid=''' + Trim(FSubid) + ''' ');
|
||
sql.Add('and JYType=''<27>沼'' ');
|
||
SQL.Add('group by A.GangNo,A.NewSubid) AA');
|
||
//ShowMessage(sql.Text);
|
||
open;
|
||
end;
|
||
SCreateCDS20(ADOQueryPrint, JY_HZ);
|
||
SInitCDSData20(ADOQueryPrint, JY_HZ);
|
||
with JY_HZ do
|
||
begin
|
||
First;
|
||
i := 0;
|
||
while not Eof do
|
||
begin
|
||
AA[i] := Trim(fieldbyname('GangNo').AsString);
|
||
i := i + 1;
|
||
Next;
|
||
end;
|
||
end;
|
||
if i < 12 then
|
||
begin
|
||
with Panel8 do
|
||
begin
|
||
for j := 0 to i - 1 do
|
||
begin
|
||
if Controls[j] is TSpeedButton then
|
||
begin
|
||
TSpeedButton(Controls[j]).Visible := true;
|
||
TSpeedButton(Controls[j]).Hint := AA[j];
|
||
TSpeedButton(Controls[j]).Caption := AA[j];
|
||
end;
|
||
end;
|
||
end;
|
||
end
|
||
else
|
||
begin
|
||
with Panel8 do
|
||
begin
|
||
for j := 0 to 11 do
|
||
begin
|
||
if Controls[j] is TSpeedButton then
|
||
begin
|
||
TSpeedButton(Controls[j]).Visible := true;
|
||
TSpeedButton(Controls[j]).Hint := AA[j];
|
||
TSpeedButton(Controls[j]).Caption := AA[j];
|
||
end;
|
||
end;
|
||
end;
|
||
end;
|
||
|
||
if JY_HZ.IsEmpty = False then
|
||
begin
|
||
with Panel10 do
|
||
begin
|
||
for j := 0 to i - 1 do
|
||
begin
|
||
if Controls[j] is TSpeedButton then
|
||
begin
|
||
TSpeedButton(Controls[j]).Visible := true;
|
||
TSpeedButton(Controls[j]).Hint := AA[j];
|
||
TSpeedButton(Controls[j]).Caption := AA[j];
|
||
end;
|
||
end;
|
||
end;
|
||
end;
|
||
|
||
JYLen.SetFocus;
|
||
panel2.Visible := false;
|
||
end;
|
||
|
||
procedure TfrmMJJYTH.CPFlagClick(Sender: TObject);
|
||
begin
|
||
if Trim(CPFlag.Text) = '' then
|
||
begin
|
||
CPFlag.Text := '<27><>';
|
||
end
|
||
else
|
||
begin
|
||
CPFlag.Text := '';
|
||
end;
|
||
end;
|
||
|
||
end.
|
||
|