1499 lines
48 KiB
ObjectPascal
1499 lines
48 KiB
ObjectPascal
![]() |
unit U_CPDBAO;
|
|||
|
|
|||
|
interface
|
|||
|
|
|||
|
uses
|
|||
|
Windows, Messages, strutils, SysUtils, Variants, Classes, Graphics, Controls,
|
|||
|
Forms, Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData,
|
|||
|
cxDataStorage, cxEdit, DB, cxDBData, cxGridLevel, cxGridCustomTableView,
|
|||
|
cxGridTableView, cxGridDBTableView, cxClasses, cxControls, cxGridCustomView,
|
|||
|
cxGrid, StdCtrls, cxContainer, cxTextEdit, cxCurrencyEdit, BtnEdit, ExtCtrls,
|
|||
|
ComCtrls, ToolWin, DBClient, ADODB, MovePanel, Buttons, Menus,
|
|||
|
cxLookAndFeelPainters, cxButtons, RM_Common, RM_Class, RM_GridReport,
|
|||
|
RM_System, RM_Dataset, cxCheckBox, MMSystem, cxLookAndFeels, cxNavigator,
|
|||
|
dxSkinsCore, dxSkinBlack, dxSkinBlue, dxSkinBlueprint, dxSkinCaramel,
|
|||
|
dxSkinCoffee, dxSkinDarkRoom, dxSkinDarkSide, dxSkinDevExpressDarkStyle,
|
|||
|
dxSkinDevExpressStyle, dxSkinFoggy, dxSkinGlassOceans, dxSkinHighContrast,
|
|||
|
dxSkiniMaginary, dxSkinLilian, dxSkinLiquidSky, dxSkinLondonLiquidSky,
|
|||
|
dxSkinMcSkin, dxSkinMetropolis, dxSkinMetropolisDark, dxSkinMoneyTwins,
|
|||
|
dxSkinOffice2007Black, dxSkinOffice2007Blue, dxSkinOffice2007Green,
|
|||
|
dxSkinOffice2007Pink, dxSkinOffice2007Silver, dxSkinOffice2010Black,
|
|||
|
dxSkinOffice2010Blue, dxSkinOffice2010Silver, dxSkinOffice2013DarkGray,
|
|||
|
dxSkinOffice2013LightGray, dxSkinOffice2013White, dxSkinPumpkin, dxSkinSeven,
|
|||
|
dxSkinSevenClassic, dxSkinSharp, dxSkinSharpPlus, dxSkinSilver,
|
|||
|
dxSkinSpringTime, dxSkinStardust, dxSkinSummer2008, dxSkinTheAsphaltWorld,
|
|||
|
dxSkinsDefaultPainters, dxSkinValentine, dxSkinVS2010, dxSkinWhiteprint,
|
|||
|
dxSkinXmas2008Blue, dxSkinscxPCPainter;
|
|||
|
|
|||
|
type
|
|||
|
TfrmCPDBao = class(TForm)
|
|||
|
ToolBar1: TToolBar;
|
|||
|
TBClose: TToolButton;
|
|||
|
Panel1: TPanel;
|
|||
|
PHYG: TBtnEditA;
|
|||
|
defstr2: TComboBox;
|
|||
|
Label16: TLabel;
|
|||
|
Label15: TLabel;
|
|||
|
packNo: TcxCurrencyEdit;
|
|||
|
Label14: TLabel;
|
|||
|
Label1: TLabel;
|
|||
|
Panel2: TPanel;
|
|||
|
cxGrid2: TcxGrid;
|
|||
|
TV2: TcxGridDBTableView;
|
|||
|
cxGridDBColumn1: TcxGridDBColumn;
|
|||
|
cxGridDBColumn2: TcxGridDBColumn;
|
|||
|
cxGridDBColumn3: TcxGridDBColumn;
|
|||
|
cxGridDBColumn4: TcxGridDBColumn;
|
|||
|
cxGridDBColumn5: TcxGridDBColumn;
|
|||
|
cxGridDBColumn6: TcxGridDBColumn;
|
|||
|
cxGridDBColumn7: TcxGridDBColumn;
|
|||
|
cxGridLevel1: TcxGridLevel;
|
|||
|
ADOQueryMain: TADOQuery;
|
|||
|
ADOQueryCmd: TADOQuery;
|
|||
|
CDSMJID: TClientDataSet;
|
|||
|
DataSource2: TDataSource;
|
|||
|
SmNO: TEdit;
|
|||
|
ADOQueryTmp: TADOQuery;
|
|||
|
V2Column1: TcxGridDBColumn;
|
|||
|
kcKw: TBtnEditA;
|
|||
|
Label5: TLabel;
|
|||
|
MovePanel1: TMovePanel;
|
|||
|
Edit2: TEdit;
|
|||
|
Button4: TButton;
|
|||
|
Label2: TLabel;
|
|||
|
cxStyleRepository1: TcxStyleRepository;
|
|||
|
cxStyle1: TcxStyle;
|
|||
|
cxStyle2: TcxStyle;
|
|||
|
cxStyle_gridRow: TcxStyle;
|
|||
|
cxStyle_gridFoot: TcxStyle;
|
|||
|
cxStyle_gridHead: TcxStyle;
|
|||
|
cxStyle_gridGroupBox: TcxStyle;
|
|||
|
cxStyle_yellow: TcxStyle;
|
|||
|
cxStyle_Red: TcxStyle;
|
|||
|
cxStyle_fontBlack: TcxStyle;
|
|||
|
cxStyle_fontclFuchsia: TcxStyle;
|
|||
|
cxStyle_fontclPurple: TcxStyle;
|
|||
|
cxStyle_fontclGreen: TcxStyle;
|
|||
|
cxStyle_fontclBlue: TcxStyle;
|
|||
|
cxStyle_fontclTeal: TcxStyle;
|
|||
|
cxStyle_fontclOlive: TcxStyle;
|
|||
|
ADOQuery1: TADOQuery;
|
|||
|
DataSource1: TDataSource;
|
|||
|
cxGrid3: TcxGrid;
|
|||
|
Tv3: TcxGridDBTableView;
|
|||
|
cxGridLevel2: TcxGridLevel;
|
|||
|
Tv3Column1: TcxGridDBColumn;
|
|||
|
ADOQueryTm: TADOQuery;
|
|||
|
DSTm: TDataSource;
|
|||
|
baoNo: TEdit;
|
|||
|
BaoID: TEdit;
|
|||
|
Label3: TLabel;
|
|||
|
Label4: TLabel;
|
|||
|
V2BaoNO: TcxGridDBColumn;
|
|||
|
V2BaoID: TcxGridDBColumn;
|
|||
|
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;
|
|||
|
SpeedButton49: TSpeedButton;
|
|||
|
FileName: TcxButton;
|
|||
|
RMDB_Main: TRMDBDataSet;
|
|||
|
RM2: TRMGridReport;
|
|||
|
cxButton1: TcxButton;
|
|||
|
ComboBox1: TComboBox;
|
|||
|
V2Column2: TcxGridDBColumn;
|
|||
|
V2Column3: TcxGridDBColumn;
|
|||
|
Panel4: TPanel;
|
|||
|
ADOQueryPrint: TADOQuery;
|
|||
|
Label6: TLabel;
|
|||
|
BtnEditA1: TBtnEditA;
|
|||
|
v3Column1: TcxGridDBColumn;
|
|||
|
v3Column2: TcxGridDBColumn;
|
|||
|
v3Column3: TcxGridDBColumn;
|
|||
|
CDSTM: TClientDataSet;
|
|||
|
Panel5: TPanel;
|
|||
|
cxButton3: TcxButton;
|
|||
|
cxButton2: TcxButton;
|
|||
|
CDSSEL: TClientDataSet;
|
|||
|
cxGrid1: TcxGrid;
|
|||
|
TV4: TcxGridDBTableView;
|
|||
|
cxGridDBColumn8: TcxGridDBColumn;
|
|||
|
cxGridDBColumn9: TcxGridDBColumn;
|
|||
|
cxGridDBColumn10: TcxGridDBColumn;
|
|||
|
cxGridDBColumn11: TcxGridDBColumn;
|
|||
|
cxGridDBColumn12: TcxGridDBColumn;
|
|||
|
cxGridDBColumn13: TcxGridDBColumn;
|
|||
|
cxGridDBColumn14: TcxGridDBColumn;
|
|||
|
cxGridDBColumn15: TcxGridDBColumn;
|
|||
|
cxGridDBColumn16: TcxGridDBColumn;
|
|||
|
cxGridDBColumn17: TcxGridDBColumn;
|
|||
|
cxGridDBColumn18: TcxGridDBColumn;
|
|||
|
cxGridDBColumn19: TcxGridDBColumn;
|
|||
|
cxGridLevel3: TcxGridLevel;
|
|||
|
DSSEL: TDataSource;
|
|||
|
cxButton4: TcxButton;
|
|||
|
V2Column5: TcxGridDBColumn;
|
|||
|
V2Column4: TcxGridDBColumn;
|
|||
|
V4Column1: TcxGridDBColumn;
|
|||
|
V4Column2: TcxGridDBColumn;
|
|||
|
v3Column4: TcxGridDBColumn;
|
|||
|
check_Fbz: TCheckBox;
|
|||
|
Fbq: TBtnEditA;
|
|||
|
ComboBox2: TComboBox;
|
|||
|
check_bz: TCheckBox;
|
|||
|
BaoBq: TBtnEditA;
|
|||
|
cxButton5: TcxButton;
|
|||
|
cxButton6: TcxButton;
|
|||
|
v3Column5: TcxGridDBColumn;
|
|||
|
CheckBox1: TCheckBox;
|
|||
|
ComboBox3: TComboBox;
|
|||
|
v3Column6: TcxGridDBColumn;
|
|||
|
v3Column7: TcxGridDBColumn;
|
|||
|
cxButton7: TcxButton;
|
|||
|
v3Column8: TcxGridDBColumn;
|
|||
|
Label7: TLabel;
|
|||
|
PRTColor: TEdit;
|
|||
|
SOrddefstr1: TEdit;
|
|||
|
Label8: TLabel;
|
|||
|
PRTHX: TEdit;
|
|||
|
Label9: TLabel;
|
|||
|
mjstr4: TEdit;
|
|||
|
Label10: TLabel;
|
|||
|
MJXH: TEdit;
|
|||
|
Label11: TLabel;
|
|||
|
ComboBox4: TComboBox;
|
|||
|
Label12: TLabel;
|
|||
|
ADOQuery2: TADOQuery;
|
|||
|
PopupMenu1: TPopupMenu;
|
|||
|
N1: TMenuItem;
|
|||
|
N2: TMenuItem;
|
|||
|
TV4Column1: TcxGridDBColumn;
|
|||
|
TV4Column2: TcxGridDBColumn;
|
|||
|
TV2Column1: TcxGridDBColumn;
|
|||
|
TV2Column2: TcxGridDBColumn;
|
|||
|
Tv3Column2: TcxGridDBColumn;
|
|||
|
procedure FormDestroy(Sender: TObject);
|
|||
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
procedure TBCloseClick(Sender: TObject);
|
|||
|
procedure FormCreate(Sender: TObject);
|
|||
|
procedure SmNOKeyPress(Sender: TObject; var Key: Char);
|
|||
|
procedure FormShow(Sender: TObject);
|
|||
|
procedure TV2CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
|||
|
procedure kcKwBtnClick(Sender: TObject);
|
|||
|
procedure Button4Click(Sender: TObject);
|
|||
|
procedure baoNoKeyPress(Sender: TObject; var Key: Char);
|
|||
|
procedure baoNoClick(Sender: TObject);
|
|||
|
procedure SpeedButton1Click(Sender: TObject);
|
|||
|
procedure SpeedButton12Click(Sender: TObject);
|
|||
|
procedure SpeedButton49Click(Sender: TObject);
|
|||
|
procedure FileNameClick(Sender: TObject);
|
|||
|
procedure cxButton1Click(Sender: TObject);
|
|||
|
procedure baoNoExit(Sender: TObject);
|
|||
|
procedure BtnEditA1BtnClick(Sender: TObject);
|
|||
|
procedure cxButton3Click(Sender: TObject);
|
|||
|
procedure cxButton2Click(Sender: TObject);
|
|||
|
procedure cxButton4Click(Sender: TObject);
|
|||
|
procedure FbqBtnClick(Sender: TObject);
|
|||
|
procedure BaoBqBtnClick(Sender: TObject);
|
|||
|
procedure cxButton5Click(Sender: TObject);
|
|||
|
procedure cxButton6Click(Sender: TObject);
|
|||
|
procedure cxButton7Click(Sender: TObject);
|
|||
|
procedure N1Click(Sender: TObject);
|
|||
|
procedure N2Click(Sender: TObject);
|
|||
|
private
|
|||
|
Rolls: integer;
|
|||
|
procedure InitGrid();
|
|||
|
procedure InitMJID();
|
|||
|
function SaveRK(): Boolean;
|
|||
|
procedure QueryRk();
|
|||
|
procedure QueryTM();
|
|||
|
{ Private declarations }
|
|||
|
public
|
|||
|
{ Public declarations }
|
|||
|
end;
|
|||
|
|
|||
|
var
|
|||
|
frmCPDBao: TfrmCPDBao;
|
|||
|
newh: hwnd;
|
|||
|
|
|||
|
implementation
|
|||
|
|
|||
|
uses
|
|||
|
U_DataLink, U_Fun, U_ZDYHelp, U_OrderSelRK;
|
|||
|
{$R *.dfm}
|
|||
|
|
|||
|
procedure TfrmCPDBao.QueryTm();
|
|||
|
var
|
|||
|
FBaoID: string;
|
|||
|
begin
|
|||
|
|
|||
|
with ADOQueryTM do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select A.*,B.*,C.MPrtCodeName,C.orderNo as OrderNoM');
|
|||
|
sql.Add('from WFB_MJJY A ');
|
|||
|
sql.Add('inner join JYOrder_sub B on B.subID=A.subID ');
|
|||
|
sql.Add('inner join JYOrder_main C on C.mainID=A.MainID ');
|
|||
|
sql.Add('and isnull(A.BAOID,'''')='''' and A.mjstr2=''δ<><CEB4><EFBFBD><EFBFBD>'' and C.orderNo=' + quotedstr(trim(BtnEditA1.Text)));
|
|||
|
open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryTM, CDSTM);
|
|||
|
SInitCDSData20(ADOQueryTM, CDSTM);
|
|||
|
|
|||
|
//if CDSMJID.IsEmpty then
|
|||
|
// exit;
|
|||
|
// if CDSMJID.fieldByName('SDefNote').AsString <> '' then
|
|||
|
// begin
|
|||
|
// application.MessageBox('<27>Ѵ<EFBFBD><D1B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
// exit;
|
|||
|
// end
|
|||
|
|
|||
|
if not CDSMJID.IsEmpty then
|
|||
|
begin
|
|||
|
Rolls := 0;
|
|||
|
with CDSMJID do
|
|||
|
begin
|
|||
|
DisableControls;
|
|||
|
first;
|
|||
|
while not eof do
|
|||
|
begin
|
|||
|
Rolls := Rolls + 1;
|
|||
|
next;
|
|||
|
end;
|
|||
|
EnableControls;
|
|||
|
end;
|
|||
|
end
|
|||
|
else
|
|||
|
SCreateCDS20(ADOQueryTM, CDSMJID);
|
|||
|
// SInitCDSData20(ADOQueryMain, CDSMJID);
|
|||
|
|
|||
|
with ADOQueryMain do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select A.*,B.* ,MPrtCodeName,C.orderNo as OrderNoM');
|
|||
|
sql.Add('from WFB_MJJY A ');
|
|||
|
sql.Add('inner join JYOrder_sub B on B.subID=A.subID ');
|
|||
|
sql.Add('inner join JYOrder_main C on C.mainID=A.MainID ');
|
|||
|
sql.Add('and isnull(A.BAOID,'''')<>'''' and A.mjstr2=''δ<><CEB4><EFBFBD><EFBFBD>'' and C.orderNo=' + quotedstr(trim(BtnEditA1.Text)));
|
|||
|
SQL.Add('order by [dbo].[Get_ShuZi](BaoNo)');
|
|||
|
open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryMain, CDSSEL);
|
|||
|
SInitCDSData20(ADOQueryMain, CDSSEL);
|
|||
|
|
|||
|
if not CDSTM.IsEmpty then
|
|||
|
begin
|
|||
|
with ADOQuery1 do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.clear;
|
|||
|
sql.add('select isnull(max(cast(baoNo as int)),0)+1 as MaxBaoNo from WFB_MJJY ');
|
|||
|
sql.Add('where mainID=' + quotedstr(trim(CDSTM.fieldbyname('MainID').AsString)));
|
|||
|
open;
|
|||
|
end;
|
|||
|
// baoNo.text := ADOQuery1.fieldbyname('MaxBaoNo').AsString;
|
|||
|
if GetLSNo(ADOQueryTmp, FBaoID, 'BI', 'WFB_MJJY', 4, 1) = False then
|
|||
|
begin
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
BaoID.Text := trim(FBaoID);
|
|||
|
end;
|
|||
|
|
|||
|
SMNO.SetFocus;
|
|||
|
// with ADOQueryTM do
|
|||
|
// begin
|
|||
|
// close;
|
|||
|
// sql.Clear;
|
|||
|
// sql.Add('select A.*,B.*,C.MPrtCodeName,C.orderNo as OrderNoM');
|
|||
|
// sql.Add('from WFB_MJJY A ');
|
|||
|
// sql.Add('inner join JYOrder_sub B on B.subID=A.subID ');
|
|||
|
// sql.Add('inner join JYOrder_main C on C.mainID=A.MainID ');
|
|||
|
// sql.Add('and A.mjstr2=''δ<><CEB4><EFBFBD><EFBFBD>'' and C.orderNo=' + quotedstr(trim(BtnEditA1.Text)));
|
|||
|
// open;
|
|||
|
// end;
|
|||
|
// SCreateCDS20(ADOQueryTM, CDSTM);
|
|||
|
// SInitCDSData20(ADOQueryTM, CDSTM);
|
|||
|
//
|
|||
|
// SCreateCDS20(ADOQueryTM, CDSMJID);
|
|||
|
//// SInitCDSData20(ADOQueryMain,CDSMJID);
|
|||
|
// SCreateCDS20(ADOQueryTM, CDSSEL);
|
|||
|
//// SInitCDSData20(ADOQueryMain,CDSSEL);
|
|||
|
//
|
|||
|
// if not CDSTM.IsEmpty then
|
|||
|
// begin
|
|||
|
// with ADOQuery1 do
|
|||
|
// begin
|
|||
|
// close;
|
|||
|
// sql.clear;
|
|||
|
// sql.add('select isnull(max(cast(baoNo as int)),0)+1 as MaxBaoNo from WFB_MJJY ');
|
|||
|
// sql.Add('where mainID=' + quotedstr(trim(CDSTM.fieldbyname('MainID').AsString)));
|
|||
|
// open;
|
|||
|
// end;
|
|||
|
// baoNo.text := ADOQuery1.fieldbyname('MaxBaoNo').AsString;
|
|||
|
// if GetLSNo(ADOQueryTmp, FBaoID, 'BI', 'WFB_MJJY', 4, 1) = False then
|
|||
|
// begin
|
|||
|
// ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
// Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
|
|||
|
// Exit;
|
|||
|
// end;
|
|||
|
// BaoID.Text := trim(FBaoID);
|
|||
|
// end;
|
|||
|
//
|
|||
|
// SMNO.SetFocus;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPDBao.QueryRk();
|
|||
|
begin
|
|||
|
with ADOQuery1 do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select A.*,hC_ps=A.AordQty2,JY_ps=(select count(MainID) from WFB_MJJY X where X.APID=A.APID),');
|
|||
|
sql.Add('JY_Qty=(select sum(MJLen) from WFB_MJJY X where X.APID=A.APID), ');
|
|||
|
sql.Add('RK_RollNum=(select sum(SOrdQty1) from CK_BanCP_CR X where X.APID=A.APID and X.CRType=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>''),');
|
|||
|
sql.Add('RK_Qty=(select sum(MJLen) from CK_BanCP_CR X where X.APID=A.APID and X.CRType=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'') ');
|
|||
|
sql.Add('from JYOrder_sub_anPai A ');
|
|||
|
SQL.Add('WHERE exists(select MJID from WFB_MJJY X where X.APID=A.APID and X.MJID=' + quotedstr(trim(smNO.Text)));
|
|||
|
sql.Add(')');
|
|||
|
open;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
function TfrmCPDBao.SaveRK(): Boolean;
|
|||
|
var
|
|||
|
maxno: string;
|
|||
|
CRID: Integer;
|
|||
|
MaxCkNo, MaxCkSubNo: string;
|
|||
|
MhcTime: TdateTime;
|
|||
|
begin
|
|||
|
Result := false;
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
|
|||
|
try
|
|||
|
{with ADOQueryTmp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
SQL.add('Update CK_BanCP_CRID Set CRID=CRID+1');
|
|||
|
sql.Add('select * from CK_BanCP_CRID');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
CRID:=ADOQueryTmp.fieldbyname('CRID').AsInteger;
|
|||
|
if GetLSNo(ADOQueryTmp,MaxCkNo,'JR','CK_BanCP_CR',4,1)=False then
|
|||
|
begin
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
Application.MessageBox('ȡ<><C8A1>Ʒ<EFBFBD>ֿ<EFBFBD><D6BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ',0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from CK_BanCP_CR where 1<>1');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
mhcTime:=SGetServerDateTime(ADOQueryTmp);
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Append;
|
|||
|
FieldByName('MainId').Value:=Trim(ADOQueryMain.fieldbyname('MainId').AsString);
|
|||
|
FieldByName('SubId').Value:=Trim(ADOQueryMain.fieldbyname('SubId').AsString);
|
|||
|
FieldByName('C_Code').Value:=Trim(ADOQueryMain.fieldbyname('PRTCode').AsString);
|
|||
|
FieldByName('C_CodeName').Value:=Trim(ADOQueryMain.fieldbyname('PRTCodeName').AsString);
|
|||
|
//FieldByName('C_SPec').Value:=Trim(ADOQueryMain.fieldbyname('C_SPec').AsString);
|
|||
|
FieldByName('C_Color').Value:=Trim(ADOQueryMain.fieldbyname('PRTColor').AsString);
|
|||
|
FieldByName('APID').Value:=Trim(ADOQueryMain.fieldbyname('APID').AsString);
|
|||
|
FieldByName('MJID').Value:=Trim(ADOQueryMain.fieldbyname('MJId').AsString);
|
|||
|
FieldByName('mjxh').Value:=Trim(ADOQueryMain.fieldbyname('mjxh').AsString);
|
|||
|
FieldByName('BaoNo').Value:=Trim(BaoNo.Text);
|
|||
|
FieldByName('BaoID').Value:=Trim(BaoID.Text);
|
|||
|
|
|||
|
FieldByName('BCID').Value:=Trim(MaxCkNo);
|
|||
|
FieldByName('CRTime').Value:=FormatDateTime('yyyy-MM-dd',mhcTime);
|
|||
|
FieldByName('CRFlag').Value:='<27><><EFBFBD><EFBFBD>';
|
|||
|
FieldByName('CRType').Value:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
|||
|
FieldByName('CRID').Value:=CRID;
|
|||
|
FieldByName('KGQty').Value:=0;
|
|||
|
FieldByName('Qty').Value:=ADOQueryMain.fieldbyname('MJLen').Value;
|
|||
|
FieldByName('RollNum').Value:=1;
|
|||
|
FieldByName('QtyUnit').Value:=ADOQueryMain.fieldbyname('MJTypeOther').Value;
|
|||
|
FieldByName('CPType').Value:=ADOQueryMain.fieldbyname('MJType').Value;
|
|||
|
//FieldByName('Note').Value:=ADOQueryMain.fieldbyname('Note').Value;
|
|||
|
FieldByName('Filler').Value:=Trim(DName);
|
|||
|
FieldByName('FillTime').Value:=SGetServerDateTime(ADOQueryTmp);
|
|||
|
//fieldbyname('kcKw').Value:=GetKw(ADOQueryTmp,ADOQueryMain.fieldbyname('PRTCodeName').AsString,ADOQueryMain.fieldbyname('PRTColor').AsString);
|
|||
|
Post;
|
|||
|
end;
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from CK_BanCP_KC where 1<>1');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Append;
|
|||
|
FieldByName('CRID').Value:=CRID;
|
|||
|
FieldByName('BCID').Value:=Trim(MaxCkNo);
|
|||
|
FieldByName('CRTime').Value:=FormatDateTime('yyyy-MM-dd',mhcTime);
|
|||
|
FieldByName('CRType').Value:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
|||
|
FieldByName('CPType').Value:=ADOQueryMain.fieldbyname('MJType').Value;
|
|||
|
FieldByName('C_Code').Value:=Trim(ADOQueryMain.fieldbyname('PRTCode').AsString);
|
|||
|
FieldByName('C_CodeName').Value:=Trim(ADOQueryMain.fieldbyname('PRTCodeName').AsString);
|
|||
|
//FieldByName('C_SPec').Value:=Trim(ADOQueryMain.fieldbyname('C_SPec').AsString);
|
|||
|
FieldByName('C_Color').Value:=Trim(ADOQueryMain.fieldbyname('PRTColor').AsString);
|
|||
|
FieldByName('BaoNo').Value:=Trim(BaoNo.Text);
|
|||
|
FieldByName('BaoID').Value:=Trim(BaoID.Text);
|
|||
|
FieldByName('MJID').Value:=Trim(ADOQueryMain.fieldbyname('MJID').AsString);
|
|||
|
FieldByName('KCKGQty').Value:=0;
|
|||
|
FieldByName('KCQty').Value:=ADOQueryMain.fieldbyname('MJlen').Value;
|
|||
|
FieldByName('RollNum').Value:=1;
|
|||
|
FieldByName('KCQtyUnit').Value:=ADOQueryMain.fieldbyname('MJTypeOther').Value;
|
|||
|
FieldByName('mjxh').Value:=Trim(ADOQueryMain.fieldbyname('mjxh').AsString);
|
|||
|
//FieldByName('KCNote').Value:=ADOQueryMain.fieldbyname('Note').Value;
|
|||
|
//fieldbyname('kcKw').Value:=GetKw(ADOQueryTmp,ADOQueryMain.fieldbyname('PRTCodeName').AsString,ADOQueryMain.fieldbyname('PRTColor').AsString);
|
|||
|
Post;
|
|||
|
end; }
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('Update WFB_MJJY Set BaoNo=''' + trim(BaoNo.Text) + ''',BaoID=''' + trim(Baoid.text) + ''' where MJID=''' + Trim(ADOQueryMain.fieldbyname('MJID').AsString) + '''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
Result := true;
|
|||
|
except
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPDBao.InitGrid();
|
|||
|
begin
|
|||
|
with ADOQueryMain do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
SQL.Add('select A.*,B.*,C.MprtCodeName,C.orderNo as OrderNoM from WFB_MJJY A ');
|
|||
|
sql.add('inner join JYOrder_Sub B on B.SubId=A.SubId');
|
|||
|
sql.add('inner join JYOrder_Main C on C.maiNID=A.mainID');
|
|||
|
SQL.Add('where 1=2 ');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryMain, CDSMJID);
|
|||
|
SInitCDSData20(ADOQueryMain, CDSMJID);
|
|||
|
SCreateCDS20(ADOQueryMain, CDSSEL);
|
|||
|
SInitCDSData20(ADOQueryMain, CDSSEL);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPDBao.InitMJID();
|
|||
|
begin
|
|||
|
MovePanel1.Visible := false;
|
|||
|
|
|||
|
with ADOQueryMain do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
SQL.Add('select A.*,B.*,C.MprtCodeName,C.orderNo as OrderNoM from WFB_MJJY A ');
|
|||
|
sql.add('inner join JYOrder_Sub B on B.SubId=A.SubId');
|
|||
|
sql.add('inner join JYOrder_Main C on C.maiNID=A.mainID');
|
|||
|
sql.Add('where MJID=' + quotedstr(trim(SmNO.Text)));
|
|||
|
Open;
|
|||
|
if not IsEmpty then
|
|||
|
begin
|
|||
|
if trim(Fieldbyname('MJstr2').AsString) = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
|
|||
|
begin
|
|||
|
CDSMJID.Append;
|
|||
|
CDSMJID.FieldByName('SDefNote').Value := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
|||
|
CDSMJID.FieldByName('MJID').Value := trim(SmNO.Text);
|
|||
|
CDSMJID.Post;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
CDSMJID.Append;
|
|||
|
CDSMJID.FieldByName('SDefNote').Value := '<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>';
|
|||
|
CDSMJID.FieldByName('MJID').Value := trim(ADOQueryMain.Fieldbyname('MJID').AsString);
|
|||
|
// CDSMJID.FieldByName('CRID').Value:=trim(ADOQueryMain.Fieldbyname('CRID').AsString);
|
|||
|
CDSMJID.FieldByName('PRTCodeName').Value := trim(ADOQueryMain.Fieldbyname('PRTCodeName').AsString);
|
|||
|
CDSMJID.FieldByName('MPRTCodeName').Value := trim(ADOQueryMain.Fieldbyname('MPRTCodeName').AsString);
|
|||
|
CDSMJID.FieldByName('PRTColor').Value := trim(ADOQueryMain.Fieldbyname('PRTColor').AsString);
|
|||
|
CDSMJID.FieldByName('PRTHX').Value := trim(ADOQueryMain.Fieldbyname('PRTHX').AsString);
|
|||
|
CDSMJID.FieldByName('MJStr4').Value := trim(ADOQueryMain.Fieldbyname('MJStr4').AsString);
|
|||
|
CDSMJID.FieldByName('MJType').Value := trim(ADOQueryMain.Fieldbyname('MJType').AsString);
|
|||
|
CDSMJID.FieldByName('BaoNo').Value := trim(BaoNo.Text);
|
|||
|
CDSMJID.FieldByName('BaoID').Value := trim(BaoID.Text);
|
|||
|
CDSMJID.FieldByName('SOrdQty1').Value := 1;
|
|||
|
CDSMJID.FieldByName('MJLen').Value := ADOQueryMain.Fieldbyname('MJLen').AsFloat;
|
|||
|
CDSMJID.FieldByName('MJMaoZ').Value := ADOQueryMain.Fieldbyname('MJMaoZ').AsFloat;
|
|||
|
CDSMJID.FieldByName('MJQty3').Value := ADOQueryMain.Fieldbyname('MJQty3').AsFloat;
|
|||
|
CDSMJID.FieldByName('MJQty4').Value := ADOQueryMain.Fieldbyname('MJQty4').AsFloat;
|
|||
|
CDSMJID.FieldByName('MJTypeOther').Value := trim(ADOQueryMain.Fieldbyname('MJTypeOther').AsString);
|
|||
|
CDSMJID.FieldByName('mainID').Value := trim(ADOQueryMain.Fieldbyname('mainID').AsString);
|
|||
|
CDSMJID.FieldByName('subID').Value := trim(ADOQueryMain.Fieldbyname('subID').AsString);
|
|||
|
CDSMJID.Post;
|
|||
|
Rolls := Rolls + 1;
|
|||
|
end;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
CDSMJID.Append;
|
|||
|
CDSMJID.FieldByName('SDefNote').Value := '<27><><EFBFBD><EFBFBD><EFBFBD>벻<EFBFBD><EBB2BB><EFBFBD><EFBFBD>';
|
|||
|
CDSMJID.FieldByName('MJID').Value := trim(SmNO.Text);
|
|||
|
CDSMJID.Post;
|
|||
|
end;
|
|||
|
end;
|
|||
|
if trim(CDSMJID.FieldByName('SDefNote').AsString) <> '<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>' then
|
|||
|
begin
|
|||
|
MovePanel1.Visible := true;
|
|||
|
Edit2.Text := SmNO.Text;
|
|||
|
Label2.Caption := trim(CDSMJID.FieldByName('SDefNote').AsString);
|
|||
|
if FileExists(PChar(ExtractFilePath(Application.ExeName) + 'wav\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.wav')) then
|
|||
|
PlaySound(PChar(ExtractFilePath(Application.ExeName) + 'wav\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.wav'), 0, SND_ASYNC);
|
|||
|
CDSMJID.delete;
|
|||
|
end;
|
|||
|
if CDSTM.Locate('MJID', trim(smno.Text), []) then
|
|||
|
begin
|
|||
|
// application.MessageBox('AAAA','AAAAAAAA',0);
|
|||
|
CDSTM.Delete;
|
|||
|
tv2.Controller.EditingController.ShowEdit();
|
|||
|
tv3.Controller.EditingController.ShowEdit();
|
|||
|
end;
|
|||
|
if CheckBox1.Checked = true then
|
|||
|
begin
|
|||
|
if (Rolls = strtointdef(trim(ComboBox3.Text), 0)) and (strtointdef(trim(ComboBox3.Text), 0) > 0) then
|
|||
|
begin
|
|||
|
FileName.Click;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPDBao.FormDestroy(Sender: TObject);
|
|||
|
begin
|
|||
|
frmCPDBao := nil;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPDBao.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
begin
|
|||
|
//writeCxGrid(self.Caption+tv1.Name,Tv1,'<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
|
|||
|
writeCxGrid(self.Caption + Tv2.Name, Tv2, '<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
|
|||
|
writeCxGrid(self.Caption + Tv3.Name + '1', Tv3, '<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
|
|||
|
writeCxGrid(self.Caption + Tv4.Name, Tv4, '<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
|
|||
|
Action := cafree;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPDBao.TBCloseClick(Sender: TObject);
|
|||
|
begin
|
|||
|
close;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPDBao.FormCreate(Sender: TObject);
|
|||
|
begin
|
|||
|
Panel2.Align := alClient;
|
|||
|
//readCxGrid(self.Caption+tv1.Name,Tv1,'<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
|
|||
|
readCxGrid(self.Caption + Tv2.Name, Tv2, '<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
|
|||
|
readCxGrid(self.Caption + Tv3.Name + '1', Tv3, '<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
|
|||
|
readCxGrid(self.Caption + Tv4.Name, Tv4, '<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
|
|||
|
Rolls := 0;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPDBao.SmNOKeyPress(Sender: TObject; var Key: Char);
|
|||
|
begin
|
|||
|
if Key = #13 then
|
|||
|
begin
|
|||
|
if combobox4.Text = '<27><><EFBFBD><EFBFBD>ɫ' then
|
|||
|
begin
|
|||
|
with ADOQuery2 do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.clear;
|
|||
|
sql.add('select B.PRTCOLOR,MaxBaoNo=isnull(max(cast(baoNo as int)),0)+1 ');
|
|||
|
sql.add('from WFB_MJJY A ');
|
|||
|
sql.add('inner join JYOrder_Sub B on A.SubId=B.SubId ');
|
|||
|
sql.add('where A.MainId=' + quotedstr(trim(CDSTM.fieldbyname('MainID').AsString)));
|
|||
|
sql.add('and B.PRTColor=(select PRTColor from WFB_MJJY WM inner join JYOrder_Sub JS on WM.SubId=JS.SubId where WM.MJID=''' + trim(smno.Text) + ''')');
|
|||
|
open;
|
|||
|
end;
|
|||
|
if cdsmjid.IsEmpty = false then
|
|||
|
begin
|
|||
|
if self.ADOQuery2.FieldByName('prtcolor').asstring <> cdsmjid.FieldByName('prtcolor').AsString then
|
|||
|
begin
|
|||
|
MovePanel1.Visible := true;
|
|||
|
Edit2.Text := SmNO.Text;
|
|||
|
Label2.Caption := '<27><>ɫ<EFBFBD><C9AB>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD><EFBFBD>ܴ<EFBFBD><DCB4><EFBFBD><EFBFBD><EFBFBD>';
|
|||
|
smno.Text := '';
|
|||
|
smno.SetFocus;
|
|||
|
exit;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
baoNo.text := ADOQuery2.fieldbyname('MaxBaoNo').AsString;
|
|||
|
end;
|
|||
|
|
|||
|
if trim(BaoNo.Text) = '' then
|
|||
|
begin
|
|||
|
application.MessageBox('<27><><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>', '<27><>ʾ');
|
|||
|
exit;
|
|||
|
end;
|
|||
|
if trim(BaoID.Text) = '' then
|
|||
|
begin
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>벻<EFBFBD><EBB2BB>Ϊ<EFBFBD><CEAA>', '<27><>ʾ');
|
|||
|
exit;
|
|||
|
end;
|
|||
|
if CDSTM.IsEmpty then
|
|||
|
exit;
|
|||
|
if trim(smno.Text) = '' then
|
|||
|
exit;
|
|||
|
if CDSMJID.Locate('MJID', trim(smno.Text), []) then
|
|||
|
begin
|
|||
|
MovePanel1.Visible := true;
|
|||
|
Edit2.Text := SmNO.Text;
|
|||
|
Label2.Caption := '<27>˾<EFBFBD><CBBE><EFBFBD><EFBFBD>ظ<EFBFBD>ɨ<EFBFBD>裡';
|
|||
|
if FileExists(PChar(ExtractFilePath(Application.ExeName) + 'wav\<5C>ظ<EFBFBD>ɨ<EFBFBD><C9A8>.wav')) then
|
|||
|
PlaySound(PChar(ExtractFilePath(Application.ExeName) + 'wav\<5C>ظ<EFBFBD>ɨ<EFBFBD><C9A8>.wav'), 0, SND_ASYNC);
|
|||
|
smno.Text := '';
|
|||
|
smno.SetFocus;
|
|||
|
exit;
|
|||
|
end;
|
|||
|
if not CDSTM.Locate('MJID', trim(smno.Text), []) then
|
|||
|
begin
|
|||
|
with ADOQuery1 do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
SQL.Add('select A.*,B.*,C.MprtCodeName,C.OrderNO as orderNoM from WFB_MJJY A ');
|
|||
|
sql.add('inner join JYOrder_Sub B on B.SubId=A.SubId');
|
|||
|
sql.add('inner join JYOrder_Main C on C.maiNID=A.mainID');
|
|||
|
sql.Add('where MJID=' + quotedstr(trim(SmNO.Text)));
|
|||
|
Open;
|
|||
|
if isempty then
|
|||
|
begin
|
|||
|
MovePanel1.Visible := true;
|
|||
|
Edit2.Text := SmNO.Text;
|
|||
|
Label2.Caption := '<27>˾<EFBFBD><CBBE>Ŵ<EFBFBD><C5B4><EFBFBD><EFBFBD><EFBFBD>';
|
|||
|
if FileExists(PChar(ExtractFilePath(Application.ExeName) + 'wav\ɨ<><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.wav')) then
|
|||
|
PlaySound(PChar(ExtractFilePath(Application.ExeName) + 'wav\ɨ<><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.wav'), 0, SND_ASYNC);
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
if not CDSTM.Locate('orderNoM', trim(fieldbyname('OrderNoM').AsString), []) then
|
|||
|
begin
|
|||
|
MovePanel1.Visible := true;
|
|||
|
Edit2.Text := SmNO.Text;
|
|||
|
Label2.Caption := '<27>˾<EFBFBD><CBBE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
|||
|
if FileExists(PChar(ExtractFilePath(Application.ExeName) + 'wav\ɨ<><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.wav')) then
|
|||
|
PlaySound(PChar(ExtractFilePath(Application.ExeName) + 'wav\ɨ<><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.wav'), 0, SND_ASYNC);
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
if Fieldbyname('MJstr2').AsString <> 'δ<><CEB4><EFBFBD><EFBFBD>' then
|
|||
|
begin
|
|||
|
MovePanel1.Visible := true;
|
|||
|
Edit2.Text := SmNO.Text;
|
|||
|
Label2.Caption := fieldbyname('Mjstr2').AsString;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
if self.ADOQuery1.FieldByName('baoid').AsString <> '' then
|
|||
|
begin
|
|||
|
MovePanel1.Visible := true;
|
|||
|
Edit2.Text := SmNO.Text;
|
|||
|
Label2.Caption := '<27>˾<EFBFBD><CBBE>Ѵ<EFBFBD><D1B4><EFBFBD><EFBFBD><EFBFBD>';
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
initMJID();
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
smno.Text := '';
|
|||
|
smno.SetFocus;
|
|||
|
exit;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
initMJID();
|
|||
|
end;
|
|||
|
smno.Text := '';
|
|||
|
smno.SetFocus;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPDBao.FormShow(Sender: TObject);
|
|||
|
begin
|
|||
|
MovePanel1.Left := (Width - MovePanel1.Width) div 2;
|
|||
|
MovePanel1.top := (Height - MovePanel1.Height - 200) div 2;
|
|||
|
// InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPDBao.TV2CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
|||
|
var
|
|||
|
i: integer;
|
|||
|
begin
|
|||
|
i := tv2.GetColumnByFieldName('SDefNote').Index;
|
|||
|
if (AViewInfo.GridRecord.Values[i] <> '<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>') then
|
|||
|
ACanvas.Brush.Color := clred;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPDBao.kcKwBtnClick(Sender: TObject);
|
|||
|
begin
|
|||
|
try
|
|||
|
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
|||
|
with frmZDYHelp do
|
|||
|
begin
|
|||
|
flag := 'CPKWFlag';
|
|||
|
flagname := '<27><>λ<EFBFBD><CEBB>Ϣ';
|
|||
|
V1Name.Caption := '<27><>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>';
|
|||
|
V1Note.Caption := 'Ӣ<><D3A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
|||
|
// MainType:=Trim(DName);
|
|||
|
fnote := FALSE;
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
kcKw.Text := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmZDYHelp.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPDBao.Button4Click(Sender: TObject);
|
|||
|
begin
|
|||
|
MovePanel1.Visible := False;
|
|||
|
SmNO.SetFocus;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPDBao.baoNoKeyPress(Sender: TObject; var Key: Char);
|
|||
|
var
|
|||
|
FBaoID: string;
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPDBao.baoNoClick(Sender: TObject);
|
|||
|
var
|
|||
|
i: Integer;
|
|||
|
begin
|
|||
|
// Panel3.Visible:=True;
|
|||
|
{ 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 TfrmCPDBao.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 TfrmCPDBao.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 TfrmCPDBao.SpeedButton49Click(Sender: TObject);
|
|||
|
var
|
|||
|
FBaoID: string;
|
|||
|
begin
|
|||
|
if trim(TEdit(FindComponent(Trim(TSpeedButton(Sender).Hint))).Hint) <> '' then
|
|||
|
begin
|
|||
|
if GetLSNo(ADOQueryTmp, FBaoID, 'BI', 'WFB_MJJY', 4, 1) = False then
|
|||
|
begin
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
BaoID.Text := trim(FBaoID);
|
|||
|
end;
|
|||
|
Panel3.Visible := False;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPDBao.FileNameClick(Sender: TObject);
|
|||
|
var
|
|||
|
fPrintFile: string;
|
|||
|
Txt, fImagePath: string;
|
|||
|
Moudle: THandle;
|
|||
|
Makebar: TMakebar;
|
|||
|
Mixtext: TMixtext;
|
|||
|
FBaoID: string;
|
|||
|
i: Integer;
|
|||
|
begin
|
|||
|
if trim(BaoID.Text) = '' then
|
|||
|
begin
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>벻<EFBFBD><EBB2BB>δ<EFBFBD><CEB4>', '<27><>ʾ');
|
|||
|
exit;
|
|||
|
end;
|
|||
|
if CDSMJID.IsEmpty then
|
|||
|
exit;
|
|||
|
|
|||
|
with ADOQueryPrint do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add(' SELECT D.LBName,D.NLBName');
|
|||
|
sql.Add(' from WFB_MJJY A');
|
|||
|
sql.Add(' inner join JYOrder_Main D on D.MainID=A.MainID');
|
|||
|
SQL.Add('where MJID=''' + Trim(CDSMJID.fieldbyname('MJID').AsString) + '''');
|
|||
|
Open;
|
|||
|
if not ADOQueryPrint.IsEmpty then
|
|||
|
begin
|
|||
|
if Trim(ADOQueryPrint.fieldbyname('NLBName').AsString) = '' then
|
|||
|
begin
|
|||
|
application.MessageBox('û<><C3BB><EFBFBD><EFBFBD><EFBFBD>ð<EFBFBD><C3B0><EFBFBD>ǩ<EFBFBD><C7A9><EFBFBD><EFBFBD><EFBFBD>ܴ<EFBFBD><DCB4><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
try
|
|||
|
with CDSMJID do
|
|||
|
begin
|
|||
|
DisableControls;
|
|||
|
first;
|
|||
|
while not eof do
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('Update WFB_MJJY Set BaoNo=''' + trim(BaoNo.Text) + ''',BaoID=''' + trim(Baoid.text) + ''' where MJID=''' + Trim(CDSMJID.fieldbyname('MJID').AsString) + '''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
edit;
|
|||
|
fieldByName('Sflag').AsString := '2';
|
|||
|
fieldbyname('BaoNo').Value := trim(BaoNo.Text);
|
|||
|
fieldbyname('BaoID').Value := trim(BaoID.Text);
|
|||
|
post;
|
|||
|
next;
|
|||
|
end;
|
|||
|
EnableControls;
|
|||
|
end;
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
if FileExists(PChar(ExtractFilePath(Application.ExeName) + 'wav\<5C><>ȷ.wav')) then
|
|||
|
PlaySound(PChar(ExtractFilePath(Application.ExeName) + 'wav\<5C><>ȷ.wav'), 0, SND_ASYNC);
|
|||
|
except
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
if FileExists(PChar(ExtractFilePath(Application.ExeName) + 'wav\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.wav')) then
|
|||
|
PlaySound(PChar(ExtractFilePath(Application.ExeName) + 'wav\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.wav'), 0, SND_ASYNC);
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
|
|||
|
|
|||
|
{ if trim(BaoID.Text)='' then
|
|||
|
begin
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>벻<EFBFBD><EBB2BB>δ<EFBFBD><CEB4>','<27><>ʾ');
|
|||
|
exit;
|
|||
|
end; }
|
|||
|
with ADOQueryPrint do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add('select A.Baoid,A.BaoNo,A.MJTypeOther as QtyUnit,D.OrderNo,D.conNo,D.customerNoName,D.MprtCodeName,D.Mprtspec,D.OrdPerson1,D.MPRTKuanNO,D.LBName,D.NLBName,');
|
|||
|
sql.Add('PRTCodeName=DBO.F_Get_Order_SubStr(BaoID,''BNCodeName''),');
|
|||
|
sql.Add('PRTColor=DBO.F_Get_Order_SubStr(BaoID,''BNColor''),SOrddefstr1=DBO.F_Get_Order_SubStr(BaoID,''BNSOrddefstr1''),');
|
|||
|
sql.Add('SOrddefstr4=DBO.F_Get_Order_SubStr(BaoID,''BNSOrddefstr4''),PRtHX=DBO.F_Get_Order_SubStr(BaoID,''BNPRtHX''), ');
|
|||
|
sql.Add('Mjstr4=DBO.F_Get_Order_SubStr(BaoID,''BNGangNo''), ');
|
|||
|
sql.Add('BNMJLENLIST=DBO.F_Get_Order_SubStr(BaoID,''BNMJLENLIST''), ');
|
|||
|
sql.Add('PRTkuanNo=DBO.F_Get_Order_SubStr(BaoID,''BNPrtkuanno''),');
|
|||
|
sql.Add('khConNo=(select top 1 khConNo from JYOrderCon_Main X where X.ConNO=D.conNO), ');
|
|||
|
sql.Add('MprtCodeNameEng=(select top 1 Note from KH_Zdy X where X.zdyName=D.MprtCodeName), ');
|
|||
|
SQL.ADD('count(A.MJID) as JSl,sum(A.MJMaoZ) MJMAOZ,sum(MJQty3) as MJQty3,sum(MJQty4) as MJQty4,SUM(A.MJLen)as MJLen');
|
|||
|
sql.Add('from WFB_MJJY A');
|
|||
|
sql.Add(' inner join JYOrder_Sub C on C.SubID=A.SubID');
|
|||
|
sql.Add(' inner join JYOrder_Main D on D.MainID=A.MainID');
|
|||
|
SQL.Add('where A.BaoID=''' + Trim(BaoID.Text) + '''');
|
|||
|
SQL.ADD('group by A.Baoid,A.BaoNo,A.MJTypeOther,D.OrderNo,D.conNo,D.customerNoName,D.MprtCodeName,D.Mprtspec,D.OrdPerson1,D.MPRTKuanNO,D.LBName,D.NLBName');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
|
|||
|
if ADOQueryPrint.RecordCount > 1 then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>´<EFBFBD><C2B4><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
if FileExists(PChar(ExtractFilePath(Application.ExeName) + 'wav\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.wav')) then
|
|||
|
PlaySound(PChar(ExtractFilePath(Application.ExeName) + 'wav\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.wav'), 0, SND_ASYNC);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
if ADOQueryPrint.RecordCount < 1 then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27>˰<EFBFBD><CBB0>Ż<EFBFBD>δ<EFBFBD><CEB4><EFBFBD><EFBFBD><EFBFBD>棬<EFBFBD>뱣<EFBFBD><EBB1A3><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3>ڴ<EFBFBD>ӡ<EFBFBD><D3A1><EFBFBD>룡', '<27><>ʾ', 0);
|
|||
|
if FileExists(PChar(ExtractFilePath(Application.ExeName) + 'wav\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.wav')) then
|
|||
|
PlaySound(PChar(ExtractFilePath(Application.ExeName) + 'wav\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.wav'), 0, SND_ASYNC);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
|
|||
|
try
|
|||
|
Moudle := LoadLibrary('MakeQRBarcode.dll');
|
|||
|
@Makebar := GetProcAddress(Moudle, 'Make');
|
|||
|
@Mixtext := GetProcAddress(Moudle, 'MixText');
|
|||
|
Txt := trim(BaoID.Text);
|
|||
|
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);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
|
|||
|
baoNo.Text := inttostr(strtointdef(trim(baoNo.Text), 0) + 1);
|
|||
|
if GetLSNo(ADOQueryTmp, FBaoID, 'BI', 'WFB_MJJY', 4, 1) = False then
|
|||
|
begin
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
BaoID.Text := trim(FBaoID);
|
|||
|
CDSsel.Last;
|
|||
|
with CDSMJID do
|
|||
|
begin
|
|||
|
DisableControls;
|
|||
|
first;
|
|||
|
while not eof do
|
|||
|
begin
|
|||
|
CDSsel.Append;
|
|||
|
for i := 0 to FieldCount - 1 do
|
|||
|
begin
|
|||
|
CDSsel.fields[i].value := Fields[i].Value;
|
|||
|
end;
|
|||
|
CDSsel.Post;
|
|||
|
next;
|
|||
|
end;
|
|||
|
EnableControls;
|
|||
|
end;
|
|||
|
CDSMJID.EmptyDataSet;
|
|||
|
|
|||
|
if check_bz.Checked then
|
|||
|
begin
|
|||
|
if Trim(ADOQueryPrint.fieldbyname('NLBName').AsString) <> '' then
|
|||
|
// fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + Trim(ADOQueryPrint.fieldbyname('NLBName').AsString) + '.rmf'
|
|||
|
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + Trim(ADOQueryPrint.fieldbyname('NLBName').AsString)
|
|||
|
else
|
|||
|
// fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\<5C><><EFBFBD><EFBFBD>ǩ.rmf';
|
|||
|
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\<5C><><EFBFBD><EFBFBD>ǩ';
|
|||
|
if not FileExists(fPrintFile) then
|
|||
|
begin
|
|||
|
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + fPrintFile), '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
|
|||
|
if FileExists(fPrintFile) then
|
|||
|
begin
|
|||
|
RMVariables['QRBARCODE'] := fImagePath;
|
|||
|
RM2.LoadFromFile(fPrintFile);
|
|||
|
RM2.DefaultCopies := strtointdef(trim(ComboBox1.Text), 1);
|
|||
|
//RM2.ShowReport;
|
|||
|
RM2.printReport;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
Rolls := 0;
|
|||
|
SmNO.SetFocus;
|
|||
|
{
|
|||
|
IF check_Fbz.Checked then
|
|||
|
begin
|
|||
|
fPrintFile:= ExtractFilePath(Application.ExeName) + 'Report\'+Trim(Fbq.Text)+'.rmf' ;
|
|||
|
IF Not FileExists(fPrintFile) then
|
|||
|
begin
|
|||
|
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>'+fPrintFile),'<27><>ʾ',0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
|
|||
|
if FileExists(fPrintFile) then
|
|||
|
begin
|
|||
|
RMVariables['QRBARCODE']:=fImagePath;
|
|||
|
RM2.LoadFromFile(fPrintFile);
|
|||
|
RM2.DefaultCopies:=strtointdef(trim(ComboBox2.Text),1);
|
|||
|
//RM2.ShowReport;
|
|||
|
RM2.printReport;
|
|||
|
end;
|
|||
|
end;
|
|||
|
}
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPDBao.cxButton1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
TBClose.Click;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPDBao.baoNoExit(Sender: TObject);
|
|||
|
var
|
|||
|
FBaoID: string;
|
|||
|
begin
|
|||
|
if baoNo.Text <> '' then
|
|||
|
begin
|
|||
|
if GetLSNo(ADOQueryTmp, FBaoID, 'BI', 'WFB_MJJY', 4, 1) = False then
|
|||
|
begin
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
BaoID.Text := trim(FBaoID);
|
|||
|
end
|
|||
|
else
|
|||
|
BaoID.Text := '';
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPDBao.BtnEditA1BtnClick(Sender: TObject);
|
|||
|
begin
|
|||
|
frmOrderSelRK := TfrmOrderSelRK.Create(Application);
|
|||
|
with frmOrderSelRK do
|
|||
|
begin
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
CDS_OrderSel.DisableControls;
|
|||
|
with CDS_OrderSel do
|
|||
|
begin
|
|||
|
First;
|
|||
|
while not Eof do
|
|||
|
begin
|
|||
|
if FieldByName('SSel').Value = True then
|
|||
|
begin
|
|||
|
BtnEditA1.Text := trim(CDS_OrderSel.fieldbyname('OrderNo').asstring);
|
|||
|
end;
|
|||
|
Next;
|
|||
|
end;
|
|||
|
end;
|
|||
|
CDS_OrderSel.EnableControls;
|
|||
|
end;
|
|||
|
end;
|
|||
|
QueryTm();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPDBao.cxButton3Click(Sender: TObject);
|
|||
|
var
|
|||
|
i: integer;
|
|||
|
begin
|
|||
|
if CDSMJID.IsEmpty then
|
|||
|
exit;
|
|||
|
if CDSMJID.fieldByName('Sflag').AsString = '2' then
|
|||
|
begin
|
|||
|
application.MessageBox('<27>Ѵ<EFBFBD><D1B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
exit;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
with CDSMJID do
|
|||
|
begin
|
|||
|
CDSTM.Last;
|
|||
|
|
|||
|
CDSTM.Append;
|
|||
|
for i := 0 to FieldCount - 1 do
|
|||
|
begin
|
|||
|
CDSTM.fields[i].value := Fields[i].Value;
|
|||
|
end;
|
|||
|
CDSTM.Post;
|
|||
|
end;
|
|||
|
CDSMJID.Delete;
|
|||
|
Rolls := Rolls - 1;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPDBao.cxButton2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDSMJID.IsEmpty then
|
|||
|
exit;
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
try
|
|||
|
with CDSMJID do
|
|||
|
begin
|
|||
|
DisableControls;
|
|||
|
first;
|
|||
|
while not eof do
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('Update WFB_MJJY Set BaoNo=''' + trim(BaoNo.Text) + ''',BaoID=''' + trim(Baoid.text) + ''' where MJID=''' + Trim(CDSMJID.fieldbyname('MJID').AsString) + '''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
edit;
|
|||
|
fieldByName('Sflag').AsString := '2';
|
|||
|
fieldbyname('BaoNo').Value := trim(BaoNo.Text);
|
|||
|
fieldbyname('BaoID').Value := trim(BaoID.Text);
|
|||
|
post;
|
|||
|
next;
|
|||
|
end;
|
|||
|
EnableControls;
|
|||
|
end;
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
// application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ijɹ<C4B3><C9B9><EFBFBD>','<27><>ʾ<EFBFBD><CABE>Ϣ',0);
|
|||
|
except
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPDBao.cxButton4Click(Sender: TObject);
|
|||
|
var
|
|||
|
FBaoid: string;
|
|||
|
begin
|
|||
|
|
|||
|
if CDSSEL.IsEmpty then
|
|||
|
Exit;
|
|||
|
if CDSSEL.Locate('SSel', True, []) = False then
|
|||
|
begin
|
|||
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
try
|
|||
|
CDSSEL.DisableControls;
|
|||
|
// ADOQueryCmd.Connection.BeginTrans;
|
|||
|
with CDSSEL do
|
|||
|
begin
|
|||
|
// First;
|
|||
|
while CDSSEL.Locate('SSel', True, []) do
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('Update WFB_MJJY Set baoID='''',baoNo='''' ');
|
|||
|
sql.Add('where MJID=''' + Trim(CDSSEL.fieldbyname('MJID').AsString) + '''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
delete;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
// ADOQueryCmd.Connection.CommitTrans;
|
|||
|
CDSSEL.EnableControls;
|
|||
|
application.MessageBox('<27><><EFBFBD>ݳ<EFBFBD><DDB3><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
|
|||
|
|
|||
|
with ADOQueryTM do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select A.*,B.*,C.MPrtCodeName,C.orderNo as OrderNoM');
|
|||
|
sql.Add('from WFB_MJJY A ');
|
|||
|
sql.Add('inner join JYOrder_sub B on B.subID=A.subID ');
|
|||
|
sql.Add('inner join JYOrder_main C on C.mainID=A.MainID ');
|
|||
|
sql.Add(' and A.mjstr2=''δ<><CEB4><EFBFBD><EFBFBD>'' and C.orderNo=' + quotedstr(trim(BtnEditA1.Text)));
|
|||
|
open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryTM, CDSTM);
|
|||
|
SInitCDSData20(ADOQueryTM, CDSTM);
|
|||
|
|
|||
|
if not CDSTM.IsEmpty then
|
|||
|
begin
|
|||
|
with ADOQuery1 do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.clear;
|
|||
|
sql.add('select isnull(max(cast(baoNo as int)),0)+1 as MaxBaoNo from WFB_MJJY ');
|
|||
|
sql.Add('where mainID=' + quotedstr(trim(CDSTM.fieldbyname('MainID').AsString)));
|
|||
|
open;
|
|||
|
end;
|
|||
|
baoNo.text := ADOQuery1.fieldbyname('MaxBaoNo').AsString;
|
|||
|
if GetLSNo(ADOQueryTmp, FBaoid, 'BI', 'WFB_MJJY', 4, 1) = False then
|
|||
|
begin
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
BaoID.Text := trim(FBaoid);
|
|||
|
end;
|
|||
|
|
|||
|
SMNO.SetFocus;
|
|||
|
cxButton5.Click;
|
|||
|
exit;
|
|||
|
except
|
|||
|
// ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
CDSSEL.EnableControls;
|
|||
|
application.MessageBox('<27><><EFBFBD>ݳ<EFBFBD><DDB3><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
end;
|
|||
|
// if CDSSEL.IsEmpty then
|
|||
|
// Exit;
|
|||
|
// if CDSSEL.Locate('SSel', True, []) = False then
|
|||
|
// begin
|
|||
|
// Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
// Exit;
|
|||
|
// end;
|
|||
|
// try
|
|||
|
// CDSSEL.DisableControls;
|
|||
|
// // ADOQueryCmd.Connection.BeginTrans;
|
|||
|
// with CDSSEL do
|
|||
|
// begin
|
|||
|
// First;
|
|||
|
// while FieldByName('SSel').AsBoolean do
|
|||
|
// begin
|
|||
|
// with ADOQueryCmd do
|
|||
|
// begin
|
|||
|
// Close;
|
|||
|
// sql.Clear;
|
|||
|
// sql.Add('Update WFB_MJJY Set baoID='''',baoNo='''' ');
|
|||
|
// sql.Add('where MJID=''' + Trim(CDSSEL.fieldbyname('MJID').AsString) + '''');
|
|||
|
// ExecSQL;
|
|||
|
// end;
|
|||
|
// delete;
|
|||
|
// end;
|
|||
|
// end;
|
|||
|
// // ADOQueryCmd.Connection.CommitTrans;
|
|||
|
// CDSSEL.EnableControls;
|
|||
|
// application.MessageBox('<27><><EFBFBD>ݳ<EFBFBD><DDB3><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
|
|||
|
//
|
|||
|
// with ADOQueryTM do
|
|||
|
// begin
|
|||
|
// close;
|
|||
|
// sql.Clear;
|
|||
|
// sql.Add('select A.*,B.*,C.MPrtCodeName,C.orderNo as OrderNoM');
|
|||
|
// sql.Add('from WFB_MJJY A ');
|
|||
|
// sql.Add('inner join JYOrder_sub B on B.subID=A.subID ');
|
|||
|
// sql.Add('inner join JYOrder_main C on C.mainID=A.MainID ');
|
|||
|
// sql.Add('and A.mjstr2=''δ<><CEB4><EFBFBD><EFBFBD>'' and C.orderNo=' + quotedstr(trim(BtnEditA1.Text)));
|
|||
|
// open;
|
|||
|
// end;
|
|||
|
// SCreateCDS20(ADOQueryTM, CDSTM);
|
|||
|
// SInitCDSData20(ADOQueryTM, CDSTM);
|
|||
|
//
|
|||
|
// if not CDSTM.IsEmpty then
|
|||
|
// begin
|
|||
|
// with ADOQuery1 do
|
|||
|
// begin
|
|||
|
// close;
|
|||
|
// sql.clear;
|
|||
|
// sql.add('select isnull(max(cast(baoNo as int)),0)+1 as MaxBaoNo from WFB_MJJY ');
|
|||
|
// sql.Add('where mainID=' + quotedstr(trim(CDSTM.fieldbyname('MainID').AsString)));
|
|||
|
// open;
|
|||
|
// end;
|
|||
|
// baoNo.text := ADOQuery1.fieldbyname('MaxBaoNo').AsString;
|
|||
|
// if GetLSNo(ADOQueryTmp, FBaoid, 'BI', 'WFB_MJJY', 4, 1) = False then
|
|||
|
// begin
|
|||
|
// ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
// Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
|
|||
|
// Exit;
|
|||
|
// end;
|
|||
|
// BaoID.Text := trim(FBaoid);
|
|||
|
// end;
|
|||
|
//
|
|||
|
// SMNO.SetFocus;
|
|||
|
// exit;
|
|||
|
// except
|
|||
|
// // ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
// CDSSEL.EnableControls;
|
|||
|
// application.MessageBox('<27><><EFBFBD>ݳ<EFBFBD><DDB3><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
// end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPDBao.FbqBtnClick(Sender: TObject);
|
|||
|
begin
|
|||
|
try
|
|||
|
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
|||
|
with frmZDYHelp do
|
|||
|
begin
|
|||
|
flag := 'BAOFFLAG';
|
|||
|
flagname := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǩ';
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
Fbq.Text := trim(ClientDataSet1.fieldbyname('zdyName').AsString);
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmZDYHelp.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPDBao.BaoBqBtnClick(Sender: TObject);
|
|||
|
type
|
|||
|
TMyFunc = function(App: Tapplication; FormH: hwnd; FormID: integer; Language: integer; WinStyle: integer; GCode: Pchar; GName: Pchar; DataBase: Pchar; Title: PChar; Parameters1: PChar; Parameters2: PChar; Parameters3: PChar; Parameters4: PChar; Parameters5: PChar; Parameters6: PChar; Parameters7: PChar; Parameters8: PChar; Parameters9: PChar; Parameters10: PChar; DataBaseStr: PChar): hwnd; stdcall;
|
|||
|
var
|
|||
|
Tf: TMyFunc;
|
|||
|
Tp: TFarProc;
|
|||
|
Th: Thandle;
|
|||
|
LabInt, labname: string;
|
|||
|
begin
|
|||
|
//if PPInt=2 then Exit;
|
|||
|
Ddatabase := StringOfChar(' ', 32);
|
|||
|
Th := LoadLibrary('LabelSet.dll');
|
|||
|
if Th > 0 then
|
|||
|
begin
|
|||
|
try
|
|||
|
Tp := GetProcAddress(Th, 'GetDllForm');
|
|||
|
if Tp <> nil then
|
|||
|
begin
|
|||
|
Tf := TMyFunc(Tp);
|
|||
|
newh := Tf(Application, 0, 2, 0, 0, PChar(DCode), PChar(DName), PChar(Ddatabase), PChar('<27><>ǩģ<C7A9><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'), PChar(''), PChar(''), '', '', '', '', '', '', '', '', PChar(DConString));
|
|||
|
if Trim(PChar(Ddatabase)) <> '' then
|
|||
|
begin
|
|||
|
Ddatabase := Trim(PChar(Ddatabase));
|
|||
|
// LabInt:=Trim( LeftBStr(Ddatabase,Pos('|',Ddatabase)-1) ) ;
|
|||
|
BaoBq.Text := Trim(RightBStr(Ddatabase, Length(Ddatabase) - Pos('|', Ddatabase)));
|
|||
|
end;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
ShowMessage('<27><>ӡִ<D3A1>д<EFBFBD><D0B4><EFBFBD>');
|
|||
|
end;
|
|||
|
finally
|
|||
|
// FreeLibrary();
|
|||
|
end;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
ShowMessage('<27>Ҳ<EFBFBD><D2B2><EFBFBD>' + Trim('LabelSet.dll'));
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPDBao.cxButton5Click(Sender: TObject);
|
|||
|
begin
|
|||
|
QueryTm();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPDBao.cxButton6Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDSTM.IsEmpty then
|
|||
|
exit;
|
|||
|
if trim(BaoNo.Text) = '' then
|
|||
|
begin
|
|||
|
application.MessageBox('<27><><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>', '<27><>ʾ');
|
|||
|
exit;
|
|||
|
end;
|
|||
|
if trim(BaoID.Text) = '' then
|
|||
|
begin
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>벻<EFBFBD><EBB2BB>Ϊ<EFBFBD><CEAA>', '<27><>ʾ');
|
|||
|
exit;
|
|||
|
end;
|
|||
|
|
|||
|
with CDSTM do
|
|||
|
begin
|
|||
|
DisableControls;
|
|||
|
// first;
|
|||
|
while Locate('ssel', true, []) do
|
|||
|
begin
|
|||
|
if combobox4.Text = '<27><><EFBFBD><EFBFBD>ɫ' then
|
|||
|
begin
|
|||
|
if cdsmjid.IsEmpty = false then
|
|||
|
begin
|
|||
|
if cdstm.FieldByName('PRTCOLOR').AsString <> cdsmjid.FieldByName('prtcolor').AsString then
|
|||
|
begin
|
|||
|
MovePanel1.Visible := true;
|
|||
|
Edit2.Text := SmNO.Text;
|
|||
|
Label2.Caption := '<27><>ɫ<EFBFBD><C9AB>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD><EFBFBD>ܴ<EFBFBD><DCB4><EFBFBD><EFBFBD><EFBFBD>';
|
|||
|
label2.Font.Size := 36;
|
|||
|
smno.Text := '';
|
|||
|
smno.SetFocus;
|
|||
|
EnableControls;
|
|||
|
exit;
|
|||
|
end;
|
|||
|
end;
|
|||
|
with ADOQuery2 do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.clear;
|
|||
|
sql.add('select MaxBaoNo=isnull(max(cast(baoNo as int)),0)+1 ');
|
|||
|
sql.add('from WFB_MJJY A ');
|
|||
|
sql.add('inner join JYOrder_Sub B on A.SubId=B.SubId ');
|
|||
|
sql.add('where A.MainId=' + quotedstr(trim(CDSTM.fieldbyname('MainID').AsString)));
|
|||
|
sql.add('and B.PRTColor=(select PRTColor from WFB_MJJY WM inner join JYOrder_Sub JS on WM.SubId=JS.SubId where WM.MJID=''' + trim(self.CDSTM.fieldbyname('mjid').AsString) + ''')');
|
|||
|
// showmessage(sql.Text);
|
|||
|
open;
|
|||
|
end;
|
|||
|
baoNo.text := ADOQuery2.fieldbyname('MaxBaoNo').AsString;
|
|||
|
end;
|
|||
|
|
|||
|
if CDSMJID.Locate('MJID', trim(CDSTM.fieldbyname('MJID').AsString), []) then
|
|||
|
begin
|
|||
|
MovePanel1.Visible := true;
|
|||
|
Edit2.Text := SmNO.Text;
|
|||
|
Label2.Caption := '<27>˾<EFBFBD><CBBE><EFBFBD><EFBFBD>ظ<EFBFBD>ɨ<EFBFBD>裡';
|
|||
|
smno.Text := '';
|
|||
|
smno.SetFocus;
|
|||
|
EnableControls;
|
|||
|
exit;
|
|||
|
end;
|
|||
|
CDSMJID.Append;
|
|||
|
CDSMJID.FieldByName('SDefNote').Value := '<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>';
|
|||
|
CDSMJID.FieldByName('MJID').Value := trim(Fieldbyname('MJID').AsString);
|
|||
|
// CDSMJID.FieldByName('CRID').Value:=trim(ADOQueryMain.Fieldbyname('CRID').AsString);
|
|||
|
CDSMJID.FieldByName('PRTCodeName').Value := trim(Fieldbyname('PRTCodeName').AsString);
|
|||
|
CDSMJID.FieldByName('MPRTCodeName').Value := trim(Fieldbyname('MPRTCodeName').AsString);
|
|||
|
CDSMJID.FieldByName('PRTColor').Value := trim(Fieldbyname('PRTColor').AsString);
|
|||
|
CDSMJID.FieldByName('PRTHX').Value := trim(Fieldbyname('PRTHX').AsString);
|
|||
|
CDSMJID.FieldByName('MJStr4').Value := trim(Fieldbyname('MJStr4').AsString);
|
|||
|
CDSMJID.FieldByName('MJType').Value := trim(Fieldbyname('MJType').AsString);
|
|||
|
CDSMJID.FieldByName('mjxh').Value := trim(Fieldbyname('mjxh').AsString);
|
|||
|
CDSMJID.FieldByName('SOrddefstr1').Value := trim(Fieldbyname('SOrddefstr1').AsString);
|
|||
|
CDSMJID.FieldByName('BaoNo').Value := trim(BaoNo.Text);
|
|||
|
CDSMJID.FieldByName('BaoID').Value := trim(BaoID.Text);
|
|||
|
CDSMJID.FieldByName('SOrdQty1').Value := 1;
|
|||
|
CDSMJID.FieldByName('MJLen').Value := Fieldbyname('MJLen').AsFloat;
|
|||
|
CDSMJID.FieldByName('MJMaoZ').Value := Fieldbyname('MJMaoZ').AsFloat;
|
|||
|
CDSMJID.FieldByName('MJQty3').Value := Fieldbyname('MJQty3').AsFloat;
|
|||
|
CDSMJID.FieldByName('MJQty4').Value := Fieldbyname('MJQty4').AsFloat;
|
|||
|
CDSMJID.FieldByName('MJTypeOther').Value := trim(Fieldbyname('MJTypeOther').AsString);
|
|||
|
CDSMJID.FieldByName('mainID').Value := trim(Fieldbyname('mainID').AsString);
|
|||
|
CDSMJID.FieldByName('subID').Value := trim(Fieldbyname('subID').AsString);
|
|||
|
CDSMJID.Post;
|
|||
|
|
|||
|
CDSTM.Delete;
|
|||
|
tv2.Controller.EditingController.ShowEdit();
|
|||
|
tv3.Controller.EditingController.ShowEdit();
|
|||
|
end;
|
|||
|
first;
|
|||
|
EnableControls;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPDBao.cxButton7Click(Sender: TObject);
|
|||
|
begin
|
|||
|
SDofilter(ADOQueryTM, SGetFilters(Panel5, 1, 2));
|
|||
|
SCreateCDS20(ADOQueryTM, CDSTM);
|
|||
|
SInitCDSData20(ADOQueryTM, CDSTM);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPDBao.N1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
SelOKNoFiler(Tv4, True);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPDBao.N2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
SelOKNoFiler(Tv4, False);
|
|||
|
end;
|
|||
|
|
|||
|
end.
|
|||
|
|