コード例 #1
0
ファイル: ReviewController.cs プロジェクト: shew990/TaiBang
        //扫描序列号和EAN
        public JsonResult getbarcode(T_StockInfo model)
        {
            if (currentUser == null)
            {
                return(Json(new { state = false, obj = "Cookie失效,重新登陆!" }, JsonRequestBehavior.AllowGet));
            }
            model.ScanType = 3;
            List <T_StockInfo>          modelList          = new List <T_StockInfo>();
            List <T_OutStockDetailInfo> outStockDetailList = new List <T_OutStockDetailInfo>();
            string strError           = "";
            T_OutStockDetail_Func fun = new T_OutStockDetail_Func();
            int  ID        = 0;
            bool isSuccess = fun.GetReviewStockModel(currentUser, model, ref modelList, ref outStockDetailList, ref ID, ref strError);

            if (isSuccess && model.Barcode.Contains("@") && outStockDetailList.Count > 0)
            {
                for (int i = 0; i < outStockDetailList.Count; i++)
                {
                    if (outStockDetailList[i].ID == ID)
                    {
                        outStockDetailList[i].isLight = true;
                    }
                    else
                    {
                        outStockDetailList[i].isLight = false;
                    }
                }
                return(Json(new { state = isSuccess, obj = outStockDetailList, type = "1" }, JsonRequestBehavior.AllowGet));
            }
            if (isSuccess && !model.Barcode.Contains("@") && modelList.Count > 0)
            {
                return(Json(new { state = isSuccess, obj = modelList, type = "2" }, JsonRequestBehavior.AllowGet));
            }
            return(Json(new { state = isSuccess, obj = strError }, JsonRequestBehavior.AllowGet));
        }
コード例 #2
0
ファイル: ReviewController.cs プロジェクト: shew990/TaiBang
        public JsonResult scanEAN(T_StockInfo model)
        {
            if (currentUser == null)
            {
                return(Json(new { state = false, obj = "Cookie失效,重新登陆!" }, JsonRequestBehavior.AllowGet));
            }
            if (model.Barcode.Contains("@"))
            {
                return(Json(new { state = false, obj = "扫描物料标签不能修改数量!" }, JsonRequestBehavior.AllowGet));
            }
            else
            {
                model.ScanType = 3;
            }
            List <T_OutStockDetailInfo> outStockDetailList = new List <T_OutStockDetailInfo>();
            string strError           = "";
            T_OutStockDetail_Func fun = new T_OutStockDetail_Func();

            //重新构造库存类
            T_StockInfo modelnew = new T_StockInfo();

            modelnew.ErpVoucherNo = model.ErpVoucherNo;
            modelnew.Barcode      = model.Barcode;
            List <T_StockInfo> modelList = new List <T_StockInfo>();
            int  ID         = 0;
            bool isSuccessF = fun.GetReviewStockModel(currentUser, model, ref modelList, ref outStockDetailList, ref ID, ref strError);

            if (isSuccessF && modelList != null && modelList.Count > 0)
            {
                //第二次进来带了materialnoid
                if (model.MaterialNoID != 0)
                {
                    foreach (T_StockInfo item in modelList)
                    {
                        if (item.MaterialNoID == model.MaterialNoID)
                        {
                            modelnew = item;
                            break;
                        }
                    }
                    if (modelnew.MaterialNoID == 0)
                    {
                        return(Json(new { state = false, obj = "没有找到对应的条码!" }, JsonRequestBehavior.AllowGet));
                    }
                }
                else
                {
                    modelnew = modelList[0];
                }
            }
            else
            {
                return(Json(new { state = isSuccessF, obj = strError }, JsonRequestBehavior.AllowGet));
            }
            if (model.ScanQty > modelnew.Qty)
            {
                return(Json(new { state = false, obj = "提交数量不能超过库存数量!" }, JsonRequestBehavior.AllowGet));
            }
            modelnew.Barcode      = model.Barcode;
            modelnew.ErpVoucherNo = model.ErpVoucherNo;
            modelnew.ScanQty      = model.ScanQty;
            modelnew.ScanQty      = model.ScanQty;
            bool isSuccess = fun.SaveT_OutStockReviewDetailENA(currentUser, modelnew, ref outStockDetailList, ref ID, ref strError);

            if (isSuccess)
            {
                for (int i = 0; i < outStockDetailList.Count; i++)
                {
                    if (outStockDetailList[i].ID == ID)
                    {
                        outStockDetailList[i].isLight = true;
                    }
                    else
                    {
                        outStockDetailList[i].isLight = false;
                    }
                }
                return(Json(new { state = isSuccess, obj = outStockDetailList }, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(new { state = isSuccess, obj = strError }, JsonRequestBehavior.AllowGet));
            }
        }