示例#1
0
 public AddSmartWatch(ProductServiceClient productServiceClient, ManufacturerServiceClient manufacturerServiceClient, ConnectionTypeServiceClient connectionTypeServiceClient)
 {
     InitializeComponent();
     _productServiceClient        = productServiceClient;
     _manufacturerServiceClient   = manufacturerServiceClient;
     _connectionTypeServiceClient = connectionTypeServiceClient;
 }
示例#2
0
        //
        // GET: /FMM/Manufacturer/Detail
        public async Task <ActionResult> Detail(string key)
        {
            using (ManufacturerServiceClient client = new ManufacturerServiceClient())
            {
                MethodReturnResult <Manufacturer> result = await client.GetAsync(key);

                if (result.Code == 0)
                {
                    ManufacturerViewModel viewModel = new ManufacturerViewModel()
                    {
                        Name        = result.Data.Name,
                        Code        = result.Data.Key,
                        NickName    = result.Data.NickName,
                        CreateTime  = result.Data.CreateTime,
                        Creator     = result.Data.Creator,
                        Description = result.Data.Description,
                        Editor      = result.Data.Editor,
                        EditTime    = result.Data.EditTime
                    };
                    return(PartialView("_InfoPartial", viewModel));
                }
                else
                {
                    ModelState.AddModelError("", result.Message);
                }
            }
            return(PartialView("_InfoPartial"));
        }
示例#3
0
 public AddElectronicBook(ProductServiceClient productServiceClient, ManufacturerServiceClient manufacturerServiceClient, ScreenTypeServiceClient screenTypeServiceClient)
 {
     InitializeComponent();
     _productServiceClient      = productServiceClient;
     _manufacturerServiceClient = manufacturerServiceClient;
     _screenTypeServiceClient   = screenTypeServiceClient;
 }
示例#4
0
        public async Task <ActionResult> SaveModify(ManufacturerViewModel model)
        {
            using (ManufacturerServiceClient client = new ManufacturerServiceClient())
            {
                MethodReturnResult <Manufacturer> result = await client.GetAsync(model.Code);

                if (result.Code == 0)
                {
                    result.Data.Name        = model.Name;
                    result.Data.NickName    = model.NickName;
                    result.Data.Description = model.Description;
                    result.Data.Editor      = User.Identity.Name;
                    result.Data.EditTime    = DateTime.Now;
                    MethodReturnResult rst = await client.ModifyAsync(result.Data);

                    if (rst.Code == 0)
                    {
                        rst.Message = string.Format(FMMResources.StringResource.Manufacturer_SaveModify_Success
                                                    , model.Code);
                    }
                    return(Json(rst));
                }
                return(Json(result));
            }
        }
示例#5
0
        //
        // POST: /FMM/Manufacturer/Save
        //[HttpPost]
        //[ValidateAntiForgeryToken]
        public async Task <ActionResult> Save(ManufacturerViewModel model)
        {
            using (ManufacturerServiceClient client = new ManufacturerServiceClient())
            {
                Manufacturer obj = new Manufacturer()
                {
                    Key         = model.Code.ToString().Trim(), //新增供应商代码不可包含空格
                    Name        = model.Name,                   //由于现有错误,供应商名称可以有空格
                    NickName    = model.NickName,
                    Description = model.Description,
                    Editor      = User.Identity.Name,
                    EditTime    = DateTime.Now,
                    CreateTime  = DateTime.Now,
                    Creator     = User.Identity.Name
                };
                MethodReturnResult rst = await client.AddAsync(obj);

                if (rst.Code == 0)
                {
                    rst.Message = string.Format(FMMResources.StringResource.Manufacturer_Save_Success
                                                , model.Code);
                }
                return(Json(rst));
            }
        }
示例#6
0
 public AddProducts(ProductServiceClient productServiceClient, ManufacturerServiceClient manufacturerServiceClient, ConnectionTypeServiceClient connectionTypeServiceClient, ScreenTypeServiceClient screenTypeServiceClient)
 {
     InitializeComponent();
     _productServiceClient        = productServiceClient;
     _manufacturerServiceClient   = manufacturerServiceClient;
     _connectionTypeServiceClient = connectionTypeServiceClient;
     _screenTypeServiceClient     = screenTypeServiceClient;
 }
