2290 lines
70 KiB
ObjectPascal
2290 lines
70 KiB
ObjectPascal
unit U_ZHDJInPut;
|
||
|
||
interface
|
||
|
||
uses
|
||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||
Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData, cxDataStorage,
|
||
cxEdit, DB, cxDBData, cxGridLevel, cxGridCustomTableView, cxGridTableView,
|
||
cxGridDBTableView, cxClasses, cxControls, cxGridCustomView, cxGrid, cxMemo,
|
||
cxRichEdit, ComCtrls, cxContainer, cxTextEdit, cxMaskEdit, cxButtonEdit,
|
||
StdCtrls, ToolWin, DBClient, ADODB, ExtCtrls, BtnEdit, cxCalendar, StrUtils,
|
||
cxDropDownEdit, jpeg, IdBaseComponent, IdComponent, IdTCPConnection,
|
||
IdTCPClient, IdFTP, cxPC, cxGridCustomPopupMenu, cxGridPopupMenu, cxGroupBox,
|
||
cxCheckBox, RM_Dataset, RM_System, RM_Common, RM_Class, RM_GridReport,
|
||
IniFiles, cxImage, Menus, ShellAPI, cxLookAndFeels, cxLookAndFeelPainters,
|
||
cxNavigator, dxSkinsCore, dxSkinDarkRoom, dxSkinOffice2013White,
|
||
dxSkinSharpPlus, dxSkinSpringTime, dxSkinsDefaultPainters, dxSkinscxPCPainter,
|
||
dxSkinBlack, dxSkinBlue, dxSkinBlueprint, dxSkinCaramel, dxSkinCoffee,
|
||
dxSkinDarkSide, dxSkinDevExpressDarkStyle, dxSkinDevExpressStyle, dxSkinFoggy,
|
||
dxSkinGlassOceans, dxSkinHighContrast, dxSkiniMaginary, dxSkinLilian,
|
||
dxSkinLiquidSky, dxSkinLondonLiquidSky, dxSkinMcSkin, dxSkinMetropolis,
|
||
dxSkinMetropolisDark, dxSkinMoneyTwins, dxSkinOffice2007Black,
|
||
dxSkinOffice2007Blue, dxSkinOffice2007Green, dxSkinOffice2007Pink,
|
||
dxSkinOffice2007Silver, dxSkinOffice2010Black, dxSkinOffice2010Blue,
|
||
dxSkinOffice2010Silver, dxSkinOffice2013DarkGray, dxSkinOffice2013LightGray,
|
||
dxSkinPumpkin, dxSkinSeven, dxSkinSevenClassic, dxSkinSharp, dxSkinSilver,
|
||
dxSkinStardust, dxSkinSummer2008, dxSkinTheAsphaltWorld, dxSkinValentine,
|
||
dxSkinVS2010, dxSkinWhiteprint, dxSkinXmas2008Blue;
|
||
|
||
type
|
||
TfrmZHDJInPut = class(TForm)
|
||
ToolBar1: TToolBar;
|
||
TBClose: TToolButton;
|
||
ADOTemp: TADOQuery;
|
||
ADOCmd: TADOQuery;
|
||
ADOQuery1: TADOQuery;
|
||
TBSave: TToolButton;
|
||
Label26: TLabel;
|
||
CDS_PRT: TClientDataSet;
|
||
RM1: TRMGridReport;
|
||
Panel3: TPanel;
|
||
Panel5: TPanel;
|
||
ODPat: TOpenDialog;
|
||
IdFTP1: TIdFTP;
|
||
SaveDialog1: TSaveDialog;
|
||
TBPrtInfo: TToolButton;
|
||
Label4: TLabel;
|
||
adoqueryPicture: TADOQuery;
|
||
RMDBMain: TRMDBDataSet;
|
||
ADOQueryCmd: TADOQuery;
|
||
Panel66: TPanel;
|
||
Image2: TImage;
|
||
Panel2: TPanel;
|
||
Button2: TButton;
|
||
Image22: TImage;
|
||
Panel4: TPanel;
|
||
Label1: TLabel;
|
||
DYID: TEdit;
|
||
KHName: TBtnEditA;
|
||
Label3: TLabel;
|
||
GuoJia: TBtnEditA;
|
||
Label5: TLabel;
|
||
Note: TMemo;
|
||
cxGrid1: TcxGrid;
|
||
Tv1: TcxGridDBTableView;
|
||
v1Column7: TcxGridDBColumn;
|
||
Tv1ZIMF: TcxGridDBColumn;
|
||
v1Column6: TcxGridDBColumn;
|
||
v1Column1: TcxGridDBColumn;
|
||
v1ZICost: TcxGridDBColumn;
|
||
v1Column2: TcxGridDBColumn;
|
||
cxGrid1Level1: TcxGridLevel;
|
||
Label9: TLabel;
|
||
v1Column3: TcxGridDBColumn;
|
||
v1XS: TcxGridDBColumn;
|
||
v1BaoJia: TcxGridDBColumn;
|
||
YWY: TBtnEditA;
|
||
v1Column9: TcxGridDBColumn;
|
||
TBPrtBJ: TToolButton;
|
||
cxGridPopupMenu1: TcxGridPopupMenu;
|
||
DataSource1: TDataSource;
|
||
Order_Sub: TClientDataSet;
|
||
Edit2: TEdit;
|
||
Panel9: TPanel;
|
||
LabBZ: TLabel;
|
||
BZ: TComboBox;
|
||
LabHuiLv: TLabel;
|
||
HuiLv: TEdit;
|
||
Label8: TLabel;
|
||
XS: TEdit;
|
||
PopupMenu1: TPopupMenu;
|
||
N1: TMenuItem;
|
||
N2: TMenuItem;
|
||
N3: TMenuItem;
|
||
Label2: TLabel;
|
||
LiDan: TBtnEditA;
|
||
KHGY: TMemo;
|
||
Label7: TLabel;
|
||
v1Column5: TcxGridDBColumn;
|
||
v1Column8: TcxGridDBColumn;
|
||
v1ZIGY: TcxGridDBColumn;
|
||
v1Column11: TcxGridDBColumn;
|
||
Panel1: TPanel;
|
||
v1Column12: TcxGridDBColumn;
|
||
v1Column13: TcxGridDBColumn;
|
||
ADOQuery2: TADOQuery;
|
||
ADOQuery3: TADOQuery;
|
||
ADOQuery6: TADOQuery;
|
||
Button1: TButton;
|
||
v1Column10: TcxGridDBColumn;
|
||
Tv1Column1: TcxGridDBColumn;
|
||
Label6: TLabel;
|
||
Tv1Column2: TcxGridDBColumn;
|
||
Tv1Column3: TcxGridDBColumn;
|
||
Tv1Column4: TcxGridDBColumn;
|
||
Tv1Column5: TcxGridDBColumn;
|
||
cxgrdbclmnTv1Column6: TcxGridDBColumn;
|
||
procedure TBCloseClick(Sender: TObject);
|
||
procedure FormShow(Sender: TObject);
|
||
procedure TBSaveClick(Sender: TObject);
|
||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||
procedure FormCreate(Sender: TObject);
|
||
procedure Button2Click(Sender: TObject);
|
||
procedure TBPrtInfoClick(Sender: TObject);
|
||
procedure Image2DblClick(Sender: TObject);
|
||
procedure GuoJiaBtnClick(Sender: TObject);
|
||
procedure DYIDKeyPress(Sender: TObject; var Key: Char);
|
||
procedure XSKeyPress(Sender: TObject; var Key: Char);
|
||
procedure v1ZICostPropertiesEditValueChanged(Sender: TObject);
|
||
procedure HuiLvKeyPress(Sender: TObject; var Key: Char);
|
||
procedure BZChange(Sender: TObject);
|
||
procedure YWYBtnClick(Sender: TObject);
|
||
procedure KHNameBtnClick(Sender: TObject);
|
||
procedure Tv1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||
procedure KHGYChange(Sender: TObject);
|
||
procedure N1Click(Sender: TObject);
|
||
procedure N2Click(Sender: TObject);
|
||
procedure N3Click(Sender: TObject);
|
||
procedure TBPrtBJClick(Sender: TObject);
|
||
procedure LiDanBtnClick(Sender: TObject);
|
||
procedure v1Column5PropertiesEditValueChanged(Sender: TObject);
|
||
procedure v1BaoJiaCustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
||
procedure v1Column3CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
||
procedure Tv1DblClick(Sender: TObject);
|
||
procedure Button1Click(Sender: TObject);
|
||
procedure Tv1ZIMFPropertiesChange(Sender: TObject);
|
||
private
|
||
lstPat, lstPat2: TStringList;
|
||
FangXiang1, FangXiang2: string;
|
||
procedure InitData();
|
||
procedure SaveImage(maxnoWB: string; FIMNO: string);
|
||
procedure ReadINIFile10();
|
||
function SaveData(): Boolean;
|
||
function StrFenHang(FStr: string; var FHStr: string): Boolean;
|
||
procedure initOldYP();
|
||
{ Private declarations }
|
||
public
|
||
canshu1, canshu2: string;
|
||
PState, CopyInt: Integer;
|
||
FMainId, FZIID: string;
|
||
|
||
{ Public declarations }
|
||
end;
|
||
|
||
var
|
||
frmZHDJInPut: TfrmZHDJInPut;
|
||
|
||
implementation
|
||
|
||
uses
|
||
U_DataLink, U_ZDYHelp, U_RTFun, U_InfoBtn, MMSystem, U_ZHCPList_BJCX,
|
||
U_ZHCPBigMP, U_KHListSelJJ, U_ZHCPInPut, U_MLManage_LRTJ2;
|
||
|
||
{$R *.dfm}
|
||
|
||
procedure TfrmZHDJInPut.TBCloseClick(Sender: TObject);
|
||
begin
|
||
Close;
|
||
WriteCxGrid('չ<><D5B9><EFBFBD>Ǽ<EFBFBD>' + canshu1 + 'YX', Tv1, 'չ<><D5B9><EFBFBD>Ǽ<EFBFBD>');
|
||
end;
|
||
|
||
procedure TfrmZHDJInPut.InitData();
|
||
var
|
||
jpg: TJpegImage;
|
||
myStream: TADOBlobStream;
|
||
FStr: string;
|
||
FZT: Boolean;
|
||
begin
|
||
ReadCxGrid('չ<><D5B9><EFBFBD>Ǽ<EFBFBD>' + canshu1 + 'YX', Tv1, 'չ<><D5B9><EFBFBD>Ǽ<EFBFBD>');
|
||
with ADOQuery1 do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add(' select * ');
|
||
sql.Add(' from ZH_KH_DJ ');
|
||
sql.Add(' where ZDID=''' + Trim(FMainId) + '''');
|
||
Open;
|
||
end;
|
||
SCSHDataNew(ADOQuery1, Panel5, 2);
|
||
SCSHDataNew(ADOQuery1, Panel9, 2);
|
||
with ADOTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select A.ZDID,A.ZCID,A.HeSuanStatus,A.ZIID,A.LeiBie,A.XS,A.BaoJia,A.BaoJiaYW,A.MBBJ,A.DBBJ,A.MHBJ,A.ZIIDYS,A.DYID,A.MXNote,B.MianBuName,B.MianBu,B.ZhongJianCName,B.ZhongJianC,B.DiBuName,B.DiBu ');
|
||
sql.Add(',ZICost=isnull(A.ZICost,B.ZICost),A.ZIName,A.ZIMF,A.ZIKZ,A.ZICF,A.ZIGY,ZIGYYS=isnull(C.ZIGY,A.ZIGY)');
|
||
sql.Add(' ,A.ImageFileTP,A.GS,A.ZICL,CPFiller=B.Filler');
|
||
sql.Add(' from ZH_KH_DJ_CP A ');
|
||
sql.Add(' left join ZH_CP_Info B on A.ZIID=B.ZIID ');
|
||
sql.Add(' left join ZH_CP_Info C on B.ZIIDYS=C.ZIID ');
|
||
sql.Add(' where isnull(A.ZDID,'''')<>'''' and A.ZDID=''' + Trim(FMainId) + ''' and A.Valid=''Y'' ');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOTemp, Order_Sub);
|
||
SInitCDSData20(ADOTemp, Order_Sub);
|
||
if Trim(HuiLv.Text) = '' then
|
||
begin
|
||
with ADOTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select Top 1 * from ZH_KH_DJ order by FillTime desc');
|
||
Open;
|
||
end;
|
||
HuiLv.Text := Trim(ADOTemp.fieldbyname('HuiLv').AsString);
|
||
end;
|
||
|
||
with adoqueryPicture do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from Image_Info A');
|
||
sql.Add(' inner join Image_File B on A.IMID=B.IMID');
|
||
sql.Add(' and A.WBID=''' + Trim(FMainId) + '''');
|
||
sql.Add(' and isnull(A.IMNo,'''')=''<27><>Ƭ'' and A.Valid=''Y'' ');
|
||
Open;
|
||
end;
|
||
if adoqueryPicture.IsEmpty = False then
|
||
begin
|
||
FStr := Trim(adoqueryPicture.fieldbyname('ImageName').AsString);
|
||
jpg := TJpegImage.Create();
|
||
myStream := tadoblobstream.Create(tblobfield(adoqueryPicture.fieldbyname('ImageFile')), bmread);
|
||
jpg.LoadFromStream(myStream);
|
||
Image2.Picture.Assign(jpg);
|
||
Image2.Width := adoqueryPicture.fieldbyname('ImageWidth').Value;
|
||
Image2.Height := adoqueryPicture.fieldbyname('ImageHeight').Value;
|
||
if Trim(adoqueryPicture.fieldbyname('FangXiang').AsString) = '<27><>ֱ' then
|
||
begin
|
||
Image2.Top := 1;
|
||
Image2.Left := Round((Panel66.Width - Image2.Width) / 2);
|
||
end
|
||
else
|
||
begin
|
||
Image2.Left := 1;
|
||
Image2.Top := Round((Panel66.Height - Image2.Height) / 2);
|
||
end;
|
||
Image2.Visible := True;
|
||
end;
|
||
if TBSave.Visible = False then
|
||
begin
|
||
Panel4.Visible := False;
|
||
Panel2.Visible := False;
|
||
KHName.Color := clMenu;
|
||
GuoJia.Color := clMenu;
|
||
|
||
YWY.Color := clMenu;
|
||
BZ.Color := clMenu;
|
||
HuiLv.Color := clMenu;
|
||
XS.Color := clMenu;
|
||
KHGY.Color := clMenu;
|
||
Note.Color := clMenu;
|
||
end;
|
||
if Trim(canshu1) = '<27><><EFBFBD><EFBFBD>' then
|
||
begin
|
||
Panel9.Visible := True;
|
||
v1ZICost.Visible := True;
|
||
v1ZICost.Hidden := False;
|
||
v1XS.Visible := True;
|
||
v1XS.Hidden := False;
|
||
//TBPrtBJ.Visible:=True;
|
||
v1BaoJia.Options.Editing := True;
|
||
end
|
||
else
|
||
begin
|
||
Panel9.Visible := True;
|
||
LabHuiLv.Visible := False;
|
||
HuiLv.Visible := False;
|
||
Label8.Visible := False;
|
||
XS.Visible := False;
|
||
v1ZICost.Visible := False;
|
||
v1ZICost.Hidden := True;
|
||
v1XS.Visible := False;
|
||
v1XS.Hidden := True;
|
||
v1BaoJia.Options.Editing := False;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmZHDJInPut.FormShow(Sender: TObject);
|
||
begin
|
||
InitData();
|
||
end;
|
||
|
||
function TfrmZHDJInPut.SaveData(): Boolean;
|
||
var
|
||
maxno, maxmxno, FMXID, FBaoJia, FZIID, FZIIDAdd, FAdd, FZIIDYS: string;
|
||
FXH: Integer;
|
||
FDate: TDateTime;
|
||
begin
|
||
Result := False;
|
||
FDate := SGetServerDate(ADOTemp);
|
||
try
|
||
ADOCmd.Connection.BeginTrans;
|
||
///<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
if Trim(FMainId) = '' then
|
||
begin
|
||
if GetLSNoHZ(ADOCmd, maxno, 'ZD', 'ZH_KH_DJ', 3, 1, 1) = False then
|
||
begin
|
||
ADOCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
end
|
||
else
|
||
begin
|
||
maxno := Trim(FMainId);
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('select * from ZH_KH_DJ where ZDId=''' + Trim(maxno) + '''');
|
||
Open;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
if Trim(FMainId) = '' then
|
||
begin
|
||
Append;
|
||
end
|
||
else
|
||
begin
|
||
Edit;
|
||
end;
|
||
FieldByName('ZDId').Value := Trim(maxno);
|
||
if Trim(FMainId) = '' then
|
||
begin
|
||
FieldByName('Filler').Value := Trim(DName);
|
||
FieldByName('FillerCode').Value := Trim(DCode);
|
||
FieldByName('Valid').Value := 'Y';
|
||
FieldByName('ZDDate').Value := FDate;
|
||
end
|
||
else
|
||
begin
|
||
FieldByName('Editer').Value := Trim(DName);
|
||
FieldByName('EditerCode').Value := Trim(DCode);
|
||
FieldByName('EditTime').Value := SGetServerDateTime(ADOTemp);
|
||
end;
|
||
RTSetsavedata(ADOCmd, 'ZH_KH_DJ', Panel5, 2);
|
||
RTSetsavedata(ADOCmd, 'ZH_KH_DJ', Panel9, 2);
|
||
Post;
|
||
end;
|
||
FMainId := Trim(maxno);
|
||
|
||
Order_Sub.DisableControls;
|
||
with Order_Sub do
|
||
begin
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from ZH_KH_DJ_CP where ZCID=''' + Trim(Order_Sub.fieldbyname('ZCID').AsString) + '''');
|
||
Open;
|
||
end;
|
||
FMXID := Trim(ADOCmd.fieldbyname('ZCID').AsString);
|
||
if Trim(FMXID) = '' then
|
||
begin
|
||
if GetLSNo(ADOCmd, maxmxno, 'ZC', 'ZH_KH_DJ_CP', 4, 1) = False then
|
||
begin
|
||
Order_Sub.EnableControls;
|
||
ADOCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('ȡ<><C8A1>ϸ<EFBFBD><CFB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
end
|
||
else
|
||
begin
|
||
maxmxno := Trim(FMXID)
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from ZH_KH_DJ_CP where ZCID=''' + Trim(maxmxno) + '''');
|
||
Open;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
if Trim(FMXID) = '' then
|
||
begin
|
||
Append;
|
||
FieldByName('Filler').Value := Trim(DName);
|
||
FieldByName('FillerCode').Value := Trim(DCode);
|
||
FieldByName('Valid').Value := 'Y';
|
||
FieldByName('ZIID').Value := Order_Sub.fieldbyname('ZIID').Value;
|
||
FieldByName('ZIIDYS').Value := Order_Sub.fieldbyname('ZIIDYS').Value;
|
||
end
|
||
else
|
||
begin
|
||
Edit;
|
||
FieldByName('Editer').Value := Trim(DName);
|
||
FieldByName('EditerCode').Value := Trim(DCode);
|
||
FieldByName('EditTime').Value := SGetServerDateTime(ADOTemp);
|
||
end;
|
||
FieldByName('ZDID').Value := Trim(maxno);
|
||
FieldByName('ZCID').Value := Trim(maxmxno);
|
||
FieldByName('DYID').Value := Order_Sub.fieldbyname('DYID').Value;
|
||
FieldByName('HeSuanStatus').Value := Order_Sub.fieldbyname('HeSuanStatus').Value;
|
||
RTSetSaveDataCDS(ADOCmd, Tv1, Order_Sub, 'ZH_KH_DJ_CP', 2);
|
||
FieldByName('Valid').Value := 'Y';
|
||
Post;
|
||
end;
|
||
if Trim(Order_Sub.fieldbyname('ZICL').AsString) <> '' then
|
||
begin
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('update ZH_CP_Info Set ZICL=''' + Trim(Order_Sub.fieldbyname('ZICL').AsString) + '''');
|
||
sql.Add(' where ZIID=''' + Trim(FZIID) + '''');
|
||
ExecSQL;
|
||
end;
|
||
end;
|
||
if Trim(Order_Sub.fieldbyname('ZIGYYS').AsString) <> Trim(Order_Sub.fieldbyname('ZIGY').AsString) then
|
||
begin
|
||
FZIID := Trim(Order_Sub.fieldbyname('ZIID').AsString);
|
||
if Pos('-', FZIID) > 0 then
|
||
begin
|
||
FZIID := Copy(FZIID, 1, Pos('-', FZIID) - 1);
|
||
end;
|
||
with ADOTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from ZH_CP_Info where isnull(ZIIDQuHao,'''')=''' + Trim(FZIID) + '''');
|
||
sql.Add(' and ZIGY=:ZIGY');
|
||
Parameters.ParamByName('ZIGY').Value := Order_Sub.fieldbyname('ZIGY').Value;
|
||
Open;
|
||
end;
|
||
if ADOTemp.IsEmpty then
|
||
begin
|
||
FAdd := '<27><><EFBFBD><EFBFBD>';
|
||
with ADOTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select AA=isnull(max(ZIIDAddXH),0)+1 from ZH_CP_Info where isnull(ZIIDQuHao,'''')=''' + Trim(FZIID) + '''');
|
||
Open;
|
||
end;
|
||
FXH := ADOTemp.fieldbyname('AA').AsInteger;
|
||
if Trim(FMXID) = '' then
|
||
begin
|
||
FZIIDYS := Trim(Order_Sub.fieldbyname('ZIID').AsString);
|
||
end
|
||
else
|
||
begin
|
||
FZIIDYS := Trim(Order_Sub.fieldbyname('ZIIDYS').AsString);
|
||
end;
|
||
end
|
||
else
|
||
begin
|
||
FXH := ADOTemp.fieldbyname('ZIIDAddXH').AsInteger;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('Update ZH_KH_DJ_CP Set ZIID=''' + Trim(FZIID + '-' + Trim(IntToStr(FXH))) + '''');
|
||
SQL.Add(' where ZCID=''' + Trim(maxmxno) + '''');
|
||
ExecSQL;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('Update ZH_KH_DJ_CP Set ZIIDYS=(select ZIIDYS from ZH_CP_Info A where A.ZIID=ZH_KH_DJ_CP.ZIID )');
|
||
SQL.Add(' where ZCID=''' + Trim(maxmxno) + '''');
|
||
ExecSQL;
|
||
end;
|
||
FAdd := '<27><EFBFBD>';
|
||
end;
|
||
FZIIDAdd := FZIID + '-' + Trim(IntToStr(FXH));
|
||
if Trim(FAdd) = '<27><><EFBFBD><EFBFBD>' then
|
||
begin
|
||
if Pos('-', Trim(Order_Sub.fieldbyname('ZIID').AsString)) > 0 then
|
||
begin
|
||
with ADOTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from ZH_KH_DJ_CP where ZIID=''' + Trim(Order_Sub.fieldbyname('ZIID').AsString) + '''');
|
||
sql.Add(' and ZCID<>''' + Trim(Order_Sub.fieldbyname('ZCID').AsString) + '''');
|
||
Open;
|
||
end;
|
||
if ADOTemp.IsEmpty then
|
||
begin
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('Update ZH_CP_Info Set ZIGY=:ZIGY');
|
||
sql.Add(' where ZIID=''' + Trim(Order_Sub.fieldbyname('ZIID').AsString) + '''');
|
||
Parameters.ParamByName('ZIGY').Value := Order_Sub.fieldbyname('ZIGY').Value;
|
||
ExecSQL;
|
||
end;
|
||
FAdd := '<27><><EFBFBD><EFBFBD>';
|
||
end
|
||
else
|
||
begin
|
||
FAdd := '<27><><EFBFBD><EFBFBD>';
|
||
end;
|
||
|
||
end;
|
||
if Trim(FAdd) = '<27><><EFBFBD><EFBFBD>' then
|
||
begin
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('Update ZH_KH_DJ_CP Set ZIID=''' + Trim(FZIIDAdd) + '''');
|
||
sql.Add(',ZIIDYS=''' + Trim(FZIIDYS) + '''');
|
||
SQL.Add(' where ZCID=''' + Trim(maxmxno) + '''');
|
||
ExecSQL;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('insert into ZH_CP_Info(ZIID,ZIMF,ZIKZ,ZICF,ZIGY,Filler,FillerCode,Valid,ZIName,ZIIDYS,ZIIDQuHao,ZIIDAddXH,ZIDate,ZICL)');
|
||
sql.Add('select :ZIID,ZIMF,ZIKZ,ZICF,:ZIGY,:Filler,:FillerCode,''Y'',ZIName,:ZIIDYS,:ZIIDQuHao,:ZIIDAddXH,:ZIDate,:ZICL');
|
||
sql.Add(' from ZH_CP_Info where ZIID=''' + Trim(FZIIDYS) + '''');
|
||
Parameters.ParamByName('ZIID').Value := Trim(FZIIDAdd);
|
||
Parameters.ParamByName('ZIGY').Value := Trim(Order_Sub.fieldbyname('ZIGY').AsString);
|
||
Parameters.ParamByName('Filler').Value := Trim(DName);
|
||
Parameters.ParamByName('FillerCode').Value := Trim(DCode);
|
||
Parameters.ParamByName('ZIIDYS').Value := Trim(FZIIDYS);
|
||
Parameters.ParamByName('ZIIDQuHao').Value := Trim(FZIID);
|
||
Parameters.ParamByName('ZIIDAddXH').Value := FXH;
|
||
Parameters.ParamByName('ZIDate').Value := FDate;
|
||
Parameters.ParamByName('ZICL').Value := Trim(Order_Sub.fieldbyname('ZICL').AsString);
|
||
ExecSQL;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('Update ZH_CP_Info Set ZIGY=:ZIGY');
|
||
sql.Add(' where ZIID=''' + Trim(FZIIDAdd) + '''');
|
||
Parameters.ParamByName('ZIGY').Value := Order_Sub.fieldbyname('ZIGY').Value;
|
||
ExecSQL;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('insert into Image_Info(IMID,IMNO,WBID,ImagePath,ImageName,ImageDate,ImageType,Valid)');
|
||
sql.Add('select ''' + Trim(FZIIDAdd) + '''+substring(IMID,len(IMID)-1,2),IMNO,:WBID,ImagePath,ImageName,ImageDate,ImageType,''Y'' ');
|
||
sql.Add(' from Image_Info where WBID=''' + Trim(FZIIDYS) + ''' and Valid=''Y'' ');
|
||
Parameters.ParamByName('WBID').Value := Trim(FZIIDAdd);
|
||
ExecSQL;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('insert into Image_File(IMID,IFID,IFType,ImageFile,Valid,ImageWidth,ImageHeight,FangXiang)');
|
||
sql.Add('select ''' + Trim(FZIIDAdd) + '''+substring(B.IMID,len(B.IMID)-1,2) ');
|
||
sql.Add(',''' + Trim(FZIIDAdd) + '''+substring(B.IFID,len(B.IFID)-3,4)');
|
||
sql.Add(' ,B.IFType,B.ImageFile,''Y'',B.ImageWidth,B.ImageHeight,B.FangXiang');
|
||
sql.Add(' from Image_Info A ');
|
||
sql.Add(' inner join Image_File B on A.IMID=B.IMID');
|
||
sql.Add(' where A.WBID=''' + Trim(FZIIDYS) + ''' and A.Valid=''Y'' and B.Valid=''Y'' ');
|
||
ExecSQL;
|
||
end;
|
||
end;
|
||
end;
|
||
end;
|
||
if Trim(Order_Sub.fieldbyname('LeiBie').AsString) = '<27><><EFBFBD>ߵ<EFBFBD><DFB5><EFBFBD>' then
|
||
begin
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('Update ZH_CP_Info_KC Set GGQty=0 ');
|
||
sql.Add(' where DYID=''' + Trim(Order_Sub.fieldbyname('DYID').AsString) + '''');
|
||
ExecSQL;
|
||
end;
|
||
end
|
||
else
|
||
begin
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('Update ZH_CP_Info_KC Set GGQty=1 ');
|
||
sql.Add(' where DYID=''' + Trim(Order_Sub.fieldbyname('DYID').AsString) + ''' and isnull(KWID,'''')<>'''' ');
|
||
ExecSQL;
|
||
end;
|
||
end;
|
||
Edit;
|
||
FieldByName('ZDID').Value := Trim(maxno);
|
||
FieldByName('ZCID').Value := Trim(maxmxno);
|
||
Post;
|
||
Next;
|
||
end;
|
||
end;
|
||
Order_Sub.EnableControls;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('Update ZH_KH_DJ Set DJYang=(select Count(*) from ZH_KH_DJ_CP A where A.ZDID=ZH_KH_DJ.ZDID and A.LeiBie=''<27>Ǽ<EFBFBD><C7BC><EFBFBD>'' and A.Valid=''Y'' )');
|
||
sql.Add(',NaYang=(select Count(*) from ZH_KH_DJ_CP A where A.ZDID=ZH_KH_DJ.ZDID and A.LeiBie=''<27><><EFBFBD>ߵ<EFBFBD><DFB5><EFBFBD>'' and A.Valid=''Y'' )');
|
||
sql.Add(' where ZDID=''' + Trim(maxno) + '''');
|
||
ExecSQL;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('Update ZH_KH_DJ Set XunYang=(select Count(*) from ZH_KH_DJ_CP A where A.ZDID=ZH_KH_DJ.ZDID and A.Valid=''Y'' )');
|
||
sql.Add(' where ZDID=''' + Trim(maxno) + '''');
|
||
ExecSQL;
|
||
end;
|
||
if Trim(canshu1) = '<27><><EFBFBD><EFBFBD>' then
|
||
begin
|
||
with ADOTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from ZH_KH_DJ_CP ');
|
||
sql.Add(' where ZDID=''' + Trim(maxno) + ''' and Valid=''Y'' and isnull(BaoJia,0)>0 ');
|
||
Open;
|
||
end;
|
||
if ADOTemp.IsEmpty = False then
|
||
begin
|
||
FBaoJia := '<27>ѱ<EFBFBD><D1B1><EFBFBD>';
|
||
end
|
||
else
|
||
begin
|
||
FBaoJia := '';
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('Update ZH_KH_DJ Set BJStatus=''' + Trim(FBaoJia) + '''');
|
||
sql.Add(' where ZDID=''' + Trim(maxno) + '''');
|
||
ExecSQL;
|
||
end;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('Update ZH_CP_Info Set ZICost=(select Top 1 ZICost from ZH_KH_DJ_CP A where A.ZIID=ZH_CP_Info.ZIID and ZDID=''' + Trim(maxno) + '''');
|
||
sql.Add('order by FillTime desc)');
|
||
sql.Add(' where ZIID in (select ZIID from ZH_KH_DJ_CP CP where ZDID=''' + Trim(maxno) + ''' ');
|
||
sql.Add(' and isnull(ZICost,0)>0 and Valid=''Y'' )'); //and CP.ZIID=ZH_CP_Info.ZIID
|
||
ExecSQL;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('Update ZH_CP_Info Set KHNameHZ=dbo.F_Get_HZStr(ZIID,''KHNaYang'')');
|
||
sql.Add(' where ZIID in(select ZIID from ZH_KH_DJ_CP where ZDID=''' + Trim(maxno) + '''and Valid=''Y'' )');
|
||
ExecSQL;
|
||
end;
|
||
if Trim(Image2.Hint) <> '' then
|
||
begin
|
||
SaveImage(maxno, '<27><>Ƭ');
|
||
end;
|
||
ADOCmd.Connection.CommitTrans;
|
||
FMainId := Trim(maxno);
|
||
Result := True;
|
||
except
|
||
Result := False;
|
||
Panel1.Visible := False;
|
||
ADOCmd.Connection.RollbackTrans;
|
||
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmZHDJInPut.TBSaveClick(Sender: TObject);
|
||
begin
|
||
ToolBar1.SetFocus;
|
||
if Trim(KHName.Text) = '' then
|
||
begin
|
||
Application.MessageBox('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
if Order_Sub.IsEmpty then
|
||
begin
|
||
Application.MessageBox('<27><>ϸ<EFBFBD><CFB8><EFBFBD>ݲ<EFBFBD><DDB2><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
if Order_Sub.Locate('LeiBie', Null, []) then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
if Order_Sub.Locate('LeiBie', '', []) then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
Panel1.Visible := True;
|
||
Panel1.Refresh;
|
||
if SaveData() then
|
||
begin
|
||
Panel1.Visible := False;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>', '<27><>ʾ', 0);
|
||
ModalResult := 1;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmZHDJInPut.ReadINIFile10();
|
||
var
|
||
programIni: Tinifile; //<2F><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>
|
||
FileName: string;
|
||
begin
|
||
FileName := ExtractFilePath(Paramstr(0)) + 'SYSTEMSET.INI';
|
||
programIni := Tinifile.create(FileName);
|
||
server := programIni.ReadString('SERVER', '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ', '127.0.0.1');
|
||
programIni.Free;
|
||
end;
|
||
|
||
procedure TfrmZHDJInPut.SaveImage(maxnoWB: string; FIMNO: string);
|
||
var
|
||
ImagePath, ImagName, MaxNo, MaxNoFile: string;
|
||
AJpeg: TJPEGImage;
|
||
myStream: TADOBlobStream;
|
||
begin
|
||
try
|
||
if Trim(FIMNO) = '<27><>Ƭ' then
|
||
begin
|
||
ImagePath := Image2.Hint;
|
||
ImagName := Image2.Hint;
|
||
end;
|
||
AJpeg := TJpegImage.Create();
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('UPdate Image_File Set Valid=''N'' ');
|
||
sql.Add(' where IMID=(select IMID from Image_Info');
|
||
Sql.Add('where WBID=''' + Trim(maxnoWB) + ''' and Valid=''Y'' and IMNO=''' + Trim(FIMNO) + ''')');
|
||
ExecSQL;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('UPdate Image_Info Set Editer=''' + Trim(DName) + ''',EditerCode=''' + Trim(DCode) + ''',EditTime=getdate()');
|
||
sql.Add(',Valid=''N'' where WBID=''' + Trim(maxnoWB) + ''' and Valid=''Y'' and IMNO=''' + Trim(FIMNO) + ''' ');
|
||
ExecSQL;
|
||
end;
|
||
if GetLSNo(ADOCmd, MaxNo, 'IM', 'Image_Info', 4, 1) = False then
|
||
begin
|
||
ADOCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('ȡͼƬ<CDBC><C6AC>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
SQL.Add('select * from Image_Info where 1=2');
|
||
Open;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
Append;
|
||
FieldByName('IMID').Value := Trim(MaxNo);
|
||
FieldByName('IMNo').Value := FIMNO;
|
||
FieldByName('WBID').Value := Trim(maxnoWB);
|
||
FieldByName('ImageName').Value := Trim(ImagName);
|
||
FieldByName('ImagePath').Value := Trim(MaxNo) + Trim(ImagName);
|
||
FieldByName('ImageDate').Value := SGetServerDate(ADOTemp);
|
||
Fieldbyname('ImageType').value := Trim('MP');
|
||
Fieldbyname('Valid').value := Trim('Y');
|
||
Post;
|
||
end;
|
||
if GetLSNo(ADOCmd, MaxNoFile, 'IF', 'Image_File', 4, 1) = False then
|
||
begin
|
||
ADOCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('ȡͼƬ<CDBC>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add(' select * from Image_File where 1=2');
|
||
open;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
Append;
|
||
FieldByName('IMID').Value := Trim(MaxNo);
|
||
FieldByName('IFID').Value := Trim(MaxNoFile);
|
||
Fieldbyname('Valid').value := Trim('Y');
|
||
if Trim(FIMNO) = '<27><>Ƭ' then
|
||
begin
|
||
FieldByName('ImageWidth').Value := Image2.Width;
|
||
FieldByName('ImageHeight').Value := Image2.Height;
|
||
FieldByName('FangXiang').Value := FangXiang2;
|
||
end;
|
||
FieldByName('IFType').Value := 'С';
|
||
myStream := TADOBlobStream.Create(TBlobField(ADOCmd.FieldByName('ImageFile')), bmWrite);
|
||
if Trim(FIMNO) = '<27><>Ƭ' then
|
||
begin
|
||
AJpeg.Assign(Image2.Picture.Graphic);
|
||
end;
|
||
AJpeg.SaveToStream(myStream);
|
||
myStream.Free;
|
||
Post;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
Append;
|
||
FieldByName('IMID').Value := Trim(MaxNo);
|
||
FieldByName('IFID').Value := Trim(MaxNoFile) + 'D';
|
||
Fieldbyname('Valid').value := Trim('Y');
|
||
if Trim(FIMNO) = '<27><>Ƭ' then
|
||
begin
|
||
FieldByName('ImageWidth').Value := Image22.Width;
|
||
FieldByName('ImageHeight').Value := Image22.Height;
|
||
FieldByName('FangXiang').Value := FangXiang2;
|
||
end;
|
||
FieldByName('IFType').Value := '<27><>';
|
||
myStream := TADOBlobStream.Create(TBlobField(ADOCmd.FieldByName('ImageFile')), bmWrite);
|
||
if Trim(FIMNO) = '<27><>Ƭ' then
|
||
begin
|
||
AJpeg.Assign(Image22.Picture.Graphic);
|
||
end;
|
||
AJpeg.SaveToStream(myStream);
|
||
myStream.Free;
|
||
Post;
|
||
end;
|
||
try
|
||
ReadINIFile10();
|
||
server := ReadINIFileStr('SYSTEMSET.INI', 'SERVER', '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ', '127.0.0.1');
|
||
IdFTP1.Host := server; //PicSvr;
|
||
IdFTP1.Username := 'three';
|
||
IdFTP1.Password := '641010';
|
||
IdFTP1.Connect();
|
||
except
|
||
IdFTP1.Quit;
|
||
Application.MessageBox('<27><EFBFBD><DEB7><EFBFBD><EFBFBD>ӵ<EFBFBD><D3B5>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>飡', '<27><>ʾ', MB_ICONWARNING);
|
||
Exit;
|
||
end;
|
||
if IdFTP1.Connected then
|
||
begin
|
||
if Trim(FIMNO) = '<27><>Ƭ' then
|
||
begin
|
||
IdFTP1.Put(lstPat2[0], 'MP' + '\' + Trim(MaxNo) + Trim(ImagName));
|
||
end;
|
||
end;
|
||
if IdFTP1.Connected then
|
||
IdFTP1.Quit;
|
||
except
|
||
ADOCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('ͼƬ<CDBC><C6AC><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmZHDJInPut.FormClose(Sender: TObject; var Action: TCloseAction);
|
||
begin
|
||
ModalResult := 1;
|
||
end;
|
||
|
||
function TfrmZHDJInPut.StrFenHang(FStr: string; var FHStr: string): Boolean;
|
||
var
|
||
i, j: Integer;
|
||
LSStr: string;
|
||
begin
|
||
Result := False;
|
||
FStr := Trim(FStr);
|
||
FHStr := '';
|
||
j := 1;
|
||
i := Pos(' ', FStr);
|
||
while i > 0 do
|
||
begin
|
||
if j = 1 then
|
||
begin
|
||
LSStr := Copy(FStr, 1, i - 1); //'1234 5678 456'
|
||
FHStr := '1:' + LSStr;
|
||
end
|
||
else
|
||
begin
|
||
LSStr := Copy(FStr, 1, i - 1);
|
||
if Trim(LSStr) = '' then
|
||
begin
|
||
FStr := Copy(FStr, i + 1, Length(FStr) - i);
|
||
end
|
||
else
|
||
FHStr := FHStr + #13 + #10 + inttostr(j) + ':' + LSStr;
|
||
end;
|
||
if Trim(LSStr) <> '' then
|
||
begin
|
||
j := j + 1;
|
||
FStr := Copy(FStr, i + 1, Length(FStr) - i);
|
||
end;
|
||
i := Pos(' ', FStr);
|
||
end;
|
||
if j = 1 then
|
||
begin
|
||
FHStr := FStr;
|
||
end
|
||
else
|
||
begin
|
||
if Trim(FStr) <> '' then
|
||
begin
|
||
FHStr := FHStr + #13 + #10 + inttostr(j) + ':' + FStr;
|
||
end;
|
||
end;
|
||
Result := True;
|
||
end;
|
||
|
||
procedure TfrmZHDJInPut.FormCreate(Sender: TObject);
|
||
begin
|
||
lstPat := TStringList.Create;
|
||
lstPat2 := TStringList.Create;
|
||
end;
|
||
|
||
procedure TfrmZHDJInPut.Button2Click(Sender: TObject);
|
||
var
|
||
AJpeg: TJPEGImage;
|
||
Bitmap, Bitmap22: TBitmap;
|
||
ARect, ARect22: TRect;
|
||
TPHeight, AHeightOffset: Integer;
|
||
TPWidth, AWidthOffset: Integer;
|
||
WZShuiPing, WZChuiZhi: Integer;
|
||
WZFlag: string;
|
||
begin
|
||
lstPat2.Clear;
|
||
if ODPat.Execute then
|
||
begin
|
||
lstPat2.AddStrings(ODPat.Files);
|
||
end
|
||
else
|
||
begin
|
||
Exit;
|
||
end;
|
||
if lstPat2.Count > 1 then
|
||
begin
|
||
lstPat2.Clear;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD><CFB4><EFBFBD><EFBFBD><EFBFBD>ͼƬ!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end
|
||
else if lstPat2.Count < 1 then
|
||
begin
|
||
Exit;
|
||
end;
|
||
Panel1.Visible := True;
|
||
Panel1.Refresh;
|
||
AJpeg := TJpegImage.Create();
|
||
AJpeg.LoadFromFile(ExtractFileName(ODPat.FileName));
|
||
Image2.Hint := ExtractFileName(ODPat.FileName);
|
||
TPWidth := AJpeg.Width;
|
||
TPHeight := AJpeg.Height;
|
||
Bitmap := TBitmap.Create;
|
||
Bitmap22 := TBitmap.Create;
|
||
Bitmap.Width := Panel66.Width - 2;
|
||
Bitmap.Height := Round(Panel66.Width / TPWidth * TPHeight);
|
||
if Bitmap.Height > Panel66.Height then
|
||
begin
|
||
WZFlag := '<27><>ֱ';
|
||
Bitmap.Height := Panel66.Height - 2;
|
||
Bitmap.Width := Round(Panel66.Height / TPHeight * TPWidth);
|
||
end;
|
||
Bitmap22.Width := Bitmap.Width * 2;
|
||
Bitmap22.Height := Bitmap.Height * 2;
|
||
Bitmap.Canvas.FillRect(Rect(0, 0, Bitmap.Width, Bitmap.Height));
|
||
ARect := Rect(0, 0, Bitmap.Width, Bitmap.Height);
|
||
Bitmap.Canvas.StretchDraw(ARect, AJpeg);
|
||
Image2.Height := Bitmap.Height;
|
||
Image2.Width := Bitmap.Width;
|
||
Image2.Picture.Assign(Bitmap);
|
||
if Trim(WZFlag) = '<27><>ֱ' then
|
||
begin
|
||
Image2.Top := 1;
|
||
Image2.Left := Round((Panel66.Width - Image2.Width) / 2);
|
||
end
|
||
else
|
||
begin
|
||
Image2.Left := 1;
|
||
Image2.Top := Round((Panel66.Height - Image2.Height) / 2);
|
||
end;
|
||
FangXiang2 := WZFlag;
|
||
Bitmap22.Canvas.FillRect(Rect(0, 0, Bitmap22.Width, Bitmap22.Height));
|
||
ARect22 := Rect(0, 0, Bitmap22.Width, Bitmap22.Height);
|
||
Bitmap22.Canvas.StretchDraw(ARect22, AJpeg);
|
||
Image22.Height := Bitmap22.Height;
|
||
Image22.Width := Bitmap22.Width;
|
||
Image22.Picture.Assign(Bitmap22);
|
||
Image2.Visible := True;
|
||
Edit2.Text := Copy(Image2.Hint, 1, Length(Image2.Hint) - 4);
|
||
Panel1.Visible := False;
|
||
end;
|
||
|
||
procedure TfrmZHDJInPut.TBPrtInfoClick(Sender: TObject);
|
||
var
|
||
fPrintFile, Txt, fImagePath, maxno: string;
|
||
i, j: Integer;
|
||
Moudle: THandle;
|
||
Makebar: TMakebar;
|
||
Mixtext: TMixtext;
|
||
begin
|
||
if Trim(FMainId) = '' then
|
||
begin
|
||
Application.MessageBox('û<>б<EFBFBD><D0B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD><EFBFBD>ܴ<EFBFBD>ӡ!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
Order_Sub.DisableControls;
|
||
with Order_Sub do
|
||
begin
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
with ADOTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from ZH_KH_DJ_CP where ZCID=''' + Trim(Order_Sub.fieldbyname('ZCID').AsString) + '''');
|
||
Open;
|
||
end;
|
||
if ADOTemp.IsEmpty then
|
||
begin
|
||
Application.MessageBox('û<>б<EFBFBD><D0B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD><EFBFBD>ܴ<EFBFBD>ӡ!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
Next;
|
||
end;
|
||
end;
|
||
Order_Sub.EnableControls;
|
||
RM1.PreviewButtons := [pbZoom, pbLoad, pbSave, pbPrint, pbFind, pbPageSetup, pbExit, pbSaveToXLS, pbExport, pbNavigator];
|
||
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\չ<><D5B9><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7>ǩ85.rmf';
|
||
if FileExists(fPrintFile) = False then
|
||
begin
|
||
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + ExtractFilePath(Application.ExeName) + 'Report\չ<><D5B9><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7>ǩ85.rmf'), '<27><>ʾ', 0);
|
||
exit;
|
||
end;
|
||
if Order_Sub.Locate('SSel', True, []) = False then
|
||
begin
|
||
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
exit;
|
||
end;
|
||
Order_Sub.DisableControls;
|
||
with Order_Sub do
|
||
begin
|
||
First;
|
||
while Locate('SSel', True, []) do
|
||
begin
|
||
with ADOTemp do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add(' select B.* ');
|
||
sql.Add(' from ZH_KH_DJ_CP A');
|
||
sql.Add(' inner join ZH_CP_Info B on A.ZIID=B.ZIID');
|
||
sql.Add(' where A.ZIID=''' + Trim(Order_Sub.fieldbyname('ZIID').AsString) + '''');
|
||
sql.Add(' and A.Valid=''Y'' ');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOTemp, CDS_PRT);
|
||
SInitCDSData20(ADOTemp, CDS_PRT);
|
||
try
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
if GetLSNo(ADOQueryCmd, maxno, 'DYKC', 'ZH_CP_Info_KC', 4, 1, ) = False then
|
||
begin
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('ȡ<><C8A1>Ʒ<EFBFBD><C6B7>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('select * from ZH_CP_Info_KC where DYId=''' + Trim(maxno) + '''');
|
||
Open;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Append;
|
||
FieldByName('ZIId').Value := Trim(Order_Sub.fieldbyname('ZIID').AsString);
|
||
FieldByName('DYId').Value := Trim(maxno);
|
||
FieldByName('Filler').Value := Trim(DName);
|
||
FieldByName('FillerCode').Value := Trim(DCode);
|
||
FieldByName('Valid').Value := 'Y';
|
||
Post;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('Update ZH_CP_Info_KC Set DYXH=isnull((select max(DYXH) from ZH_CP_Info_KC A ');
|
||
sql.Add(' where A.ZIID=''' + Trim(Order_Sub.fieldbyname('ZIID').AsString) + '''),0)+1 ');
|
||
sql.Add(' where DYID=''' + Trim(maxno) + '''');
|
||
ExecSQL;
|
||
end;
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
except
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӡ<EFBFBD><D3A1>ˮ<EFBFBD><CBAE><EFBFBD>쳣<EFBFBD><ECB3A3>', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
try
|
||
Moudle := LoadLibrary('MakeQRBarcode.dll');
|
||
@Makebar := GetProcAddress(Moudle, 'Make');
|
||
@Mixtext := GetProcAddress(Moudle, 'MixText');
|
||
Txt := Trim(maxno);
|
||
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><CEAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
|
||
exit;
|
||
end;
|
||
RMVariables['QRBARCODE'] := fImagePath;
|
||
RMVariables['DYID'] := Trim(maxno);
|
||
RM1.LoadFromFile(fPrintFile);
|
||
//RM1.ShowReport;
|
||
RM1.PrintReport;
|
||
Edit;
|
||
FieldByName('SSel').Value := False;
|
||
end;
|
||
end;
|
||
Order_Sub.EnableControls;
|
||
|
||
end;
|
||
|
||
procedure TfrmZHDJInPut.Image2DblClick(Sender: TObject);
|
||
begin
|
||
if Trim(FMainId) = '' then
|
||
begin
|
||
Application.MessageBox('û<>б<EFBFBD><D0B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD><EFBFBD>ܲ鿴<DCB2><E9BFB4>ͼ!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
try
|
||
frmZHCPBigMP := TfrmZHCPBigMP.Create(Application);
|
||
with frmZHCPBigMP do
|
||
begin
|
||
frmZHCPBigMP.FMainId := Self.FMainId;
|
||
frmZHCPBigMP.FIMNO := '<27><>Ƭ';
|
||
if ShowModal = 1 then
|
||
begin
|
||
|
||
end;
|
||
end;
|
||
finally
|
||
frmZHCPBigMP.Free;
|
||
end;
|
||
;
|
||
end;
|
||
|
||
procedure TfrmZHDJInPut.GuoJiaBtnClick(Sender: TObject);
|
||
begin
|
||
with ADOTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from KH_Main where isnull(KHNameJC,'''')=''' + Trim(KHName.Text) + '''');
|
||
sql.add(' and isnull(KHFlag,'''')=''' + Trim('KH') + ''' and isnull(Valid,'''')=''Y'' ');
|
||
Open;
|
||
end;
|
||
if ADOTemp.IsEmpty = False then
|
||
begin
|
||
if Trim(canshu2) <> '<27><>Ȩ<EFBFBD><C8A8>' then
|
||
begin
|
||
Exit;
|
||
end;
|
||
end;
|
||
try
|
||
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag := 'GuoJia';
|
||
flagname := '<27><><EFBFBD><EFBFBD>';
|
||
if ShowModal = 1 then
|
||
begin
|
||
GuoJia.Text := Trim(ClientDataSet1.fieldbyname('ZdyName').AsString);
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmZHDJInPut.initOldYP();
|
||
var
|
||
FMXCYID, FColNo, FCYType, CPID: string;
|
||
begin
|
||
with ADOQuery6 do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('select A.CYID MXCYType,A.ColorNo,CYType=isnull((select Top 1 C.CYType from CP_YDang B inner join CP_YDang C on C.CYID=B.CYType where B.CYID=A.CYID)');
|
||
SQL.Add(',(select Top 1 B.CYType from CP_YDang B where B.CYID=A.CYID))');
|
||
sql.Add(',CYID=isnull((select Top 1 C.CYID from CP_YDang B inner join CP_YDang C on C.CYID=B.CYType where B.CYID=A.CYID),');
|
||
sql.Add('(select Top 1 B.CYID from CP_YDang B where B.CYID=A.CYID))');
|
||
sql.Add(' from CP_YDang_Color A where A.CLRID=''' + trim(DYID.Text) + '''');
|
||
//ShowMessage(sql.Text);
|
||
Open;
|
||
end;
|
||
with ADOQuery2 do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from CP_YDang where CYID=''' + Trim(DYID.Text) + '''');
|
||
Open;
|
||
end;
|
||
with ADOQuery3 do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from CP_YDang where CYID=''' + Trim(ADOQuery2.fieldbyname('CYType').AsString) + '''');
|
||
Open;
|
||
end;
|
||
if ADOQuery6.IsEmpty = false then
|
||
begin
|
||
CPID := Trim(ADOQuery6.fieldbyname('CYType').AsString);
|
||
FMXCYID := Trim(ADOQuery6.fieldbyname('CYID').AsString);
|
||
FColNo := Trim(ADOQuery6.fieldbyname('ColorNo').AsString);
|
||
FCYType := Trim(ADOQuery6.fieldbyname('MXCYType').AsString);
|
||
end;
|
||
if ADOQuery2.IsEmpty = false then
|
||
begin
|
||
CPID := Trim(ADOQuery2.fieldbyname('CYType').AsString);
|
||
FMXCYID := Trim(ADOQuery2.fieldbyname('CYID').AsString);
|
||
end;
|
||
if ADOQuery3.IsEmpty = false then
|
||
begin
|
||
CPID := Trim(ADOQuery3.fieldbyname('CYType').AsString);
|
||
FMXCYID := Trim(ADOQuery3.fieldbyname('CYID').AsString);
|
||
FCYType := Trim(DYID.Text);
|
||
end;
|
||
with ADOTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add(' exec P_Select_CP_YDang1 :CYType,:CP,:RON,:WSql,:Stats ');
|
||
Parameters.ParamByName('CYType').Value := CPID;
|
||
Parameters.ParamByName('CP').Value := 1;
|
||
Parameters.ParamByName('RON').Value := 100;
|
||
Parameters.ParamByName('WSql').Value := ' CYID=''' + Trim(FMXCYID) + ''' ';
|
||
Parameters.ParamByName('Stats').Value := 2;
|
||
Open;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmZHDJInPut.DYIDKeyPress(Sender: TObject; var Key: Char);
|
||
var
|
||
FZIID, FLeiBie, FZIIDYS, fsj: string;
|
||
begin
|
||
if Key = #13 then
|
||
begin
|
||
InitOldYP();
|
||
if ADOTemp.IsEmpty then
|
||
begin
|
||
if Copy(Trim(DYID.Text), 1, 4) = 'DYKC' then
|
||
begin
|
||
with ADOTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from ZH_CP_Info_KC where DYID=''' + Trim(DYID.Text) + '''');
|
||
Open;
|
||
end;
|
||
FZIID := Trim(ADOTemp.fieldbyname('ZIID').AsString);
|
||
DYID.Hint := Trim(DYID.Text);
|
||
if Trim(FZIID) = '' then
|
||
begin
|
||
PlaySound('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.wav', 0, SND_FILENAME or SND_ASYNC);
|
||
DYID.Text := '';
|
||
DYID.Hint := '';
|
||
Exit;
|
||
end;
|
||
end;
|
||
if Copy(Trim(DYID.Text), 1, 3) = 'Y20' then
|
||
begin
|
||
with ADOTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from ZH_CP_Info where ZIID=''' + Trim(DYID.Text) + '''');
|
||
Open;
|
||
end;
|
||
if ADOTemp.IsEmpty then
|
||
begin
|
||
PlaySound('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.wav', 0, SND_FILENAME or SND_ASYNC);
|
||
DYID.Text := '';
|
||
DYID.Hint := '';
|
||
Exit;
|
||
end;
|
||
FZIID := Trim(DYID.Text);
|
||
DYID.Hint := Trim(DYID.Text);
|
||
end;
|
||
|
||
with ADOTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from ZH_CP_Info where ZIID=''' + Trim(FZIID) + '''');
|
||
Open;
|
||
end;
|
||
FZIIDYS := Trim(ADOTemp.fieldbyname('ZIIDYS').AsString);
|
||
if Order_Sub.IsEmpty then
|
||
begin
|
||
FLeiBie := '<27>Ǽ<EFBFBD><C7BC><EFBFBD>';
|
||
end
|
||
else
|
||
begin
|
||
FLeiBie := Trim(Order_Sub.fieldbyname('LeiBie').AsString);
|
||
end;
|
||
with ADOTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select A.*,ZIGYYS=B.ZIGY ');
|
||
sql.Add(' ,ImageFileTP=(select Top 1 ImageFile from Image_Info B inner join Image_File C on B.IMID=C.IMID ');
|
||
sql.Add(' where B.WBID=A.ZIID and B.IMNO=''ͼƬ'' and B.Valid=''Y'' and C.Valid=''Y'' and C.IFType=''С'' )');
|
||
sql.Add(',GS=(select Sum(GGQty) from ZH_CP_Info_KC KC where KC.ZIID=A.ZIID )');
|
||
sql.Add(' from ZH_CP_Info A ');
|
||
sql.Add(' left join ZH_CP_Info B on A.ZIIDYS=B.ZIID ');
|
||
sql.Add(' where A.ZIID=''' + Trim(FZIID) + '''');
|
||
Open;
|
||
end;
|
||
if Copy(DYID.Text, 1, 4) = 'TGML' then
|
||
begin
|
||
with ADOTemp do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
SQL.Add('select Top 1 B.*,E.*,MLDLNo SKID,MLPinYin=dbo.getPinYin(A.MLName) ');
|
||
sql.Add(',ColGS=(select count(B.TJML) from Image_Info B where B.TJML=A.TJML)');
|
||
sql.Add(',ImageFile ImageFileTP,GS=cast(1 as decimal(18,2)),ZICost=cast(0 as decimal(18,2))');
|
||
sql.Add(' ,A.MLID,A.MLNo,A.MLName ZIName,A.MLMF ZIMF,A.MLKZ ZIKZ,A.MBPID,A.MLCF ZICF,');
|
||
sql.Add(' A.MLType,A.GYLX,A.TJGYName ZIGY,A.GYType,A.GYTypeJC,ZICL='''' ');
|
||
sql.Add(' from ML_Manage A ');
|
||
sql.Add(' left join Image_Info B on B.TJML=A.TJML ');
|
||
sql.Add(' left join Image_File E on B.IMID=E.IMID ');
|
||
sql.Add(' left join BP_DY C on C.TFID=B.IMID and C.MLID=A.MLID');
|
||
sql.Add(' left join BP_DY D on D.TFID=A.PTID and D.MLID=A.MLID');
|
||
sql.Add(' where isnull(A.MLType,'''')=''<27>̽<EFBFBD><CCBD><EFBFBD><EFBFBD><EFBFBD>'' and isnull(C.DYID,D.DYID)=''' + trim(DYID.Text) + '''');
|
||
//ShowMessage(sql.Text);
|
||
Open;
|
||
end;
|
||
if ADOTemp.IsEmpty then
|
||
begin
|
||
PlaySound('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.wav', 0, SND_FILENAME or SND_ASYNC);
|
||
DYID.Text := '';
|
||
DYID.Hint := '';
|
||
Exit;
|
||
end;
|
||
FZIID := Trim(ADOTemp.fieldbyname('WBID').AsString);
|
||
DYID.Hint := Trim(DYID.Text);
|
||
end;
|
||
if Copy(Trim(DYID.Text), 1, 2) = 'QM' then
|
||
begin
|
||
with ADOTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select A.MXID,A.MXTime,A.RCGangNo,A.GangNo,A.JH,A.KgQty,A.YQty,A.MQty,A.KuWei,ZICL='''',');
|
||
sql.Add(' B.MYType,B.MYID,B.MLID,B.BPID,B.DYID,B.PTID,B.MYCode,B.MYName ZIName,B.MYColor, ');
|
||
sql.Add(' B.MYColorNo,B.MYMF ZIMF,B.MYKZ ZIKZ,B.Note,B.Note2,A.MXNote,');
|
||
sql.Add(' Case when isnull(A.RCGangNo,'''')='''' then A.GangNo else A.RCGangNo end As DYGangNo,');
|
||
sql.Add(' C.GYLX,C.GYLXName ZIGY,C.MLCF ZICF,C.MLJWMD,C.GYType,GS=cast(1 as decimal(18,2)),ZICost=cast(0 as decimal(18,2))');
|
||
sql.Add(' ,ImageFileTP=cast('''' as varchar(50))');
|
||
sql.Add(' Case when ISNULL(A.MQty,0)>0 and ISNULL(A.KgQty,0)>0 ');
|
||
sql.Add(' then Cast(CAST(A.MQty as decimal(18,1)) AS varchar(10))+''M''+'' '' ');
|
||
sql.Add(' +Cast(CAST(A.KgQty as decimal(18,1)) AS varchar(10))+''Kg''+'' '' ');
|
||
sql.Add(' When ISNULL(A.MQty,0)>0 and ISNULL(A.KgQty,0)=0 ');
|
||
sql.Add(' then Cast(CAST(A.MQty as decimal(18,1)) AS varchar(10))+''M'' ');
|
||
sql.Add(' When ISNULL(A.KgQty,0)>0 and ISNULL(A.MQty,0)=0 ');
|
||
sql.Add(' then Cast(CAST(A.KgQty as decimal(18,1)) AS varchar(10))+''Kg''');
|
||
sql.Add(' end as QtyStr ');
|
||
sql.Add(' from CK_MYSC_CR_MX A ');
|
||
sql.Add(' inner join CK_MYSC_CR B on A.MYID=B.MYID ');
|
||
sql.Add(' left join ML_Manage C on B.MLID=C.MLID ');
|
||
sql.Add(' Where A.MXID=''' + trim(DYID.Text) + '''');
|
||
SQL.Add(' or B.DYID=''' + trim(DYID.Text) + '''');
|
||
//ShowMessage(sql.Text);
|
||
Open;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from RT_PTColor where PTID=''' + Trim(ADOTemp.fieldbyname('PTID').AsString) + '''');
|
||
Open;
|
||
end;
|
||
fsj := Trim(ADOCmd.fieldbyname('ColDaiMa').AsString);
|
||
if fsj <> '' then
|
||
Panel66.Color := StrToInt('$' + Trim(fsj));
|
||
if ADOTemp.IsEmpty then
|
||
begin
|
||
PlaySound('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.wav', 0, SND_FILENAME or SND_ASYNC);
|
||
DYID.Text := '';
|
||
DYID.Hint := '';
|
||
Exit;
|
||
end;
|
||
FZIID := Trim(DYID.Text);
|
||
DYID.Hint := Trim(DYID.Text);
|
||
end;
|
||
if Copy(DYID.Text, 1, 4) = 'DY20' then
|
||
begin
|
||
with ADOTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select A.DYID,');
|
||
sql.Add(' B.MLID,B.MLNo,B.MLName ZIName,B.MLMF ZIMF,B.MLKZ ZIKZ,B.MBPID,B.MLCF ZICF,');
|
||
sql.Add(' ZICL='''',B.MLType,B.GYLX,B.GYLXName ZIGY,B.GYType,B.GYTypeJC,');
|
||
sql.Add(' C.PTID,C.ColNamekh,C.ColNo,GS=cast(1 as decimal(18,2)),ZICost=cast(0 as decimal(18,2))');
|
||
sql.Add(' ,D.ColNameEng,D.ColDaiMa ');
|
||
sql.Add(' ,ImageFileTP=cast('''' as varchar(50))');
|
||
sql.Add(' from BP_DY A ');
|
||
sql.Add(' inner join ML_Manage B on A.MLID=B.MLID ');
|
||
sql.Add(' inner join BP_ZDY BP on B.MBPID=BP.BPID ');
|
||
sql.Add(' left join BP_ColZDY C on A.TFID=C.PTID and BP.SKID=C.SKID ');
|
||
sql.Add(' left join RT_PTColor D on C.PTID=D.PTID ');
|
||
sql.Add(' Where A.DYID=''' + trim(DYID.Text) + '''');
|
||
//ShowMessage(sql.Text);
|
||
Open;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from RT_PTColor where PTID=''' + Trim(ADOTemp.fieldbyname('PTID').AsString) + '''');
|
||
Open;
|
||
end;
|
||
fsj := Trim(ADOCmd.fieldbyname('ColDaiMa').AsString);
|
||
if fsj <> '' then
|
||
Panel66.Color := StrToInt('$' + Trim(fsj));
|
||
if ADOTemp.IsEmpty then
|
||
begin
|
||
PlaySound('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.wav', 0, SND_FILENAME or SND_ASYNC);
|
||
DYID.Text := '';
|
||
DYID.Hint := '';
|
||
Exit;
|
||
end;
|
||
FZIID := Trim(ADOTemp.fieldbyname('MLNo').Value);
|
||
DYID.Hint := Trim(DYID.Text);
|
||
end;
|
||
end
|
||
else
|
||
begin
|
||
FZIID := Trim(DYID.Text);
|
||
DYID.Hint := Trim(DYID.Text);
|
||
end;
|
||
if FZIIDYS = '' then
|
||
FZIIDYS := Trim(DYID.Text);
|
||
|
||
with Order_Sub do
|
||
begin
|
||
if Trim(DYID.Hint) <> '' then
|
||
begin
|
||
if Locate('DYID', Trim(DYID.Hint), []) = True then
|
||
begin
|
||
DYID.Text := '';
|
||
DYID.Hint := '';
|
||
PlaySound('<27>ѵǼ<D1B5>.wav', 0, SND_FILENAME or SND_ASYNC);
|
||
Exit;
|
||
end;
|
||
end
|
||
else
|
||
begin
|
||
if Locate('ZIID', Trim(FZIID), []) = True then
|
||
begin
|
||
DYID.Text := '';
|
||
DYID.Hint := '';
|
||
PlaySound('<27>ѵǼ<D1B5>.wav', 0, SND_FILENAME or SND_ASYNC);
|
||
Exit;
|
||
end;
|
||
end;
|
||
Append;
|
||
FieldByName('DYID').Value := Trim(DYID.Hint);
|
||
FieldByName('ZIID').Value := Trim(FZIID);
|
||
FieldByName('ZIIDYS').Value := Trim(FZIIDYS);
|
||
FieldByName('ZIName').Value := ADOTemp.fieldbyname('ZIName').Value;
|
||
FieldByName('ZIMF').Value := ADOTemp.fieldbyname('ZIMF').Value;
|
||
FieldByName('ZIKZ').Value := ADOTemp.fieldbyname('ZIKZ').Value;
|
||
FieldByName('ZICF').Value := ADOTemp.fieldbyname('ZICF').Value;
|
||
FieldByName('ZIGY').Value := ADOTemp.fieldbyname('ZIGY').Value;
|
||
FieldByName('ZICL').Value := ADOTemp.fieldbyname('ZICL').Value;
|
||
FieldByName('GS').Value := ADOTemp.fieldbyname('GS').Value;
|
||
FieldByName('ZICost').Value := ADOTemp.fieldbyname('ZICost').Value;
|
||
FieldByName('ImageFileTP').Value := ADOTemp.fieldbyname('ImageFileTP').Value;
|
||
FieldByName('ZIGYYS').Value := ADOTemp.fieldbyname('ZIGY').Value;
|
||
FieldByName('LeiBie').Value := Trim(FLeiBie);
|
||
FieldByName('ZICost').Value := ADOTemp.fieldbyname('ZICost').Value;
|
||
Post;
|
||
end;
|
||
DYID.Text := '';
|
||
DYID.Hint := '';
|
||
KHGY.Text := Trim(ADOTemp.fieldbyname('ZIGY').AsString);
|
||
PlaySound('<27>Ǽdzɹ<C7B3>.wav', 0, SND_FILENAME or SND_ASYNC);
|
||
//ZIGY.Text:=Trim(KHGY.Text);
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmZHDJInPut.XSKeyPress(Sender: TObject; var Key: Char);
|
||
var
|
||
FReal: Double;
|
||
FXS: string;
|
||
begin
|
||
if Key = #13 then
|
||
begin
|
||
if Order_Sub.IsEmpty then
|
||
Exit;
|
||
if Trim(BZ.Text) = '$' then
|
||
begin
|
||
if Trim(HuiLv.Text) = '' then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD>ʲ<EFBFBD><CAB2><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
if TryStrToFloat(HuiLv.Text, FReal) = False then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD>ʷǷ<CAB7><C7B7><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
end;
|
||
FXS := Trim(XS.Text);
|
||
if Trim(FXS) = '' then
|
||
begin
|
||
FXS := '1';
|
||
end;
|
||
if TryStrToFloat(FXS, FReal) = False then
|
||
begin
|
||
Application.MessageBox('ϵ<><CFB5><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD>ϵ<EFBFBD><CFB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
||
Exit;
|
||
Order_Sub.DisableControls;
|
||
with Order_Sub do
|
||
begin
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
Edit;
|
||
FieldByName('XS').Value := FXS;
|
||
if Trim(Order_Sub.fieldbyname('ZICost').AsString) <> '' then
|
||
begin
|
||
if Trim(BZ.Text) = '$' then
|
||
begin
|
||
FieldByName('BaoJia').Value := SSWR(Order_Sub.fieldbyname('ZICost').Value * StrtoFloat(FXS) / StrtoFloat(HuiLv.Text));
|
||
FieldByName('HeSuanStatus').Value := '<27>Ѻ<EFBFBD><D1BA><EFBFBD>';
|
||
end
|
||
else
|
||
begin
|
||
FieldByName('BaoJia').Value := SSWR(Order_Sub.fieldbyname('ZICost').Value * StrtoFloat(FXS));
|
||
FieldByName('HeSuanStatus').Value := '<27>Ѻ<EFBFBD><D1BA><EFBFBD>';
|
||
end;
|
||
end
|
||
else
|
||
begin
|
||
FieldByName('HeSuanStatus').Value := Null;
|
||
end;
|
||
Post;
|
||
Next;
|
||
end;
|
||
end;
|
||
Order_Sub.EnableControls;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmZHDJInPut.v1ZICostPropertiesEditValueChanged(Sender: TObject);
|
||
var
|
||
mvalue, FXS, FHuiLv, FZiCost, FName: string;
|
||
Freal: Double;
|
||
begin
|
||
mvalue := TcxTextEdit(Sender).EditingText;
|
||
FName := Tv1.Controller.FocusedColumn.DataBinding.FilterFieldName;
|
||
with Order_Sub do
|
||
begin
|
||
Edit;
|
||
if Trim(mvalue) = '' then
|
||
begin
|
||
if FName = 'XS' then
|
||
begin
|
||
Edit;
|
||
FieldByName(FName).Value := 1;
|
||
Post;
|
||
end
|
||
else
|
||
begin
|
||
FieldByName(FName).Value := Null;
|
||
end;
|
||
end
|
||
else
|
||
begin
|
||
FieldByName(FName).Value := mvalue;
|
||
end;
|
||
end;
|
||
FHuiLv := HuiLv.Text;
|
||
FXS := Trim(Order_Sub.fieldbyname('XS').AsString);
|
||
if FXS = '' then
|
||
begin
|
||
if Trim(XS.Text) <> '' then
|
||
begin
|
||
FXS := XS.Text;
|
||
end
|
||
else
|
||
begin
|
||
FXS := '1';
|
||
end;
|
||
with Order_Sub do
|
||
begin
|
||
Edit;
|
||
FieldByName('XS').Value := FXS;
|
||
Post;
|
||
end;
|
||
end;
|
||
FZiCost := Trim(Order_Sub.fieldbyname('ZiCost').AsString);
|
||
if Trim(FZiCost) = '' then
|
||
begin
|
||
with Order_Sub do
|
||
begin
|
||
Edit;
|
||
FieldByName('BaoJia').Value := null;
|
||
FieldByName('HeSuanStatus').Value := Null;
|
||
post;
|
||
end;
|
||
Exit;
|
||
end
|
||
else
|
||
begin
|
||
if Trim(BZ.Text) = '$' then
|
||
begin
|
||
if Trim(HuiLv.Text) = '' then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD>ʲ<EFBFBD><CAB2><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
if TryStrToFloat(HuiLv.Text, Freal) = False then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD>ʷǷ<CAB7><C7B7><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
end
|
||
else
|
||
begin
|
||
FHuiLv := '1';
|
||
end;
|
||
with Order_Sub do
|
||
begin
|
||
Edit;
|
||
FieldByName('BaoJia').Value := SSWR(StrtoFloat(FZiCost) * StrtoFloat(FXS) / StrtoFloat(FHuiLv));
|
||
FieldByName('HeSuanStatus').Value := '<27>Ѻ<EFBFBD><D1BA><EFBFBD>';
|
||
Post;
|
||
end;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmZHDJInPut.HuiLvKeyPress(Sender: TObject; var Key: Char);
|
||
var
|
||
FReal: Double;
|
||
FXS: string;
|
||
begin
|
||
if Key = #13 then
|
||
begin
|
||
if Order_Sub.IsEmpty then
|
||
Exit;
|
||
if Trim(BZ.Text) = '$' then
|
||
begin
|
||
if Trim(HuiLv.Text) = '' then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD>ʲ<EFBFBD><CAB2><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
if TryStrToFloat(HuiLv.Text, FReal) = False then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD>ʷǷ<CAB7><C7B7><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
end;
|
||
FXS := Trim(XS.Text);
|
||
if Trim(FXS) = '' then
|
||
begin
|
||
FXS := '1';
|
||
end;
|
||
if TryStrToFloat(FXS, FReal) = False then
|
||
begin
|
||
Application.MessageBox('ϵ<><CFB5><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫ<EFBFBD><D2AA><EFBFBD>»<EFBFBD><C2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
||
Exit;
|
||
Order_Sub.DisableControls;
|
||
with Order_Sub do
|
||
begin
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
Edit;
|
||
if Trim(Order_Sub.fieldbyname('ZICost').AsString) <> '' then
|
||
begin
|
||
if Trim(BZ.Text) = '$' then
|
||
begin
|
||
FieldByName('BaoJia').Value := SSWR(Order_Sub.fieldbyname('ZICost').Value * StrtoFloat(FXS) / StrtoFloat(HuiLv.Text));
|
||
FieldByName('HeSuanStatus').Value := '<27>Ѻ<EFBFBD><D1BA><EFBFBD>';
|
||
end
|
||
else
|
||
begin
|
||
FieldByName('BaoJia').Value := SSWR(Order_Sub.fieldbyname('ZICost').Value * StrtoFloat(FXS));
|
||
FieldByName('HeSuanStatus').Value := '<27>Ѻ<EFBFBD><D1BA><EFBFBD>';
|
||
end;
|
||
end
|
||
else
|
||
begin
|
||
FieldByName('HeSuanStatus').Value := Null;
|
||
end;
|
||
Post;
|
||
Next;
|
||
end;
|
||
end;
|
||
Order_Sub.EnableControls;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmZHDJInPut.BZChange(Sender: TObject);
|
||
var
|
||
FReal: Double;
|
||
FXS: string;
|
||
begin
|
||
//if Key=#13 then
|
||
begin
|
||
if Order_Sub.IsEmpty then
|
||
Exit;
|
||
if Trim(BZ.Text) = '$' then
|
||
begin
|
||
if Trim(HuiLv.Text) = '' then
|
||
Exit;
|
||
if TryStrToFloat(HuiLv.Text, FReal) = False then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD>ʷǷ<CAB7><C7B7><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
end;
|
||
FXS := Trim(XS.Text);
|
||
if Trim(FXS) = '' then
|
||
begin
|
||
FXS := '1';
|
||
end;
|
||
if TryStrToFloat(FXS, FReal) = False then
|
||
begin
|
||
Application.MessageBox('ϵ<><CFB5><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
Order_Sub.DisableControls;
|
||
with Order_Sub do
|
||
begin
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
Edit;
|
||
if Trim(Order_Sub.fieldbyname('ZICost').AsString) <> '' then
|
||
begin
|
||
if Trim(BZ.Text) = '$' then
|
||
begin
|
||
FieldByName('BaoJia').Value := SSWR(Order_Sub.fieldbyname('ZICost').Value * StrtoFloat(FXS) / StrtoFloat(HuiLv.Text));
|
||
FieldByName('HeSuanStatus').Value := '<27>Ѻ<EFBFBD><D1BA><EFBFBD>';
|
||
end
|
||
else
|
||
begin
|
||
FieldByName('BaoJia').Value := SSWR(Order_Sub.fieldbyname('ZICost').Value * StrtoFloat(FXS));
|
||
FieldByName('HeSuanStatus').Value := '<27>Ѻ<EFBFBD><D1BA><EFBFBD>';
|
||
end;
|
||
end
|
||
else
|
||
begin
|
||
FieldByName('HeSuanStatus').Value := Null;
|
||
end;
|
||
Post;
|
||
Next;
|
||
end;
|
||
end;
|
||
Order_Sub.EnableControls;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmZHDJInPut.YWYBtnClick(Sender: TObject);
|
||
begin
|
||
with ADOTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from KH_Main where isnull(KHNameJC,'''')=''' + Trim(KHName.Text) + '''');
|
||
sql.add(' and isnull(KHFlag,'''')=''' + Trim('KH') + ''' and isnull(Valid,'''')=''Y'' ');
|
||
Open;
|
||
end;
|
||
if ADOTemp.IsEmpty = False then
|
||
begin
|
||
if Trim(canshu2) <> '<27><>Ȩ<EFBFBD><C8A8>' then
|
||
begin
|
||
Exit;
|
||
end;
|
||
end;
|
||
try
|
||
frmInfoBtn := TfrmInfoBtn.Create(Application);
|
||
with frmInfoBtn do
|
||
begin
|
||
FSql := 'select XSInfo=UserName from SY_User where USERID<>''ADMIN'' ';
|
||
if ShowModal = 1 then
|
||
begin
|
||
YWY.Text := Trim(FXSInfo);
|
||
end;
|
||
end;
|
||
finally
|
||
frmInfoBtn.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmZHDJInPut.KHNameBtnClick(Sender: TObject);
|
||
begin
|
||
try
|
||
frmKHListSelJJ := TfrmKHListSelJJ.Create(Application);
|
||
with frmKHListSelJJ do
|
||
begin
|
||
frmKHListSelJJ.canshu2 := Trim(Self.canshu2);
|
||
if ShowModal = 1 then
|
||
begin
|
||
Self.KHName.Text := Trim(frmKHListSelJJ.CDS_HZ.fieldbyname('KHNameJC').AsString);
|
||
Self.KHName.TxtCode := Trim(frmKHListSelJJ.CDS_HZ.fieldbyname('KHNo').AsString);
|
||
Self.GuoJia.Text := Trim(frmKHListSelJJ.CDS_HZ.fieldbyname('KHQuYu').AsString);
|
||
Self.YWY.Text := Trim(frmKHListSelJJ.CDS_HZ.fieldbyname('YWY').AsString);
|
||
Self.LiDan.Text := Trim(frmKHListSelJJ.CDS_HZ.fieldbyname('LiDan').AsString);
|
||
end;
|
||
end;
|
||
finally
|
||
frmKHListSelJJ.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmZHDJInPut.Tv1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||
var
|
||
Str: string;
|
||
begin
|
||
if Order_Sub.IsEmpty then
|
||
begin
|
||
KHGY.Text := '';
|
||
end
|
||
else
|
||
begin
|
||
KHGY.Text := Order_Sub.fieldbyname('ZIGY').AsString;
|
||
|
||
Str := '<27>沼<EFBFBD><E6B2BC><EFBFBD>ƣ<EFBFBD>' + Order_Sub.fieldbyname('MianBuName').AsString + #13;
|
||
Str := Str + '<27>沼<EFBFBD><E6B2BC><EFBFBD>ţ<EFBFBD>' + Order_Sub.fieldbyname('MianBu').AsString + #13;
|
||
Str := Str + '<27>м<EFBFBD><D0BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƣ<EFBFBD>' + Order_Sub.fieldbyname('ZhongJianCName').AsString + #13;
|
||
Str := Str + '<27>м<EFBFBD><D0BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ţ<EFBFBD>' + Order_Sub.fieldbyname('ZhongJianC').AsString + #13;
|
||
Str := Str + '<27>ײ<EFBFBD><D7B2><EFBFBD><EFBFBD>ƣ<EFBFBD>' + Order_Sub.fieldbyname('DiBuName').AsString + #13;
|
||
Str := Str + '<27>ײ<EFBFBD><D7B2><EFBFBD><EFBFBD>ţ<EFBFBD>' + Order_Sub.fieldbyname('DiBu').AsString;
|
||
Label6.Caption := Str;
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmZHDJInPut.KHGYChange(Sender: TObject);
|
||
begin
|
||
if Order_Sub.IsEmpty then
|
||
Exit;
|
||
with Order_Sub do
|
||
begin
|
||
Edit;
|
||
FieldByName('ZIGY').Value := KHGY.Text;
|
||
Post;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmZHDJInPut.N1Click(Sender: TObject);
|
||
begin
|
||
SelOKNo(Order_Sub, True);
|
||
end;
|
||
|
||
procedure TfrmZHDJInPut.N2Click(Sender: TObject);
|
||
begin
|
||
SelOKNo(Order_Sub, False);
|
||
end;
|
||
|
||
procedure TfrmZHDJInPut.N3Click(Sender: TObject);
|
||
begin
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
||
Exit;
|
||
with ADOTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from ZH_KH_DJ_CP where ZCID=''' + Trim(Order_Sub.fieldbyname('ZCID').AsString) + '''');
|
||
Open;
|
||
end;
|
||
if ADOTemp.IsEmpty then
|
||
begin
|
||
Order_Sub.Delete;
|
||
Exit;
|
||
end;
|
||
try
|
||
ADOCmd.Connection.BeginTrans;
|
||
Order_Sub.DisableControls;
|
||
with Order_Sub do
|
||
begin
|
||
//First;
|
||
// while Order_Main.Locate('SSel',True,[]) do
|
||
begin
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add(' UPdate ZH_KH_DJ_CP Set DelTime=getdate(),DelerCode=''' + Trim(DCode) + ''',Deler=''' + Trim(DName) + ''', Valid=''N'' ');
|
||
sql.Add(' where ZCID=''' + Trim(Order_Sub.fieldbyname('ZCID').AsString) + '''');
|
||
ExecSQL;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('Update ZH_CP_Info_KC Set GGQty=1 ');
|
||
sql.Add(' where DYID=''' + Trim(Order_Sub.fieldbyname('DYID').AsString) + ''' and isnull(KWID,'''')<>'''' ');
|
||
ExecSQL;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('Update ZH_KH_DJ Set DJYang=(select Count(*) from ZH_KH_DJ_CP A where A.ZDID=ZH_KH_DJ.ZDID and A.LeiBie=''<27>Ǽ<EFBFBD><C7BC><EFBFBD>'' and A.Valid=''Y'' )');
|
||
sql.Add(',NaYang=(select Count(*) from ZH_KH_DJ_CP A where A.ZDID=ZH_KH_DJ.ZDID and A.LeiBie=''<27><><EFBFBD><EFBFBD>'' and A.Valid=''Y'' )');
|
||
sql.Add(' where ZDID=''' + Trim(Order_Sub.fieldbyname('ZDID').AsString) + '''');
|
||
ExecSQL;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('Update ZH_KH_DJ Set XunYang=(select Count(*) from ZH_KH_DJ_CP A where A.ZDID=ZH_KH_DJ.ZDID and A.Valid=''Y'' )');
|
||
sql.Add(' where ZDID=''' + Trim(Order_Sub.fieldbyname('ZDID').AsString) + '''');
|
||
ExecSQL;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('Update ZH_CP_Info Set KHNameHZ=dbo.F_Get_HZStr(ZIID,''KHNaYang'')');
|
||
sql.Add(' where ZIID=''' + Trim(Order_Sub.fieldbyname('ZDID').AsString) + '''');
|
||
ExecSQL;
|
||
end;
|
||
//Order_Sub.Delete;
|
||
end;
|
||
end;
|
||
Order_Sub.EnableControls;
|
||
ADOCmd.Connection.CommitTrans;
|
||
Order_Sub.Delete;
|
||
except
|
||
ADOCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD>쳣<EFBFBD><ECB3A3>', '<27><>ʾ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmZHDJInPut.TBPrtBJClick(Sender: TObject);
|
||
var
|
||
fPrintFile, Txt, fImagePath, maxno: string;
|
||
i, j: Integer;
|
||
Moudle: THandle;
|
||
Makebar: TMakebar;
|
||
Mixtext: TMixtext;
|
||
begin
|
||
if Trim(FMainId) = '' then
|
||
begin
|
||
Application.MessageBox('û<>б<EFBFBD><D0B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD><EFBFBD>ܴ<EFBFBD>ӡ!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
with ADOTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from ZH_KH_DJ_CP where ZDId=''' + Trim(Order_Sub.fieldbyname('ZDId').AsString) + '''');
|
||
Open;
|
||
end;
|
||
if ADOTemp.IsEmpty then
|
||
begin
|
||
Application.MessageBox('û<>б<EFBFBD><D0B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD><EFBFBD>ܴ<EFBFBD>ӡ!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
RM1.PreviewButtons := [pbZoom, pbLoad, pbSave, pbPrint, pbFind, pbPageSetup, pbExit, pbSaveToXLS, pbExport, pbNavigator];
|
||
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\<5C>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD>۵<EFBFBD>.rmf';
|
||
if FileExists(fPrintFile) = False then
|
||
begin
|
||
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + ExtractFilePath(Application.ExeName) + 'Report\<5C>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD>۵<EFBFBD>.rmf'), '<27><>ʾ', 0);
|
||
exit;
|
||
end;
|
||
with ADOTemp do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add(' select A.*,B.*,B.Note ZNote ');
|
||
sql.Add(' from ZH_KH_DJ_CP A');
|
||
sql.Add(' inner join ZH_KH_DJ B on B.ZDId=A.ZDID');
|
||
sql.Add(' where A.ZDId=''' + Trim(Order_Sub.fieldbyname('ZDId').AsString) + '''');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOTemp, CDS_PRT);
|
||
SInitCDSData20(ADOTemp, CDS_PRT);
|
||
try
|
||
Moudle := LoadLibrary('MakeQRBarcode.dll');
|
||
@Makebar := GetProcAddress(Moudle, 'Make');
|
||
@Mixtext := GetProcAddress(Moudle, 'MixText');
|
||
Txt := Trim(CDS_PRT.fieldbyname('ZDId').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><CEAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
|
||
exit;
|
||
end;
|
||
RMVariables['QRBARCODE'] := fImagePath;
|
||
RM1.LoadFromFile(fPrintFile);
|
||
RM1.ShowReport;
|
||
//RM1.PrintReport;
|
||
end;
|
||
|
||
procedure TfrmZHDJInPut.LiDanBtnClick(Sender: TObject);
|
||
begin
|
||
with ADOTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from KH_Main where isnull(KHNameJC,'''')=''' + Trim(KHName.Text) + '''');
|
||
sql.add(' and isnull(KHFlag,'''')=''' + Trim('KH') + ''' and isnull(Valid,'''')=''Y'' ');
|
||
Open;
|
||
end;
|
||
if ADOTemp.IsEmpty = False then
|
||
begin
|
||
if Trim(canshu2) <> '<27><>Ȩ<EFBFBD><C8A8>' then
|
||
begin
|
||
Exit;
|
||
end;
|
||
end;
|
||
try
|
||
frmInfoBtn := TfrmInfoBtn.Create(Application);
|
||
with frmInfoBtn do
|
||
begin
|
||
FSql := 'select XSInfo=UserName from SY_User where USERID<>''ADMIN'' ';
|
||
if ShowModal = 1 then
|
||
begin
|
||
LiDan.Text := Trim(FXSInfo);
|
||
end;
|
||
end;
|
||
finally
|
||
frmInfoBtn.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmZHDJInPut.v1Column5PropertiesEditValueChanged(Sender: TObject);
|
||
var
|
||
mvalue: string;
|
||
begin
|
||
mvalue := TcxTextEdit(Sender).EditingText;
|
||
with Order_Sub do
|
||
begin
|
||
Edit;
|
||
if Trim(mvalue) = '' then
|
||
begin
|
||
FieldByName('BaoJiaYW').Value := Null;
|
||
if Trim(fieldbyname('HeSuanStatus').AsString) = '' then
|
||
begin
|
||
FieldByName('BaoJia').Value := Null;
|
||
end;
|
||
end
|
||
else
|
||
begin
|
||
FieldByName('BaoJiaYW').Value := mvalue;
|
||
if Trim(fieldbyname('BaoJia').AsString) = '' then
|
||
begin
|
||
FieldByName('BaoJia').Value := mvalue;
|
||
end
|
||
else
|
||
begin
|
||
if Trim(fieldbyname('HeSuanStatus').AsString) = '' then
|
||
begin
|
||
FieldByName('BaoJia').Value := mvalue;
|
||
end;
|
||
end;
|
||
end;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmZHDJInPut.v1BaoJiaCustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
||
var
|
||
id, id10: Integer;
|
||
begin
|
||
id := TV1.GetColumnByFieldName('HeSuanStatus').Index;
|
||
id10 := TV1.GetColumnByFieldName('BaoJia').Index;
|
||
if AViewInfo.GridRecord.Values[id] = null then
|
||
begin
|
||
if AViewInfo.GridRecord.Values[id10] <> null then
|
||
begin
|
||
if AViewInfo.GridRecord.Values[id10] <> 0 then
|
||
begin
|
||
ACanvas.Brush.Color := clRed;
|
||
end;
|
||
end;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmZHDJInPut.v1Column3CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
||
var
|
||
id: Integer;
|
||
begin
|
||
id := TV1.GetColumnByFieldName('LeiBie').Index; //;-TV1.GroupedItemCount;
|
||
if Trim(AViewInfo.GridRecord.Values[id]) = '<27><><EFBFBD>ߵ<EFBFBD><DFB5><EFBFBD>' then
|
||
begin
|
||
ACanvas.Brush.Color := clSkyBlue;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmZHDJInPut.Tv1DblClick(Sender: TObject);
|
||
begin
|
||
if Order_Sub.IsEmpty then
|
||
Exit;
|
||
|
||
if Copy(Trim(Order_Sub.fieldbyname('ZIID').AsString), 1, 1) = '2' then
|
||
begin
|
||
|
||
with ADOTemp do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
SQL.Add('select A.MLID ');
|
||
sql.Add(' from ML_Manage A ');
|
||
sql.Add(' left join Image_Info B on B.TJML=A.TJML ');
|
||
sql.Add(' left join Image_File E on B.IMID=E.IMID ');
|
||
sql.Add(' left join BP_DY C on C.TFID=B.IMID and C.MLID=A.MLID');
|
||
sql.Add(' left join BP_DY D on D.TFID=A.PTID and D.MLID=A.MLID');
|
||
sql.Add(' where isnull(A.MLType,'''')=''<27>̽<EFBFBD><CCBD><EFBFBD><EFBFBD><EFBFBD>'' and B.WBID=''' + Trim(Order_Sub.fieldbyname('ZIID').AsString) + '''');
|
||
Open;
|
||
end;
|
||
|
||
try
|
||
frmMLManage_LRTJ2 := TfrmMLManage_LRTJ2.Create(Application);
|
||
with frmMLManage_LRTJ2 do
|
||
begin
|
||
FCYID := Trim(Self.ADOTemp.fieldbyname('MLID').AsString);
|
||
FGYName := '<27>̽<EFBFBD>';
|
||
ToolBar3.Enabled := false;
|
||
Panel1.Enabled := false;
|
||
ToolBar4.Enabled := false;
|
||
Panel39.Enabled := false;
|
||
Panel7.Visible := false;
|
||
Button2.Visible := false;
|
||
Button3.Visible := false;
|
||
Panel10.Visible := false;
|
||
if ShowModal = 1 then
|
||
begin
|
||
|
||
end;
|
||
end;
|
||
finally
|
||
frmMLManage_LRTJ2.Free;
|
||
end;
|
||
end
|
||
else
|
||
begin
|
||
try
|
||
frmZHCPInPut := TfrmZHCPInPut.Create(Application);
|
||
with frmZHCPInPut do
|
||
begin
|
||
PState := 1;
|
||
FMainId := Trim(Order_Sub.fieldbyname('ZIID').AsString);
|
||
TBSave.Visible := true;
|
||
if ShowModal = 1 then
|
||
begin
|
||
//InitGrid();
|
||
end;
|
||
end;
|
||
finally
|
||
frmZHCPInPut.Free;
|
||
end;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmZHDJInPut.Button1Click(Sender: TObject);
|
||
var
|
||
FZIID, FLeiBie, FZIIDYS, fsj: string;
|
||
begin
|
||
frmZHCPList_BJCX := TfrmZHCPList_BJCX.create(self);
|
||
with frmZHCPList_BJCX do
|
||
begin
|
||
if ShowModal = 1 then
|
||
begin
|
||
FZIID := Trim(Order_Main.fieldbyname('ZIID').AsString);
|
||
with ADOTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from ZH_CP_Info where ZIID=''' + Trim(FZIID) + '''');
|
||
Open;
|
||
end;
|
||
FZIIDYS := Trim(ADOTemp.fieldbyname('ZIIDYS').AsString);
|
||
if Order_Sub.IsEmpty then
|
||
begin
|
||
FLeiBie := '<27>Ǽ<EFBFBD><C7BC><EFBFBD>';
|
||
end
|
||
else
|
||
begin
|
||
FLeiBie := Trim(Order_Sub.fieldbyname('LeiBie').AsString);
|
||
end;
|
||
with ADOTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select A.*,ZIGYYS=B.ZIGY ');
|
||
sql.Add(' ,ImageFileTP=(select ImageFile from Image_Info B inner join Image_File C on B.IMID=C.IMID ');
|
||
sql.Add(' where B.WBID=A.ZIID and B.IMNO=''ͼƬ'' and B.Valid=''Y'' and C.Valid=''Y'' and C.IFType=''С'' )');
|
||
sql.Add(',GS=(select Sum(GGQty) from ZH_CP_Info_KC KC where KC.ZIID=A.ZIID )');
|
||
sql.Add(',DYID=(select Top 1 DYID from ZH_CP_Info_KC KC where KC.ZIID=A.ZIID )');
|
||
sql.Add(' from ZH_CP_Info A ');
|
||
sql.Add(' inner join ZH_CP_Info B on A.ZIIDYS=B.ZIID ');
|
||
sql.Add(' where A.ZIID=''' + Trim(FZIID) + '''');
|
||
Open;
|
||
end;
|
||
with Order_Sub do
|
||
begin
|
||
if Locate('ZIID', Trim(FZIID), []) = True then
|
||
begin
|
||
DYID.Text := '';
|
||
DYID.Hint := '';
|
||
application.MessageBox('<27>ѵǼ<D1B5>,<2C><><EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD><D8B8>Ǽ<EFBFBD>', '<27><>ʾ');
|
||
Exit;
|
||
end;
|
||
Append;
|
||
FieldByName('DYID').Value := Trim(ADOTemp.fieldbyname('DYID').AsString);
|
||
FieldByName('ZIID').Value := Trim(FZIID);
|
||
FieldByName('ZIIDYS').Value := Trim(FZIIDYS);
|
||
FieldByName('ZIName').Value := ADOTemp.fieldbyname('ZIName').Value;
|
||
FieldByName('ZIMF').Value := ADOTemp.fieldbyname('ZIMF').Value;
|
||
FieldByName('ZIKZ').Value := ADOTemp.fieldbyname('ZIKZ').Value;
|
||
FieldByName('ZICF').Value := ADOTemp.fieldbyname('ZICF').Value;
|
||
FieldByName('ZIGY').Value := ADOTemp.fieldbyname('ZIGY').Value;
|
||
FieldByName('ZICL').Value := ADOTemp.fieldbyname('ZICL').Value;
|
||
FieldByName('GS').Value := ADOTemp.fieldbyname('GS').Value;
|
||
FieldByName('ZICost').Value := ADOTemp.fieldbyname('ZICost').Value;
|
||
FieldByName('ImageFileTP').Value := ADOTemp.fieldbyname('ImageFileTP').Value;
|
||
FieldByName('ZIGYYS').Value := ADOTemp.fieldbyname('ZIGY').Value;
|
||
FieldByName('LeiBie').Value := Trim(FLeiBie);
|
||
FieldByName('ZICost').Value := ADOTemp.fieldbyname('ZICost').Value;
|
||
Post;
|
||
end;
|
||
KHGY.Text := Trim(ADOTemp.fieldbyname('ZIGY').AsString);
|
||
end;
|
||
free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmZHDJInPut.Tv1ZIMFPropertiesChange(Sender: TObject);
|
||
var
|
||
Centimeters, Inches: Double;
|
||
Inch, ARecordIndex: Integer;
|
||
begin
|
||
Centimeters := StrToFloat(VarToStr(Tv1ZIMF.EditValue));
|
||
Inches := Centimeters * 0.393701;
|
||
Inch := strtoint(FormatFloat('0.00', Inches));
|
||
Order_Sub.FieldByName('ZIInchMF').Value := IntToStr(Inch - 1) + '"-' + IntToStr(Inch) + '"';
|
||
end;
|
||
|
||
end.
|
||
|