- Function description
- Code implementation
- Algorithm requirements
Back to top function description on the PDA, by scanning the order number, query the item number, size, number of orders, as well as the warehouse location commodity "SKU", showing the location of the product, inventory quantity, the number of matching. Because the PDA interface is small, the table split is displayed as two, and the code is correspondingly more complex. Back to the top of the code implementation
/// <summary> ///read head data processing/// </summary> Private voidHandledata (Symbol.Barcode.ReaderData thereaderdata) {//Order Matching if(Tc_container. SelectedIndex = =1) {Txtwmsno.text=Thereaderdata.text; Bindorderdetailgrid (TxtWmsNo.Text.Trim ()); Btnadaptor_click (NULL,NULL); } }
Private voidBindorderdetailgrid (stringWmsid) {lv_Order.Items.Clear (); Try{_allorderdetail=_repository. Getorderdetail (WMSID); if(_allorderdetail.any ()) {foreach(OrderDetail detailinch_allorderdetail) {ListViewItem Item=NewListViewItem (); Item. subitems[0]. Text =detail. Styleno; Item. SubItems.Add (detail. Size); Item. SubItems.Add (detail. Ordernum.tostring ());//Number of ordersLV_ORDER.ITEMS.ADD (item); } } } Catch(Exception ex) {MessageBox.Show ("Query Error:"+Ex. Message); Btnexit_click (NULL,NULL); } }
//Batch Fit Private voidBtnadaptor_click (Objectsender, EventArgs e) { if(string. IsNullOrEmpty (TxtWmsNo.Text.Trim ()) | | Txtwmsno.text = ="Scan WMS Number ...") {MessageBox.Show ("please scan Wmsid first. ","Operation Tips", Messageboxbuttons.okcancel, Messageboxicon.asterisk, Messageboxdefaultbutton.button1); return; } if(_repository. Exitswmsid (TxtWmsNo.Text.Trim ())) {DialogResult result= MessageBox.Show ("the number has already been fitted, do you want to continue? ","Operation Tips", Messageboxbuttons.okcancel, Messageboxicon.asterisk, Messageboxdefaultbutton.button1); if(Result! =DialogResult.OK) {lv_Adaptor.Items.Clear (); return; }} _differenceqty=0; _list. Clear (); Try{_goodlist= _repository. Getgoodslist (string. Join (",", _allorderdetail.select (c=>"'"+c.styleno+"'"). ToArray ())); } Catch(Exception ex) {MessageBox.Show ("Query Error:"+Ex. Message); Btnexit_click (NULL,NULL); } if(_goodlist.any ()) {_allorderdetail.foreach (Order= = Bindadaptorgrid (_goodlist.where (c = C.styleno = = Order. Styleno). ToList (), order. Size, order. Ordernum,false)); } if(_list. Any ()) {_list. ForEach (o=lv_Adaptor.Items.Add (o)); Btnsave.enabled=true; Lbl_difnum.text="total number of differences:"+_differenceqty; Lblmsg.text="fit successfully, please save!"; } Else{btnsave.enabled=false; Lblmsg.text="fit failed, please maintain inventory first!"; } }
/// <summary> ///Binding Adapter Table///if the number is equal, the location matches/// </summary> /// <param name= "Ordernum" >Number of orders</param> /// <param name= "Issingle" >is a single paragraph</param> Private voidBindadaptorgrid (list<pda_tgoods> Goodsbystyleno,stringSizeintOrdernum,BOOLissingle) {lv_Adaptor.Items.Clear (); Lblmsg.text=string. Empty; _ordernum=Ordernum; List<GoodsSummary> Summary_goods =getgoodssummary (Goodsbystyleno); if(Summary_goods. Any ()) {intStocksumnum = Goodsbystyleno.count ();//Total number of inventory BOOLIsbreak =false; //Variance Number algorithm: [Order number >= Inventory Sum--Variance = number of orders-inventory number, order count < inventory sum--number of differences =0] intSingledifnum = (_ordernum >= stocksumnum? _ordernum-stocksumnum:0); _differenceqty+=Singledifnum; if(issingle) Lbl_difnum.text="single-Paragraph differences:"+Singledifnum; foreach(varGinchsummary_goods) {ListViewItem Item=NewListViewItem (); Item. subitems[0]. Text = G.styleno;//locationItem. SubItems.Add (G.stockno.tostring ());//Number of stocksItem. SubItems.Add (G.skunum.tostring ());//Number of stocks//Adaptive number algorithm://(1) Number of orders >= the sum of the stock number and the number of matching = inventory; //(2) Number of orders < inventory sum--Number of allocations = allocation of the number of any location (must = number of orders) intAdaptornum =0; if(_ordernum >=stocksumnum) Adaptornum=G.skunum; ElseAdaptornum= Getadaptornum (_ordernum, G.skunum, outisbreak); Item. SubItems.Add (Adaptornum.tostring ()); //item. SubItems.Add (G.sku); //barcode [not visible]Item. SubItems.Add (size);//size [not visible] if(issingle) LV_ADAPTOR.ITEMS.ADD (item); Else_list. ADD (item); if(Isbreak) Break;//Fit to, no other location is to be fitted } } } //calculate the number of adaptations Private intGetadaptornum (intOrdernum,intStocknum, out BOOLisbreak) { intAdptornum =0; if(Ordernum >=stocknum) {Adptornum=Stocknum; Isbreak=false; } Else{adptornum=_ordernum; Isbreak=true; } _ordernum= _ordernum-Stocknum; if(_ordernum = =0) Isbreak=true; returnAdptornum; }
/// <summary> ///summarize the total number of items by section and do the sorting/// </summary> /// <param name= "Pda_tgoods" ></param> /// <returns></returns> Private StaticList<goodssummary> Getgoodssummary (list<pda_tgoods>goods) {List<GoodsSummary> Summary_goods =NewList<goodssummary>(); foreach(varGinchGoods. GroupBy (o =New{o.stockno, O.styleno})) {goodssummary GT=Newgoodssummary (); Gt. Skunum=G.count (); Gt. Stockno=G.first (). Stockno; Gt. Styleno=G.first (). Styleno; Summary_goods. ADD (GT); } //large inventory priority; Equal quantity, location priority policy returnSummary_goods. OrderByDescending (o = o.skunum). ThenBy (o =o.stockno). ToList (); }
Back to top algorithm requirements(1) Order number >= The sum of the stock number is the appropriate number = inventory number;
(2) Number of orders < Total number of items in stock = allocation of number of any location (must = number of orders)
(3) The location of large inventory priority adaptation; an equal number of location, a small location number of priority adaptation strategy
An adaptive algorithm of PDA location commodity out-store