unit u_op_seai_add; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, DB, BusinessSkinForm, bsSkinCtrls, StdCtrls,ADODB,wwdbdatetimepicker, wwdblook; type Tfrm_op_seai_add = class(TForm) bsBusinessSkinForm1: TbsBusinessSkinForm; data1: TDataSource; bsSkinGroupBox1: TbsSkinGroupBox; Label1: TLabel; bsSkinCheckRadioBox1: TbsSkinCheckRadioBox; bsSkinCheckRadioBox2: TbsSkinCheckRadioBox; bsSkinCheckRadioBox5: TbsSkinCheckRadioBox; bsSkinCheckRadioBox6: TbsSkinCheckRadioBox; wwDBDateTimePicker1: TwwDBDateTimePicker; bsSkinButton1: TbsSkinButton; bsSkinButton3: TbsSkinButton; bsSkinButton2: TbsSkinButton; bsSkinCheckRadioBox7: TbsSkinCheckRadioBox; bsSkinCheckRadioBox3: TbsSkinCheckRadioBox; bsSkinCheckRadioBox4: TbsSkinCheckRadioBox; bsSkinButton4: TbsSkinButton; OpenDialog1: TOpenDialog; wwDBLookupCombo3: TwwDBLookupCombo; Label124: TLabel; Label2: TLabel; wwDBDateTimePicker2: TwwDBDateTimePicker; procedure bsSkinButton2Click(Sender: TObject); procedure bsSkinButton1Click(Sender: TObject); procedure FormShow(Sender: TObject); procedure bsSkinButton3Click(Sender: TObject); procedure bsSkinButton4Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var frm_op_seai_add: Tfrm_op_seai_add; frm_op_seai_add_num:integer; implementation uses u_op_seai, u_main, my_sys_function, u_data_share, u_sys_progress; {$R *.dfm} procedure Tfrm_op_seai_add.bsSkinButton2Click(Sender: TObject); begin close; end; procedure Tfrm_op_seai_add.bsSkinButton1Click(Sender: TObject); var i:integer; begin if (frm_op_seai_add_num=3) then begin frm_op_seai.t_op_seai1.Enabled:=false; frm_op_seai.t_op_seai1.DataSet:=frm_op_seai.t_op_seai_fen; frm_op_seai.t_op_seai1.Enabled:=true; data1.DataSet.append; for i := 0 to (data1.DataSet.DataSource.DataSet.fieldcount-1) do begin data1.DataSet[data1.DataSet.DataSource.DataSet.fields[i].FieldName]:= data1.DataSet.DataSource.DataSet[data1.DataSet.DataSource.DataSet.fields[i].FieldName]; end; data1.DataSet['业务编号']:=''; data1.DataSet['主编号']:=''; data1.DataSet['编号']:=''; // data1.DataSet['委托编号']:=''; data1.DataSet['分提单号']:=''; data1.DataSet['会计期间']:=wwDBDateTimePicker1.date; if wwDBDateTimePicker2.Text<>'' then data1.DataSet['进口日期']:=wwDBDateTimePicker2.date; data1.DataSet['周次']:=WeekofYear(wwDBDateTimePicker1.date); data1.DataSet['财务']:=0; data1.DataSet['财务凭证']:=''; data1.DataSet['录入人']:=employee; data1.DataSet['录入日期']:=date; data1.DataSet['分部名称']:=subComp; data1.DataSet['操作员']:=employee; data1.DataSet['报关操作']:=employee; data1.DataSet['报检操作']:=employee; data1.DataSet['揽货人']:=employee; data1.DataSet['客服员']:=employee; if wwDBLookupCombo3.Text<>'' then data1.DataSet['卸货港']:=wwDBLookupCombo3.Text else data1.DataSet['卸货港']:=get_parameters_value(17,'QINGDAO,CHINA'); data1.DataSet['业务来源']:='自揽货'; data1.DataSet['销售部门']:=department; data1.DataSet['操作部门']:=department; data1.DataSet['是否打印']:=0; data1.DataSet['发货人']:=''; data1.DataSet['发货人代码']:=''; data1.DataSet['收货人']:=''; data1.DataSet['收货人代码']:=''; data1.DataSet['通知人']:=''; data1.DataSet['通知人代码']:=''; data1.DataSet['集装箱']:=''; data1.DataSet['箱号封号']:=''; data1.DataSet['件数']:=0; data1.DataSet['重量']:=0; data1.DataSet['尺码']:=0; if bsSkinCheckRadioBox1.Checked then data1.DataSet['装运方式']:=bsSkinCheckRadioBox1.Caption; if bsSkinCheckRadioBox2.Checked then data1.DataSet['装运方式']:=bsSkinCheckRadioBox2.Caption; if bsSkinCheckRadioBox3.Checked then data1.DataSet['装运方式']:=bsSkinCheckRadioBox3.Caption; if bsSkinCheckRadioBox4.Checked then data1.DataSet['装运方式']:=bsSkinCheckRadioBox4.Caption; if bsSkinCheckRadioBox5.Checked then data1.DataSet['装运方式']:=bsSkinCheckRadioBox5.Caption; if bsSkinCheckRadioBox6.Checked then data1.DataSet['装运方式']:=bsSkinCheckRadioBox6.Caption; if bsSkinCheckRadioBox7.Checked then data1.DataSet['业务类型']:='更改单' else data1.DataSet['业务类型']:='普通货'; end else begin data1.DataSet.Insert; data1.DataSet['会计期间']:=wwDBDateTimePicker1.date; if wwDBDateTimePicker2.Text<>'' then data1.DataSet['进口日期']:=wwDBDateTimePicker2.date; data1.DataSet['周次']:=WeekofYear(wwDBDateTimePicker1.date); data1.DataSet['财务']:=0; data1.DataSet['财务凭证']:=''; data1.DataSet['录入人']:=employee; data1.DataSet['录入日期']:=date; data1.DataSet['分部名称']:=subComp; data1.DataSet['操作员']:=employee; data1.DataSet['报关操作']:=employee; data1.DataSet['报检操作']:=employee; data1.DataSet['揽货人']:=employee; data1.DataSet['客服员']:=employee; data1.DataSet['集装箱']:=''; data1.DataSet['箱号封号']:=''; if wwDBLookupCombo3.Text<>'' then data1.DataSet['卸货港']:=wwDBLookupCombo3.Text else data1.DataSet['卸货港']:=get_parameters_value(17,'QINGDAO,CHINA'); data1.DataSet['付费方式']:=get_parameters_value(23,'FREIGHT PREPAID'); data1.DataSet['货物描述']:=get_parameters_value(117,''); data1.DataSet['收货人']:=get_parameters_value(127,''); data1.DataSet['业务来源']:='自揽货'; data1.DataSet['销售部门']:=department; data1.DataSet['操作部门']:=department; data1.DataSet['是否打印']:=0; if bsSkinCheckRadioBox1.Checked then data1.DataSet['装运方式']:=bsSkinCheckRadioBox1.Caption; if bsSkinCheckRadioBox2.Checked then data1.DataSet['装运方式']:=bsSkinCheckRadioBox2.Caption; if bsSkinCheckRadioBox3.Checked then data1.DataSet['装运方式']:=bsSkinCheckRadioBox3.Caption; if bsSkinCheckRadioBox4.Checked then data1.DataSet['装运方式']:=bsSkinCheckRadioBox4.Caption; if bsSkinCheckRadioBox5.Checked then data1.DataSet['装运方式']:=bsSkinCheckRadioBox5.Caption; if bsSkinCheckRadioBox6.Checked then data1.DataSet['装运方式']:=bsSkinCheckRadioBox6.Caption; if bsSkinCheckRadioBox7.Checked then data1.DataSet['业务类型']:='更改单' else data1.DataSet['业务类型']:='普通货'; end; if frm_op_seai_add_num=1 then begin frm_op_seai.notebook1.pageindex:=1; frm_op_seai.bsSkinButton11.Caption:='返回列表'; frm_op_seai.bsSkinTabSheet1.Show; end; if frm_op_seai_add_num=2 then begin frm_op_seai.notebook1.pageindex:=1; frm_op_seai.bsSkinButton11.Caption:='返回主票'; frm_op_seai.bsSkinTabSheet1.Show; end; if frm_op_seai_add_num=3 then begin frm_op_seai.notebook1.pageindex:=1; frm_op_seai.bsSkinButton11.Caption:='返回主票'; frm_op_seai.bsSkinTabSheet1.Show; // frm_op_seai.t_op_seai_fen.Post; // showmessage('2'); end; close; end; procedure Tfrm_op_seai_add.FormShow(Sender: TObject); begin wwDBDateTimePicker1.MinDate:=Logininfo.endday+1; wwDBDateTimePicker1.Date:=date; // wwDBDateTimePicker2.Date:=date; wwDBLookupCombo3.Text:=get_parameters_value(17,'QINGDAO,CHINA'); end; procedure Tfrm_op_seai_add.bsSkinButton3Click(Sender: TObject); var afield : variant; i: Integer; begin if data1.DataSet.IsEmpty then begin showmessage('没有复制母体,不能复制新建!'); exit; end; afield := vararraycreate([0,data1.DataSet.fieldcount-1],varvariant); for i := 0 to (data1.DataSet.fieldcount-1) do begin afield[i] :=data1.DataSet.fields[i].value ; end; if frm_op_seai_add_num=3 then begin frm_op_seai.t_op_seai1.Enabled:=false; frm_op_seai.t_op_seai1.DataSet:=frm_op_seai.t_op_seai_fen; frm_op_seai.t_op_seai1.Enabled:=true; end; data1.DataSet.append; for i := 0 to (data1.DataSet.fieldcount-1) do begin data1.DataSet.fields[i].value := afield[i] ; end; if bsSkinCheckRadioBox7.Checked then data1.DataSet['业务类型']:='更改单' else data1.DataSet['业务类型']:='普通货'; data1.DataSet['业务编号']:=''; data1.DataSet['主编号']:=''; if not (Trim(frm_data_share.t_sys_noset.fieldbyname('出号规则').Asstring)='手动编辑') then data1.DataSet['委托编号']:=''; data1.DataSet['编号']:=''; data1.DataSet['箱型1']:=0; data1.DataSet['箱型2']:=0; data1.DataSet['箱型3']:=0; data1.DataSet['箱型4']:=0; data1.DataSet['箱型5']:=0; data1.DataSet['箱型6']:=0; data1.DataSet['箱型7']:=0; data1.DataSet['箱型8']:=0; data1.DataSet['箱型9']:=0; data1.DataSet['箱型10']:=0; data1.DataSet['其他箱型']:=0; data1.DataSet['箱TEU']:=0; data1.DataSet['集装箱']:=''; //data1.DataSet['箱数大写']:=''; data1.DataSet['计费标准']:=''; if frm_op_seai_add_num=3 then begin data1.DataSet['发货人']:=''; data1.DataSet['收货人']:=''; data1.DataSet['通知人']:=''; data1.DataSet['发货人代码']:=''; data1.DataSet['收货人代码']:=''; data1.DataSet['通知人代码']:=''; end; data1.DataSet['业务状态']:='接受委托'; data1.DataSet['费用状态']:='录入状态'; data1.DataSet['录入人']:=employee; data1.DataSet['录入日期']:=date; data1.DataSet['分部名称']:=subComp; data1.DataSet['操作员']:=employee; data1.DataSet['操作部门']:=department; data1.DataSet['报关操作']:=employee; data1.DataSet['报检操作']:=employee; data1.DataSet['会计期间']:=wwDBDateTimePicker1.date; // data1.DataSet['销售部门']:=department; { if not bsSkinCheckRadioBox7.Checked then begin data1.DataSet['揽货人']:=''; end; } if wwDBDateTimePicker2.Text<>'' then data1.DataSet['进口日期']:=wwDBDateTimePicker2.date; if (strtoint(get_parameters_value(158,'0'))=1) and bsSkinCheckRadioBox7.Checked then AmendAccDate('T_OP_SEAI',data1); data1.DataSet['财务']:=0; data1.DataSet['财务凭证']:=''; data1.DataSet['备案号']:=''; data1.DataSet['启运国']:=''; data1.DataSet['境内货源地']:=''; data1.DataSet['批准文号']:=''; data1.DataSet['成交方式']:=''; data1.DataSet['净重']:=0; data1.DataSet['单价']:=''; data1.DataSet['总价']:=''; data1.DataSet['商品名称']:=''; data1.DataSet['数量单位']:=''; data1.DataSet['接单日期']:=null; data1.DataSet['报检日期']:=null; data1.DataSet['报检单号']:=''; data1.DataSet['验货时间']:=null; data1.DataSet['实验时间']:=null; data1.DataSet['熏蒸时间']:=null; data1.DataSet['出证时间']:=null; data1.DataSet['实验内容']:=''; data1.DataSet['币制']:=''; data1.DataSet['周次']:=WeekofYear(wwDBDateTimePicker1.date); data1.DataSet['合计20']:=0; data1.DataSet['合计40']:=0; data1.DataSet['合计40H']:=0; data1.DataSet['合计45']:=0; data1.DataSet['集团成本']:=0; data1.DataSet['凭证日期']:=null; data1.DataSet['提交财务日期']:=null; data1.DataSet['自责更改']:='0'; data1.DataSet['海丰财务凭证']:=''; if wwDBLookupCombo3.Text<>'' then data1.DataSet['卸货港']:=wwDBLookupCombo3.Text else data1.DataSet['卸货港']:=get_parameters_value(17,'QINGDAO,CHINA'); data1.DataSet['是否打印']:=0; if bsSkinCheckRadioBox1.Checked then data1.DataSet['装运方式']:=bsSkinCheckRadioBox1.Caption; if bsSkinCheckRadioBox2.Checked then data1.DataSet['装运方式']:=bsSkinCheckRadioBox2.Caption; if bsSkinCheckRadioBox3.Checked then data1.DataSet['装运方式']:=bsSkinCheckRadioBox3.Caption; if bsSkinCheckRadioBox4.Checked then data1.DataSet['装运方式']:=bsSkinCheckRadioBox4.Caption; if bsSkinCheckRadioBox5.Checked then data1.DataSet['装运方式']:=bsSkinCheckRadioBox5.Caption; if bsSkinCheckRadioBox6.Checked then data1.DataSet['装运方式']:=bsSkinCheckRadioBox6.Caption; if frm_op_seai_add_num=1 then begin frm_op_seai.notebook1.pageindex:=1; frm_op_seai.bsSkinButton11.Caption:='返回列表'; frm_op_seai.bsSkinTabSheet1.Show; end; if frm_op_seai_add_num=2 then begin frm_op_seai.notebook1.pageindex:=1; frm_op_seai.bsSkinButton11.Caption:='返回主票'; frm_op_seai.bsSkinTabSheet1.Show; end; if frm_op_seai_add_num=3 then begin frm_op_seai.notebook1.pageindex:=1; frm_op_seai.bsSkinButton11.Caption:='返回主票'; frm_op_seai.bsSkinTabSheet1.Show; end; close; end; procedure Tfrm_op_seai_add.bsSkinButton4Click(Sender: TObject); var EdiStrings:TStrings; FileNames:String; i:integer; S,dddd,Heads,oldHeads,VslID,Vessel,VoyNo,eta,etd,Carrier,s2:String; tempStr:TStrings; aQuery,aQuery2:TAdoQuery; function GetPosString(S1:string;m:integer):String; var subs:String; z:integer; begin Result:=''; if pos(':',S1)=0 then exit; s1:=StringReplace(s1,'??','?',[rfReplaceAll]); s1:=StringReplace(s1,'?:','し',[rfReplaceAll]); s1:=StringReplace(s1,'?''','''',[rfReplaceAll]); s1:=StringReplace(s1,'?+','+',[rfReplaceAll]); for z:=1 to m-1 do begin if Pos(':',S1)=0 then exit; if Pos(':',S1)=1 then S1:=Copy(S1,Pos(':',S1)+1,(length(s1)-Pos(':',S1))) else S1:=Copy(S1,Pos(':',S1)+1,(length(s1)-Pos(':',S1))); end; if pos(':',S1)=1 then exit; if Pos(':',S1)=0 then Result:=Copy(S1,1,length(S1)-1) else Result:=Copy(S1,1,Pos(':',S1)-1); Result:=StringReplace(Result,'し','?:',[rfReplaceAll]); end; function FormatDateStr(ADate:String):String; begin Result:=''; if length(ADate)<>8 then exit; Result:=Copy(ADate,1,4)+'-'+Copy(ADate,5,2)+'-'+Copy(ADate,7,2); end; function FormatNumStr(ANum:String):String; var i:integer; begin Result:='0'; if length(ANum)=0 then exit; for i:=1 to length(ANum) do begin if Copy(ANum,1,1)='0' then system.Delete(ANum,1,1) else Break; end; Result:=ANum; end; begin EdiStrings:=TStringList.Create; try if not ASSIGNED(frm_sys_progress) then frm_sys_progress:=tfrm_sys_progress.Create(self); frm_sys_progress.bsSkinGauge1.ProgressText:='导入数据请等候。。。'; edi_addseai:=true; OpenDialog1.Execute; FileNames:=OpenDialog1.FileName; if FileNames<>'' then begin EdiStrings.LoadFromFile(FileNames); end; if EdiStrings.Count=0 then exit; frm_main.db.BeginTrans; try frm_sys_progress.Show; frm_sys_progress.bsSkinGauge1.MaxValue:=EdiStrings.Count; frm_sys_progress.bsSkinGauge1.MinValue:=0; frm_sys_progress.bsSkinGauge1.Value:=0; frm_sys_progress.Update; for i:=0 to EdiStrings.Count-1 do begin frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; S:=EdiStrings.Strings[i]; OldHeads:=Heads; Heads:=Copy(S,1,2); if Heads='00' then begin end; if Heads='10' then begin VslID:=GetPosString(S,2); Vessel:=GetPosString(S,3); VoyNo:=GetPosString(S,5); etd:=GetPosString(S,8); eta:=GetPosString(S,9); end; if Heads='11' then begin Carrier:=GetPosString(S,2); end; if Heads='12' then begin if data1.DataSet.State in [dsinsert,dsEdit] then data1.DataSet.Post; data1.DataSet.Insert; data1.DataSet['会计期间']:=wwDBDateTimePicker1.date; if wwDBDateTimePicker2.Text<>'' then data1.DataSet['进口日期']:=wwDBDateTimePicker2.date; data1.DataSet['周次']:=WeekofYear(wwDBDateTimePicker1.date); data1.DataSet['财务']:=0; data1.DataSet['财务凭证']:=''; data1.DataSet['录入人']:=employee; data1.DataSet['录入日期']:=date; data1.DataSet['分部名称']:=subComp; data1.DataSet['操作员']:=employee; data1.DataSet['报关操作']:=employee; data1.DataSet['报检操作']:=employee; data1.DataSet['揽货人']:=employee; data1.DataSet['客服员']:=employee; if wwDBLookupCombo3.Text<>'' then data1.DataSet['卸货港']:=wwDBLookupCombo3.Text else data1.DataSet['卸货港']:=get_parameters_value(17,'QINGDAO,CHINA'); data1.DataSet['付费方式']:=get_parameters_value(23,'FREIGHT PREPAID'); data1.DataSet['货物描述']:=get_parameters_value(117,''); data1.DataSet['收货人']:=get_parameters_value(127,''); data1.DataSet['业务来源']:='自揽货'; data1.DataSet['销售部门']:=department; data1.DataSet['操作部门']:=department; data1.DataSet['是否打印']:=0; if bsSkinCheckRadioBox1.Checked then data1.DataSet['装运方式']:=bsSkinCheckRadioBox1.Caption; if bsSkinCheckRadioBox2.Checked then data1.DataSet['装运方式']:=bsSkinCheckRadioBox2.Caption; if bsSkinCheckRadioBox3.Checked then data1.DataSet['装运方式']:=bsSkinCheckRadioBox3.Caption; if bsSkinCheckRadioBox4.Checked then data1.DataSet['装运方式']:=bsSkinCheckRadioBox4.Caption; if bsSkinCheckRadioBox5.Checked then data1.DataSet['装运方式']:=bsSkinCheckRadioBox5.Caption; if bsSkinCheckRadioBox6.Checked then data1.DataSet['装运方式']:=bsSkinCheckRadioBox6.Caption; if bsSkinCheckRadioBox7.Checked then data1.DataSet['业务类型']:='更改单' else data1.DataSet['业务类型']:='普通货'; data1.DataSet.post; data1.DataSet.edit; data1.DataSet.FieldByName('船名').AsString:=Vessel; data1.DataSet.FieldByName('航次').AsString:=VoyNo; data1.DataSet.FieldByName('主提单号').AsString:=GetPosString(S,2); if wwDBDateTimePicker2.Text<>'' then data1.DataSet['进口日期']:=wwDBDateTimePicker2.date else if eta<>'' then data1.DataSet.FieldByName('进口日期').AsDateTime:=StrToDate(FormatDateStr(ETA)); data1.DataSet.FieldByName('装港代码').AsString:=GetPosString(S,8); data1.DataSet.FieldByName('装货港').AsString:=GetPosString(S,9); data1.DataSet.FieldByName('运输条款').AsString:=GetPosString(S,10); S2:=GetPosString(S,11); if S2='P' then data1.DataSet.FieldByName('付费方式').AsString:='FREIGHT PREPAID' else data1.DataSet.FieldByName('付费方式').AsString:='FREIGHT COLLECT'; if etd<>'' then begin data1.DataSet.FieldByName('开船日期').AsDateTime:=StrToDate(FormatDateStr(ETD)); end else begin s2:=GetPosString(S,12); if s2<>'' then data1.DataSet.FieldByName('开船日期').AsDateTime:=StrToDate(FormatDateStr(s2)); end; data1.DataSet.FieldByName('发货人代码').AsString:=''; data1.DataSet.FieldByName('收货人代码').AsString:=''; data1.DataSet.FieldByName('通知人代码').AsString:=''; data1.DataSet.FieldByName('唛头').AsString:=''; data1.DataSet.FieldByName('货物描述').AsString:=''; end; if Heads='13' then begin data1.DataSet.FieldByName('卸货代码').AsString:=GetPosString(S,4); data1.DataSet.FieldByName('卸货港').AsString:=GetPosString(S,5); end; if Heads='14' then begin end; if Heads='15' then begin end; if Heads='16' then begin data1.DataSet.FieldByName('发货人代码').AsString:=data1.DataSet.FieldByName('发货人代码').AsString+#10#13+GetPosString(S,3); if GetPosString(S,4)<>'' then data1.DataSet.FieldByName('发货人代码').AsString:=data1.DataSet.FieldByName('发货人代码').AsString+#10#13+GetPosString(S,4); if GetPosString(S,5)<>'' then data1.DataSet.FieldByName('发货人代码').AsString:=data1.DataSet.FieldByName('发货人代码').AsString+#10#13+GetPosString(S,5); if GetPosString(S,6)<>'' then data1.DataSet.FieldByName('发货人代码').AsString:=data1.DataSet.FieldByName('发货人代码').AsString+#10#13+GetPosString(S,6); if GetPosString(S,7)<>'' then data1.DataSet.FieldByName('发货人代码').AsString:=data1.DataSet.FieldByName('发货人代码').AsString+#10#13+GetPosString(S,7); if GetPosString(S,8)<>'' then data1.DataSet.FieldByName('发货人代码').AsString:=data1.DataSet.FieldByName('发货人代码').AsString+#10#13+GetPosString(S,8); end; if Heads='17' then begin data1.DataSet.FieldByName('收货人代码').AsString:=data1.DataSet.FieldByName('收货人代码').AsString+#10#13+GetPosString(S,3); if GetPosString(S,4)<>'' then data1.DataSet.FieldByName('收货人代码').AsString:=data1.DataSet.FieldByName('收货人代码').AsString+#10#13+GetPosString(S,4); if GetPosString(S,5)<>'' then data1.DataSet.FieldByName('收货人代码').AsString:=data1.DataSet.FieldByName('收货人代码').AsString+#10#13+GetPosString(S,5); if GetPosString(S,6)<>'' then data1.DataSet.FieldByName('收货人代码').AsString:=data1.DataSet.FieldByName('收货人代码').AsString+#10#13+GetPosString(S,6); if GetPosString(S,7)<>'' then data1.DataSet.FieldByName('收货人代码').AsString:=data1.DataSet.FieldByName('收货人代码').AsString+#10#13+GetPosString(S,7); if GetPosString(S,8)<>'' then data1.DataSet.FieldByName('收货人代码').AsString:=data1.DataSet.FieldByName('收货人代码').AsString+#10#13+GetPosString(S,8); end; if Heads='18' then begin data1.DataSet.FieldByName('通知人代码').AsString:=data1.DataSet.FieldByName('通知人代码').AsString+#10#13+GetPosString(S,3); if GetPosString(S,4)<>'' then data1.DataSet.FieldByName('通知人代码').AsString:=data1.DataSet.FieldByName('通知人代码').AsString+#10#13+GetPosString(S,4); if GetPosString(S,5)<>'' then data1.DataSet.FieldByName('通知人代码').AsString:=data1.DataSet.FieldByName('通知人代码').AsString+#10#13+GetPosString(S,5); if GetPosString(S,6)<>'' then data1.DataSet.FieldByName('通知人代码').AsString:=data1.DataSet.FieldByName('通知人代码').AsString+#10#13+GetPosString(S,6); if GetPosString(S,7)<>'' then data1.DataSet.FieldByName('通知人代码').AsString:=data1.DataSet.FieldByName('通知人代码').AsString+#10#13+GetPosString(S,7); if GetPosString(S,8)<>'' then data1.DataSet.FieldByName('通知人代码').AsString:=data1.DataSet.FieldByName('通知人代码').AsString+#10#13+GetPosString(S,8); end; if Heads='19' then begin end; if Heads='20' then begin end; if Heads='41' then begin data1.DataSet.FieldByName('件数').AsString:=FormatNumStr(GetPosString(S,4)); data1.DataSet.FieldByName('包装').AsString:=GetPosString(S,6); data1.DataSet.FieldByName('重量').AsString:=FormatNumStr(GetPosString(S,7)); data1.DataSet.FieldByName('尺码').AsString:=FormatNumStr(GetPosString(S,9)); end; if Heads='43' then begin end; if Heads='44' then begin data1.DataSet.FieldByName('唛头').AsString:=data1.DataSet.FieldByName('唛头').AsString+#10#13+GetPosString(S,2); if GetPosString(S,3)<>'' then data1.DataSet.FieldByName('唛头').AsString:=data1.DataSet.FieldByName('唛头').AsString+#10#13+GetPosString(S,3); if GetPosString(S,4)<>'' then data1.DataSet.FieldByName('唛头').AsString:=data1.DataSet.FieldByName('唛头').AsString+#10#13+GetPosString(S,4); if GetPosString(S,5)<>'' then data1.DataSet.FieldByName('唛头').AsString:=data1.DataSet.FieldByName('唛头').AsString+#10#13+GetPosString(S,5); if GetPosString(S,6)<>'' then data1.DataSet.FieldByName('唛头').AsString:=data1.DataSet.FieldByName('唛头').AsString+#10#13+GetPosString(S,6); if GetPosString(S,7)<>'' then data1.DataSet.FieldByName('唛头').AsString:=data1.DataSet.FieldByName('唛头').AsString+#10#13+GetPosString(S,7); if GetPosString(S,8)<>'' then data1.DataSet.FieldByName('唛头').AsString:=data1.DataSet.FieldByName('唛头').AsString+#10#13+GetPosString(S,8); if GetPosString(S,9)<>'' then data1.DataSet.FieldByName('唛头').AsString:=data1.DataSet.FieldByName('唛头').AsString+#10#13+GetPosString(S,9); if GetPosString(S,10)<>'' then data1.DataSet.FieldByName('唛头').AsString:=data1.DataSet.FieldByName('唛头').AsString+#10#13+GetPosString(S,10); end; if Heads='47' then begin data1.DataSet.FieldByName('货物描述').AsString:=data1.DataSet.FieldByName('货物描述').AsString+#10#13+GetPosString(S,2); if GetPosString(S,3)<>'' then data1.DataSet.FieldByName('货物描述').AsString:=data1.DataSet.FieldByName('货物描述').AsString+#10#13+GetPosString(S,3); if GetPosString(S,4)<>'' then data1.DataSet.FieldByName('货物描述').AsString:=data1.DataSet.FieldByName('货物描述').AsString+#10#13+GetPosString(S,4); if GetPosString(S,5)<>'' then data1.DataSet.FieldByName('货物描述').AsString:=data1.DataSet.FieldByName('货物描述').AsString+#10#13+GetPosString(S,5); if GetPosString(S,6)<>'' then data1.DataSet.FieldByName('货物描述').AsString:=data1.DataSet.FieldByName('货物描述').AsString+#10#13+GetPosString(S,6); end; if Heads='51' then begin if (not data1.DataSet.FieldByName('编号').IsNull) and (data1.DataSet.FieldByName('编号').AsString<>'') then begin aQuery:=createAdoQuery; aQuery2:=createAdoQuery; try with aQuery do begin Close;sql.clear; sql.Add('select * from t_op_ctn where 编号=:编号'); DataSource:=data1; open; aQuery2.close;aQuery2.sql.Clear; aQuery2.SQL.Add('select * from t_code_ctn where edi代码='''+GetPosString(S,5)+''''); aQuery2.Open; if not aQuery2.IsEmpty then begin Insert; FieldByName('代码').AsString:=aQuery2.fieldbyname('代码').AsString; FieldByName('箱型').AsString:=aQuery2.fieldbyname('箱型').AsString; FieldByName('尺寸').AsString:=aQuery2.fieldbyname('尺寸').AsString; FieldByName('表现形式').AsString:=aQuery2.fieldbyname('表现形式').AsString; FieldByName('数量').AsInteger:=1; if aQuery2.fieldbyname('尺寸').AsString='20'then FieldByName('TEU').AsInteger:=1; if (aQuery2.fieldbyname('尺寸').AsString='40') OR (aQuery2.fieldbyname('尺寸').AsString='45') then FieldByName('TEU').AsInteger:=2; FieldByName('箱号').AsString:=GetPosString(S,3); FieldByName('封号').AsString:=GetPosString(S,4); FieldByName('件数').AsString:=FormatNumStr(GetPosString(S,7)); FieldByName('重量').AsString:=FormatNumStr(GetPosString(S,8)); FieldByName('尺码').AsString:=FormatNumStr(GetPosString(S,10)); Post; if data1.DataSet.fieldbyname('箱号封号').asstring='' then begin data1.DataSet.edit; data1.DataSet.fieldbyname('箱号封号').asstring:=GetPosString(S,3)+'/'+GetPosString(S,4); end else begin data1.DataSet.edit; data1.DataSet.fieldbyname('箱号封号').asstring:=data1.DataSet.fieldbyname('箱号封号').asstring+#13#10+ GetPosString(S,3)+'/'+GetPosString(S,4); end; end; if not IsEmpty then update_ctn(aQuery); end; finally FreeAndNil(aQuery); FreeAndNil(aQuery2); end; end; end; if Heads='99' then begin if data1.DataSet.State in [dsinsert,dsEdit] then data1.DataSet.Post; end; { if Heads='51' then begin if Pos(GetPosString(S,5),dddd)<=0 then dddd:=dddd+':'+GetPosString(S,5); end; } end; frm_main.db.CommitTrans; except showmessage('导入数据时发生错误,没有正常导入!'); frm_main.db.RollbackTrans; end; finally showmessage(dddd); frm_sys_progress.close; frm_sys_progress:=nil; edi_addseai:=true; FreeAndNil(EdiStrings); end; frm_op_seai.notebook1.pageindex:=0; close; end; end.