做安卓手持时,需要将扫描到的轮胎条码号传递给后台接口,由于是二维数组后台不知该如何接收,再次记录下;
前台post数据:
items: any = {
'one': [],
'two': [],
'three': [],
'four': [],
'five': []
};
inStorageConfim() {
if (this.items["one"].length == 0 && this.items["two"].length == 0 && this.items["three"].length == 0
&& this.items["four"].length == 0 && this.items["five"].length == 0) {
this.appService.toast('请先扫描轮胎再入库');
} else if (this.alertInputValue == null) {
this.appService.toast('请选择站台');
} else {
// 入库操作
var postA = new Array();
postA[0] = this.getItems('one');
postA[1] = this.getItems('two');
postA[2] = this.getItems('three');
postA[3] = this.getItems('four');
postA[4] = this.getItems('five');
this.appService.httpPost(AppGlobal.API.sendBarcode, { TyreList: postA }, rs => { });
}
}
后台部分:
[HttpPost]
public void ReceiveBarcode([FromBody] ProductsIDList tyreInfo)
{
Console.WriteLine(tyreInfo.TyreList);
Console.ReadLine();
}
public class TyreInStorage
{
public int BAT_QTY { get; set; }
public int EACH_BAT_QTY { get; set; }
public string PalletNo { get; set; }
public string Barcode { get; set; }
public string PRODUCT_ID { get; set; }
public string PRODUCT_GUID { get; set; }
public string STACK_IDX { get; set; }
public string LAYRE_IDX { get; set; }
}
public class ProductsIDList
{
//重点
public List<List<TyreInStorage>> TyreList { get; set; }
public string PalletNo { get; set; }
public string LocNo { get; set; }
}