示例#7
0
 public MainForm()
 {
     InitializeComponent();
     _productServiceClient        = new ProductServiceClient();
     _manufacturerServiceClient   = new ManufacturerServiceClient();
     _screenTypeServiceClient     = new ScreenTypeServiceClient();
     _connectionTypeServiceClient = new ConnectionTypeServiceClient();
 }
示例#8
0
        //获取经供应商转换所得生产厂商信息
        public Manufacturer GetSupplierToManufacturer(string materialCode, string orderNumber, Supplier s)
        {
            Manufacturer mf = null;

            if (s != null)
            {
                using (SupplierToManufacturerServiceClient clients = new SupplierToManufacturerServiceClient())
                {
                    PagingConfig cfg0 = new PagingConfig()
                    {
                        Where = string.Format(@"Key.MaterialCode='{0}' AND Key.SupplierCode='{1}'"
                                              , materialCode
                                              , s.Key)
                    };
                    MethodReturnResult <IList <SupplierToManufacturer> > result = clients.Gets(ref cfg0);
                    if (result.Code <= 0 && result.Data.Count > 0)
                    {
                        if (result.Data[0].Key.OrderNumber == "*")
                        {
                            using (ManufacturerServiceClient clientss = new ManufacturerServiceClient())
                            {
                                MethodReturnResult <Manufacturer> rsts = clientss.Get(result.Data[0].ManufacturerCode);
                                if (rsts.Data != null)
                                {
                                    mf = rsts.Data;
                                }
                            }
                        }
                        else
                        {
                            PagingConfig cfg1 = new PagingConfig()
                            {
                                Where = string.Format(@"Key.MaterialCode='{0}' AND Key.OrderNumber='{1}' AND Key.SupplierCode='{2}'"
                                                      , materialCode
                                                      , orderNumber
                                                      , s.Key)
                            };
                            MethodReturnResult <IList <SupplierToManufacturer> > results = clients.Gets(ref cfg1);
                            if (results.Code <= 0 && results.Data.Count > 0)
                            {
                                using (ManufacturerServiceClient clientss = new ManufacturerServiceClient())
                                {
                                    MethodReturnResult <Manufacturer> rsts = clientss.Get(results.Data[0].ManufacturerCode);
                                    if (rsts.Data != null)
                                    {
                                        mf = rsts.Data;
                                    }
                                }
                            }
                        }
                    }
                }
            }
            return(mf);
        }
示例#9
0
        public async Task <ActionResult> Delete(string key)
        {
            MethodReturnResult result = new MethodReturnResult();

            using (ManufacturerServiceClient client = new ManufacturerServiceClient())
            {
                result = await client.DeleteAsync(key);

                if (result.Code == 0)
                {
                    result.Message = string.Format(FMMResources.StringResource.Manufacturer_Delete_Success
                                                   , key);
                }
                return(Json(result));
            }
        }
示例#10
0
        public async Task <ActionResult> Query(ManufacturerQueryViewModel model)
        {
            if (ModelState.IsValid)
            {
                using (ManufacturerServiceClient client = new ManufacturerServiceClient())
                {
                    await Task.Run(() =>
                    {
                        StringBuilder where = new StringBuilder();
                        if (model != null)
                        {
                            if (!string.IsNullOrEmpty(model.Code))
                            {
                                where.AppendFormat(" {0} Key LIKE '{1}%'"
                                                   , where.Length > 0 ? "AND" : string.Empty
                                                   , model.Code);
                            }
                            if (!string.IsNullOrEmpty(model.Name))
                            {
                                where.AppendFormat(" {0} Name LIKE '{1}%'"
                                                   , where.Length > 0 ? "AND" : string.Empty
                                                   , model.Name);
                            }
                            if (!string.IsNullOrEmpty(model.NickName))
                            {
                                where.AppendFormat(" {0} NickName LIKE '{1}%'"
                                                   , where.Length > 0 ? "AND" : string.Empty
                                                   , model.NickName);
                            }
                        }
                        PagingConfig cfg = new PagingConfig()
                        {
                            OrderBy = "Key",
                            Where   = where.ToString()
                        };
                        MethodReturnResult <IList <Manufacturer> > result = client.Get(ref cfg);

                        if (result.Code == 0)
                        {
                            ViewBag.PagingConfig = cfg;
                            ViewBag.List         = result.Data;
                        }
                    });
                }
            }
            return(PartialView("_ListPartial"));
        }
