Exemple #1
0
        public string Data(int page             = 1, int rows = 15,
                           string productname   = null,
                           string stockname     = null,
                           string productnumber = null,
                           string wdr           = null,
                           string batchno       = null,
                           string brand         = null,
                           string mode          = null,
                           string colorno       = null)
        {
            if (!string.IsNullOrEmpty(brand) && (!string.IsNullOrEmpty(productname) || !string.IsNullOrEmpty(mode) || !string.IsNullOrEmpty(stockname) || !string.IsNullOrEmpty(colorno)))
            {
                int pagecount = 0;
                APIService.APIServiceClient api = new APIService.APIServiceClient();
                DataTable table = api.WmStock(
                    out pagecount,
                    productnumber,
                    productname,
                    stockname,
                    brand,
                    batchno,
                    wdr,
                    mode,
                    colorno,
                    rows,
                    page, true, false);

                return(JSONhelper.FormatJSONForEasyuiDataGrid(pagecount, table));
            }
            return(null);
        }
Exemple #2
0
        public string SRCData(string itemid = null, string ICPRBILLNO = null, string FICPRENTRYID = null, string FSTOCK = null)
        {
            List <object> list = new List <object>();

            List <string> srcnumbers = new List <string>();
            var           srclist    = SRCDal.Instance.GetWhere(new { FPRODUCTID = itemid }).ToList();

            foreach (var model in srclist)
            {
                srcnumbers.Add(model.FSRCCODE);
            }
            int pagecount = 0;

            APIService.APIServiceClient api = new APIService.APIServiceClient();
            DataTable table = api.WmStock(out pagecount, string.Join(",", srcnumbers.ToArray()), "", FSTOCK, "", "", "", "", "", 1000, 1, true, false);

            foreach (var model in srclist)
            {
                var query = table.AsEnumerable().Where <DataRow>(m => m["FNumber"].ToString() == model.FSRCCODE);
                foreach (var row in query)
                {
                    list.Add(new
                    {
                        FID          = model.FID,
                        FPRODUCTID   = model.FPRODUCTID,
                        FSRCNAME     = model.FSRCNAME,
                        FSRCCODE     = model.FSRCCODE,
                        FSRCMODEL    = model.FSRCMODEL,
                        FSRCUNIT     = model.FUNIT,
                        FORDERUNIT   = model.FORDERUNIT,
                        FRATE        = model.FRATE,
                        FBATCHNO     = row["FBatchNo"],
                        FCOLORNO     = row["FColorNo"],
                        FSTOCK       = row["FStockName"],
                        FSTOCKPLACE  = row["FSPName"],
                        FQTY         = row["FBasicQty"],
                        FLEVEL       = row["FGrade"],
                        FWDR         = row["FWDRID"],
                        FCOMMITQTY   = System.DBNull.Value,
                        FHNAMOUNT    = 0,
                        ICPRBILLNO   = ICPRBILLNO,
                        FICPRENTRYID = FICPRENTRYID,
                        FREMARK      = ""
                    });
                }
            }

            return(JSONhelper.FormatJSONForEasyuiDataGrid(list.Count, list));
        }
Exemple #3
0
        public string Sync(FormCollection context)
        {
            try
            {
                string resultjson = "";
                string ids        = context["ids"];

                string[] array = ids.Split(',');
                foreach (string id in array)
                {
                    APIService.APIServiceClient api = new APIService.APIServiceClient();

                    var icseoutlist      = V_ICSEOUTBILLDAL.Instance.GetWhere(new { FID = id });
                    var icseoutentrylist = V_ICSEOUTBILLENTRYDAL.Instance.GetWhere(new { FICSEOUTID = id });

                    resultjson = api.ICSEOUTBILLSync(icseoutlist.ToArray(), icseoutentrylist.ToArray());
                    if (!string.IsNullOrEmpty(resultjson))
                    {
                        DataResult result = JSONhelper.ConvertToObject <DataResult>(resultjson);
                        if (result != null)
                        {
                            ICSEOUTBILLDAL.Instance.UpdateWhatWhere(new { FFACTORYSTATUS = 1, FSYNCSTATUS = 1 }, new { FID = id });
                            ICSEOUTBILLENTRYDAL.Instance.UpdateWhatWhere(new { FERR_MESSAGE = "" }, new { FICSEOUTID = id });
                        }

                        LogHelper.WriteLog(resultjson);
                    }
                }

                return(resultjson);
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog(ex);
                return(JSONhelper.ToJson(ex.Message));
            }
        }