$PBExportHeader$w_outware_fx.srw $PBExportComments$分销系统--销售订单发货 forward global type w_outware_fx from w_publ_base_style end type type dw_1 from u_dw_rbtnfilter within w_outware_fx end type type st_1 from statictext within w_outware_fx end type type sle_1 from singlelineedit within w_outware_fx end type type st_2 from statictext within w_outware_fx end type type cb_1 from commandbutton within w_outware_fx end type end forward global type w_outware_fx from w_publ_base_style integer y = 388 integer width = 3562 integer height = 1677 string title = "发货明细" boolean minbox = false windowtype windowtype = response! long backcolor = 16777215 string icon = "graphics\chain_link_128px.ico" boolean center = true dw_1 dw_1 st_1 st_1 sle_1 sle_1 st_2 st_2 cb_1 cb_1 end type global w_outware_fx w_outware_fx type variables int ins_rslt = 0 // 0 - 无操作返回 1 - 操作成功返回 end variables forward prototypes public function integer wf_retrieve (readonly datastore arg_ds) public function integer wf_sendoutware (ref string arg_msg) end prototypes public function integer wf_retrieve (readonly datastore arg_ds);int rslt = 1 dw_1.ReSet() dw_1.SetRedraw(false) long row, i Datetime ld_now ld_now = DateTime(Today(),Now()) for i = 1 to arg_ds.RowCount() if (arg_ds.Object.qty[i] <= arg_ds.Object.cus_receiveqty[i] + arg_ds.Object.qty_wait[i]) then continue // '齐货' 跳过 row = dw_1.InsertRow(0) dw_1.Object.taskid[row] = arg_ds.Object.taskid[i] dw_1.Object.printid[row] = arg_ds.Object.printid[i] dw_1.Object.mxcode[row] = arg_ds.Object.mxcode[i] dw_1.Object.fxmtrlid[row] = arg_ds.Object.fxmtrlid[i] dw_1.Object.mtrlid[row] = arg_ds.Object.mtrlid[i] dw_1.Object.mtrlcode[row] = arg_ds.Object.mtrlcode[i] dw_1.Object.mtrlname[row] = arg_ds.Object.mtrlname[i] dw_1.Object.mtrlmode[row] = arg_ds.Object.mtrlmode[i] dw_1.Object.status[row] = arg_ds.Object.status[i] dw_1.Object.woodcode[row] = arg_ds.Object.woodcode[i] dw_1.Object.pcode[row] = arg_ds.Object.pcode[i] dw_1.Object.qty[row] = arg_ds.Object.qty[i] dw_1.Object.qty_wait[row] = arg_ds.Object.qty_wait[i] dw_1.Object.cus_receiveqty[row] = arg_ds.Object.cus_receiveqty[i] IF arg_ds.Object.earliestsenddate[i] > ld_now THEN dw_1.Object.outqty[row] = 0 ELSE dw_1.Object.outqty[row] = arg_ds.Object.qty[i] - arg_ds.Object.cus_receiveqty[i] - arg_ds.Object.qty_wait[i] END IF dw_1.Object.outwarecode[row] = '' dw_1.Object.requiredate[row] = arg_ds.Object.requiredate[i] // dw_1.Object.price[row] = arg_ds.Object.price[i] dw_1.Object.mxdscrp[row] = arg_ds.Object.mxdscrp[i] dw_1.Object.mxdscrp2[row] = arg_ds.Object.mxdscrp2[i] dw_1.Object.mtrlcuscode[row] = arg_ds.Object.mtrlcuscode[i] dw_1.Object.plancode[row] = arg_ds.Object.plancode[i] dw_1.Object.cus_mtrldef_senddays[row] = arg_ds.Object.cus_mtrldef_senddays[i] dw_1.Object.earliestsenddate[row] = arg_ds.Object.earliestsenddate[i] next dw_1.SetRedraw(true) return rslt end function public function integer wf_sendoutware (ref string arg_msg);int rslt = 1 if (dw_1.RowCount() <= 0) then rslt = 0 arg_msg = '没有发货明细' goto ext end if oleobject item, list list = FXAppCom.CreArrOfPbDictionary() long i, cnt = 0 DateTime ld_now ld_now = DateTime(Today(),Now()) for i = 1 to dw_1.RowCount() if (dw_1.Object.earliestsenddate[i] > ld_now) then dw_1.Object.outqty[i] = 0 if (dw_1.Object.outqty[i] <= 0) then continue cnt ++ item = FXAppCom.CreatePbDictionary() item.SetInt('taskid', dw_1.Object.taskid[i]) item.SetInt('printid', dw_1.Object.printid[i]) item.SetDouble('qty', dw_1.Object.outqty[i]) item.SetString('mxcode', dw_1.Object.outwarecode[i]) // 暂时存放相关发货单号(非明细编号) item.SetInt('mtrlid', dw_1.Object.mtrlid[i]) list.Add(item) next if (cnt <= 0) then rslt = 0 arg_msg = '没有发货数大于0的明细' goto ext end if Open(w_packet_msg_edit_fx) s_open_packet s_tran s_tran = Message.PowerObjectParm if (s_tran.returnflag = 0) then rslt = 0 arg_msg = '操作取消' goto ext end if string postscript postscript = s_tran.postscript FXAppCom.SendOutwareMx(app_token_fx, postscript, list, ref arg_msg) if (arg_msg <> '') then rslt = 0 goto ext end if ext: return rslt end function on w_outware_fx.create int iCurrent call super::create this.dw_1=create dw_1 this.st_1=create st_1 this.sle_1=create sle_1 this.st_2=create st_2 this.cb_1=create cb_1 iCurrent=UpperBound(this.Control) this.Control[iCurrent+1]=this.dw_1 this.Control[iCurrent+2]=this.st_1 this.Control[iCurrent+3]=this.sle_1 this.Control[iCurrent+4]=this.st_2 this.Control[iCurrent+5]=this.cb_1 end on on w_outware_fx.destroy call super::destroy destroy(this.dw_1) destroy(this.st_1) destroy(this.sle_1) destroy(this.st_2) destroy(this.cb_1) end on event open;call super::open;datastore ds ds = Message.PowerObjectParm if (IsNull(ds)) then MessageBox('提示', '打开方式有误') Close(this) return elseif (ds.DataObject <> 'dw_fx_saletaskmx') then MessageBox('提示', '传递数据有误') Close(this) return end if string arg_msg if (f_find_fx_user_power(31, ref arg_msg) <> 1) then // 31-销售订单发货 MessageBox('权限提示', arg_msg) Close(this) return end if wf_retrieve(ds) end event event close;call super::close;CloseWithReturn(this, ins_rslt) end event event resize;call super::resize;dw_1.Width = this.workspacewidth( ) dw_1.Height = this.workspaceheight( ) - dw_1.Y cb_exit.X = this.workspacewidth( ) - cb_exit.Width end event type cb_func from w_publ_base_style`cb_func within w_outware_fx integer width = 274 string text = "确认发货" string normalpicname = "ok.bmp" integer picsize = 16 end type event cb_func::clicked;call super::clicked;if (dw_1.RowCount() <= 0) then MessageBox('提示', '没有发货明细') return end if dw_1.AcceptText() boolean pass = true string sum_msg long i DateTime ld_now ld_now = DateTime(Today(),Now()) for i = 1 to dw_1.RowCount() if (Trim(dw_1.Object.outwarecode[i]) = '') then sum_msg += '第' + string(i) + '行,相关发货单号为空(可选填)~r~n' end if IF (dw_1.Object.outqty[i] = 0) THEN IF dw_1.Object.earliestsenddate[i] > ld_now THEN sum_msg += '第' + string(i) + '行,物料名称[' + dw_1.OBject.mtrlname[i] + '],当前时间未到最早发货时间,将跳过本次发货~r~n' END IF ELSEIF (dw_1.Object.outqty[i] = 0) then sum_msg += '第' + string(i) + '行,物料名称[' + dw_1.OBject.mtrlname[i] + '],本次发货数为0~r~n' elseif (dw_1.Object.outqty[i] < 0) then sum_msg += '第' + string(i) + '行,物料名称[' + dw_1.OBject.mtrlname[i] + '],发货数必须大于0~r~n' pass = false end if if (dw_1.Object.outqty[i] + dw_1.Object.cus_receiveqty[i] + dw_1.Object.qty_wait[i] > dw_1.Object.qty[i]) then sum_msg += '第' + string(i) + '行,物料名称[' + dw_1.OBject.mtrlname[i] + '],总发货数大于订单下单数~r~n' pass = false end if next if (not pass) then MessageBox('提示', sum_msg) return end if int ret = 1 if (sum_msg <> '') then ret = MessageBox('提示', sum_msg + '确定继续?', Question!, YesNoCancel!) end if if (ret <> 1) then return string arg_msg ret = wf_sendoutware(ref arg_msg) if (ret = 0) then MessageBox('提示', '发货操作失败:' + arg_msg) else ins_rslt = 1 MessageBox('提示', '操作成功!') Close(parent) end if end event type cb_exit from w_publ_base_style`cb_exit within w_outware_fx integer x = 2754 end type type ln_bar from w_publ_base_style`ln_bar within w_outware_fx end type type ln_bar2 from w_publ_base_style`ln_bar2 within w_outware_fx end type type r_bar from w_publ_base_style`r_bar within w_outware_fx end type type dw_1 from u_dw_rbtnfilter within w_outware_fx integer y = 272 integer width = 3350 integer height = 1267 integer taborder = 20 boolean bringtotop = true string dataobject = "dw_fx_outware" boolean hscrollbar = true boolean vscrollbar = true boolean hsplitscroll = true boolean rbutton_setposition_use = true boolean titleclick_sort_use = true end type event clicked;call super::clicked;if (row <= 0) then return this.SelectRow(0, false) this.SelectRow(row, true) end event event itemfocuschanged;call super::itemfocuschanged;if (row > 0) then this.SelectRow(0, false) this.SelectRow(row, true) this.SetRow(row) string colName colName = this.GetColumnName() if (colName = 'outqty' or colName = 'outwarecode') then this.SelectText(1, Len(this.GetText())) end if end if end event type st_1 from statictext within w_outware_fx integer y = 195 integer width = 508 integer height = 48 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 long backcolor = 16777215 string text = "相关发货单号批设置" boolean focusrectangle = false end type type sle_1 from singlelineedit within w_outware_fx integer x = 512 integer y = 179 integer width = 614 integer height = 83 integer taborder = 20 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 borderstyle borderstyle = stylelowered! end type event modified;if (dw_1.RowCount() <= 0) then return long i for i = 1 to dw_1.RowCount() dw_1.Object.outwarecode[i] = this.Text next this.Text = '' end event type st_2 from statictext within w_outware_fx integer x = 1148 integer y = 195 integer width = 315 integer height = 48 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 long backcolor = 16777215 string text = "(回车执行)" boolean focusrectangle = false end type type cb_1 from commandbutton within w_outware_fx boolean visible = false integer x = 1434 integer y = 179 integer width = 439 integer height = 83 integer taborder = 30 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" string text = "获取新发货单号" end type event clicked;oleobject request, response string arg_msg request = FXAppCom.CreatePbDictionary() request.SetString('token', app_token_fx) request.SetString('prefix', '#') request.SetString('suffix', 'FH') response = FXAppCom.DoExecute('GetBillCode', request) arg_msg = response.GetString('ErrMsg') if arg_msg <> '' then MessageBox('ERROR', arg_msg) return end if oleobject list list = response.GetPBArray('billcodeList') long cnt cnt = list.Count if cnt < 0 then MessageBox('ERROR', '单号列表为空') return end if sle_1.Text = list.GetString(0) end event