示例#11
0
        //
        // GET: /FMM/Manufacturer/
        public async Task <ActionResult> Index()
        {
            using (ManufacturerServiceClient client = new ManufacturerServiceClient())
            {
                await Task.Run(() =>
                {
                    PagingConfig cfg = new PagingConfig()
                    {
                        OrderBy = "Key"
                    };
                    MethodReturnResult <IList <Manufacturer> > result = client.Get(ref cfg);

                    if (result.Code == 0)
                    {
                        ViewBag.PagingConfig = cfg;
                        ViewBag.List         = result.Data;
                    }
                });
            }
            return(View(new ManufacturerQueryViewModel()));
        }
示例#12
0
        public async Task <ActionResult> PagingQuery(string where, string orderBy, int?currentPageNo, int?currentPageSize)
        {
            if (ModelState.IsValid)
            {
                int pageNo   = currentPageNo ?? 0;
                int pageSize = currentPageSize ?? 20;
                if (Request["PageNo"] != null)
                {
                    pageNo = Convert.ToInt32(Request["PageNo"]);
                }
                if (Request["PageSize"] != null)
                {
                    pageSize = Convert.ToInt32(Request["PageSize"]);
                }

                using (ManufacturerServiceClient client = new ManufacturerServiceClient())
                {
                    await Task.Run(() =>
                    {
                        PagingConfig cfg = new PagingConfig()
                        {
                            PageNo   = pageNo,
                            PageSize = pageSize,
                            Where    = where ?? string.Empty,
                            OrderBy  = orderBy ?? string.Empty
                        };
                        MethodReturnResult <IList <Manufacturer> > result = client.Get(ref cfg);
                        if (result.Code == 0)
                        {
                            ViewBag.PagingConfig = cfg;
                            ViewBag.List         = result.Data;
                        }
                    });
                }
            }
            return(PartialView("_ListPartial"));
        }
        public async Task <ActionResult> Save(SupplierToManufacturerViewModel model)
        {
            DateTime           now = DateTime.Now;
            MethodReturnResult rst = new MethodReturnResult();

            #region 界面录入信息合规性检查
            using (MaterialServiceClient client = new MaterialServiceClient())
            {
                MethodReturnResult <Material> result = client.Get(model.MaterialCode);
                if (result.Code != 0)
                {
                    rst.Code    = 1001;
                    rst.Message = String.Format("MES中不存在物料编码:{0}", model.MaterialCode);
                    return(Json(rst));
                }
                else
                {
                    if (model.OrderNumber != "*")
                    {
                        using (WorkOrderServiceClient clientOfWorkOrder = new WorkOrderServiceClient())
                        {
                            MethodReturnResult <WorkOrder> resultOfOrder = clientOfWorkOrder.Get(model.OrderNumber);
                            if (resultOfOrder.Code != 0)
                            {
                                rst.Code    = 1001;
                                rst.Message = String.Format("MES中不存在工单:{0}", model.OrderNumber);
                                return(Json(rst));
                            }
                        }
                    }
                }
            }
            #endregion

            using (ERPClient erpClient = new ERPClient())
            {
                MethodReturnResult <DataSet> ds_supplier     = erpClient.GetERPSupplier(model.SupplierCode);
                MethodReturnResult <DataSet> ds_manufacturer = erpClient.GetByCodeERPManufacturer(model.ManufacturerCode);
                if (ds_supplier == null || ds_supplier.Data.Tables[0].Rows.Count == 0)
                {
                    rst.Code    = 1001;
                    rst.Message = String.Format("ERP中不存在供应商:{0}", model.SupplierCode);
                    return(Json(rst));
                }
                if (ds_manufacturer == null || ds_manufacturer.Data.Tables[0].Rows.Count == 0)
                {
                    rst.Code    = 1001;
                    rst.Message = String.Format("ERP中不存在生产厂商:{0}", model.ManufacturerCode);
                    return(Json(rst));
                }
                //新增转换供应商
                using (SupplierServiceClient supplierClient = new SupplierServiceClient())
                {
                    MethodReturnResult <Supplier> result = await supplierClient.GetAsync(model.SupplierCode);

                    if (result.Code != 0)
                    {
                        Supplier supplier = new Supplier()
                        {
                            Key         = ds_supplier.Data.Tables[0].Rows[0]["CUSCODE"].ToString(),
                            Name        = ds_supplier.Data.Tables[0].Rows[0]["CUSNAME"].ToString(),
                            NickName    = " ",
                            CreateTime  = now,
                            EditTime    = now,
                            Creator     = User.Identity.Name,
                            Editor      = User.Identity.Name,
                            Description = ""
                        };
                        rst = await supplierClient.AddAsync(supplier);

                        if (rst.Code != 0)
                        {
                            return(Json(rst));
                        }
                    }
                }
                //新增转换生产厂商
                using (ManufacturerServiceClient manufacturerClient = new ManufacturerServiceClient())
                {
                    MethodReturnResult <Manufacturer> result = await manufacturerClient.GetAsync(model.ManufacturerCode);

                    if (result.Code != 0)
                    {
                        Manufacturer manufacturer = new Manufacturer()
                        {
                            Key         = ds_manufacturer.Data.Tables[0].Rows[0]["CSCODE"].ToString(),
                            Name        = ds_manufacturer.Data.Tables[0].Rows[0]["CSNAME"].ToString(),
                            NickName    = " ",
                            CreateTime  = now,
                            EditTime    = now,
                            Creator     = User.Identity.Name,
                            Editor      = User.Identity.Name,
                            Description = ""
                        };
                        rst = await manufacturerClient.AddAsync(manufacturer);

                        if (rst.Code != 0)
                        {
                            return(Json(rst));
                        }
                    }
                }
                //新增转换规则
                using (SupplierToManufacturerServiceClient client = new SupplierToManufacturerServiceClient())
                {
                    SupplierToManufacturer obj = new SupplierToManufacturer()
                    {
                        Key = new SupplierToManufacturerKey()
                        {
                            MaterialCode = model.MaterialCode.ToString().Trim().ToUpper(),
                            OrderNumber  = model.OrderNumber.ToString().Trim().ToUpper(),
                            SupplierCode = model.SupplierCode.ToString().Trim().ToUpper()
                        },
                        ManufacturerCode = model.ManufacturerCode.ToString().Trim().ToUpper(),
                        CreateTime       = now,
                        EditTime         = now,
                        Creator          = User.Identity.Name,
                        Editor           = User.Identity.Name
                    };
                    rst = await client.AddAsync(obj);

                    if (rst.Code == 0)
                    {
                        rst.Message = string.Format(ZPVMResources.StringResource.SupplierToManufacturer_Save_Success);
                    }
                    return(Json(rst));
                }
            }
        }
示例#14
0
 public AddPhone(ProductServiceClient productServiceClient, ManufacturerServiceClient manufacturerServiceClient)
 {
     InitializeComponent();
     _productServiceClient      = productServiceClient;
     _manufacturerServiceClient = manufacturerServiceClient;
 }
示例#15
0
        public async Task <ActionResult> ExportToExcelWl(LotMaterialListViewModel model)
        {
            DataTable dt = new DataTable();
            MethodReturnResult <DataSet> result = new MethodReturnResult <DataSet>();

            using (LotQueryServiceClient client = new LotQueryServiceClient())

            {
                RPTLotMateriallistParameter param = new RPTLotMateriallistParameter();
                param.LotNumber = model.LotNumber;
                param.PageSize  = model.PageSize;
                param.PageNo    = -1;

                await Task.Run(() =>
                {
                    PagingConfig cfg = new PagingConfig()
                    {
                        OrderBy = "Key.LotNumber,ItemNo",
                        Where   = GetQueryCondition(model)
                    };

                    MethodReturnResult <DataSet> ds = client.GetRPTLotMaterialList(ref param);
                    dt = ds.Data.Tables[0];
                });
            }

            //创建工作薄。
            IWorkbook wb = new HSSFWorkbook();
            //设置EXCEL格式
            ICellStyle style = wb.CreateCellStyle();

            style.FillForegroundColor = 10;
            //有边框
            style.BorderBottom = BorderStyle.Thin;
            style.BorderLeft   = BorderStyle.Thin;
            style.BorderRight  = BorderStyle.Thin;
            style.BorderTop    = BorderStyle.Thin;
            IFont font = wb.CreateFont();

            font.Boldweight = 10;
            style.SetFont(font);

            ISheet ws = null;

            for (int j = 0; j < dt.Rows.Count; j++)
            {
                if (j % 65535 == 0)
                {
                    ws = wb.CreateSheet();
                    IRow  row  = ws.CreateRow(0);
                    ICell cell = null;
                    #region //列名
                    foreach (DataColumn dc in dt.Columns)
                    {
                        cell           = row.CreateCell(row.Cells.Count);
                        cell.CellStyle = style;
                        cell.SetCellValue(dc.Caption);
                    }
                    #endregion
                    font.Boldweight = 5;
                }
                IRow rowData = ws.CreateRow(j + 1);
                #region //数据
                ICell cellData = null;

                foreach (DataColumn dc in dt.Columns)
                {
                    System.Data.DataRow obj = dt.Rows[j];
                    Manufacturer        mf  = null;
                    using (SupplierToManufacturerServiceClient clients = new SupplierToManufacturerServiceClient())
                    {
                        PagingConfig cfg0 = new PagingConfig()
                        {
                            Where = string.Format(@"Key.MaterialCode='{0}' AND Key.SupplierCode='{1}'"
                                                  , obj["MATERIAL_CODE"]
                                                  , obj["SUPPLIER_CODE"])
                        };
                        MethodReturnResult <IList <SupplierToManufacturer> > results = clients.Gets(ref cfg0);
                        if (results.Code <= 0 && results.Data.Count > 0)
                        {
                            if (results.Data[0].Key.OrderNumber == "*")
                            {
                                using (ManufacturerServiceClient clientss = new ManufacturerServiceClient())
                                {
                                    MethodReturnResult <Manufacturer> rsts = clientss.Get(results.Data[0].ManufacturerCode);
                                    if (rsts.Data != null)
                                    {
                                        mf = rsts.Data;
                                    }
                                }
                            }
                            else
                            {
                                PagingConfig cfg1 = new PagingConfig()
                                {
                                    Where = string.Format(@"Key.MaterialCode='{0}' AND Key.OrderNumber='{1}' AND Key.SupplierCode='{2}'"
                                                          , obj["MATERIAL_CODE"]
                                                          , obj["ORDER_NUMBER"]
                                                          , obj["SUPPLIER_CODE"])
                                };
                                MethodReturnResult <IList <SupplierToManufacturer> > resultss = clients.Gets(ref cfg1);
                                if (resultss.Code <= 0 && resultss.Data.Count > 0)
                                {
                                    using (ManufacturerServiceClient clientss = new ManufacturerServiceClient())
                                    {
                                        MethodReturnResult <Manufacturer> rsts = clientss.Get(resultss.Data[0].ManufacturerCode);
                                        if (rsts.Data != null)
                                        {
                                            mf = rsts.Data;
                                        }
                                    }
                                }
                            }
                        }
                    }
                    cellData           = rowData.CreateCell(rowData.Cells.Count);
                    cellData.CellStyle = style;

                    if (dc.DataType == typeof(double) || dc.DataType == typeof(float))
                    {
                        if (dc.ColumnName == "SUPPLIER_CODE")
                        {
                            cellData.SetCellValue(mf == null ? Convert.ToString(dt.Rows[j][dc]) : mf.Key);
                        }
                        else if (dc.ColumnName == "SUPPLIER_NAME")
                        {
                            cellData.SetCellValue(mf == null ? Convert.ToString(dt.Rows[j][dc]) : mf.Name);
                        }
                        else
                        {
                            cellData.SetCellValue(Convert.ToDouble(dt.Rows[j][dc]));
                        }
                    }
                    else if (dc.DataType == typeof(int))
                    {
                        if (dc.ColumnName == "SUPPLIER_CODE")
                        {
                            cellData.SetCellValue(mf == null ? Convert.ToString(dt.Rows[j][dc]) : mf.Key);
                        }
                        else if (dc.ColumnName == "SUPPLIER_NAME")
                        {
                            cellData.SetCellValue(mf == null ? Convert.ToString(dt.Rows[j][dc]) : mf.Name);
                        }
                        else
                        {
                            cellData.SetCellValue(Convert.ToInt32(dt.Rows[j][dc]));
                        }
                    }
                    else
                    {
                        if (dc.ColumnName == "SUPPLIER_CODE")
                        {
                            cellData.SetCellValue(mf == null ? Convert.ToString(dt.Rows[j][dc]) : mf.Key);
                        }
                        else if (dc.ColumnName == "SUPPLIER_NAME")
                        {
                            cellData.SetCellValue(mf == null ? Convert.ToString(dt.Rows[j][dc]) : mf.Name);
                        }
                        else
                        {
                            cellData.SetCellValue(Convert.ToString(dt.Rows[j][dc]));
                        }
                    }
                }
                #endregion
            }

            MemoryStream ms = new MemoryStream();
            wb.Write(ms);
            ms.Flush();
            ms.Position = 0;
            return(File(ms, "application/vnd.ms-excel", "LotMaterialData.xls"));
        }