Пример #1
0
        public ActionResult ImportExcel()
        {
            List <Barcode_Model> barcodelist = new List <Barcode_Model>();
            HttpPostedFileBase   File        = Request.Files["file"];
            string path = "";

            if (File.ContentLength > 0)
            {
                var Isxls = System.IO.Path.GetExtension(File.FileName).ToString().ToLower();
                if (Isxls != ".xls" && Isxls != ".xlsx")
                {
                    Content("请上传Excel文件");
                }
                var FileName = File.FileName; //获取文件夹名称
                path = Server.MapPath("~/Upload/" + DateTime.Now.ToString("yyyyMMddHHmmss")) + FileName;
                File.SaveAs(path);            //将文件保存到服务器
                DataTable dt = new DataTable();
                if (Isxls == ".xls")
                {
                    dt = ImportExcelFile(path);
                }
                if (Isxls == ".xlsx")
                {
                    dt = ImportExcelFilexlsx(path);
                }
                barcodelist = Print_DB.ConvertToModel <Barcode_Model>(dt);
            }
            TempData["list"] = barcodelist;
            TempData["Path"] = path;
            return(RedirectToAction("Index", "PrintFirst"));
        }
Пример #2
0
        public bool PrintLpkPallet(string serialno, string ip, ref string ErrMsg)
        {
            Print_DB db = new Print_DB();

            return(db.PrintLpkPallet(serialno, ip, ref ErrMsg));
        }
Пример #3
0
        public JsonResult SaveBarcode(string erpvoucherno, string materialno, string materialdesc, string ean, string batch, string edate, string num, string everynum, string receivetime, string RowNO, string RowNODel, string MaterialNoID, string StrongHoldCode, string CompanyCode, string Createname, string WarehouseName)
        {
            if (string.IsNullOrEmpty(Userno))
            {
                return(Json(new { state = false, obj = "Cookie失效,重新登陆!" }, JsonRequestBehavior.AllowGet));
            }
            try
            {
                string err = "";
                //计算外箱数量,和尾箱数量,和尾箱里面的个数
                int     outboxnum = 0;
                int     inboxnum  = 0;
                decimal tailnum   = 0;
                GetBoxInfo(ref outboxnum, ref tailnum, ref inboxnum, num, everynum);
                if (outboxnum == 0)
                {
                    return(Json(new { state = false, obj = "打印数量为0" }, JsonRequestBehavior.AllowGet));
                }

                Print_DB      print_DB = new Print_DB();
                List <string> squence  = GetSerialnos(outboxnum + inboxnum, ref err);

                //int matenoid = selectItem.MaterialNoID;
                sq = "";
                //存放打印条码内容
                List <Barcode_Model> listbarcode = new List <Barcode_Model>();
                int k = 0;
                //执行打印外箱命令
                for (int i = 0; i < outboxnum; i++)
                {
                    Barcode_Model model = new Barcode_Model();
                    model.CompanyCode    = CompanyCode;
                    model.StrongHoldCode = StrongHoldCode;
                    model.MaterialNoID   = Convert.ToInt32(MaterialNoID);
                    model.MaterialNo     = materialno;
                    model.MaterialDesc   = materialdesc;
                    model.BatchNo        = batch;
                    model.ErpVoucherNo   = erpvoucherno;
                    model.EDate          = Convert.ToDateTime(edate);
                    model.Qty            = Convert.ToDecimal(everynum);
                    model.SerialNo       = squence[k++];
                    model.Creater        = Userno;
                    model.EAN            = ean;
                    model.ReceiveTime    = string.IsNullOrEmpty(receivetime) ? DateTime.Now : Convert.ToDateTime(receivetime);
                    model.BarCode        = "1@" + model.StrongHoldCode + "@" + model.MaterialNo + "@" + model.EAN + "@" + model.EDate.ToString("yyyy-MM-dd") + "@" + model.BatchNo + "@" + model.Qty + "@" + model.SerialNo;
                    model.RowNo          = RowNO;
                    model.RowNoDel       = RowNODel;
                    model.BarcodeType    = 1;
                    model.ProductClass   = Createname;
                    model.WorkNo         = WarehouseName;
                    listbarcode.Add(model);
                }
                if (inboxnum == 1)
                {
                    Barcode_Model model = new Barcode_Model();
                    model.CompanyCode    = CompanyCode;
                    model.StrongHoldCode = StrongHoldCode;
                    model.MaterialNoID   = Convert.ToInt32(MaterialNoID);
                    model.MaterialNo     = materialno;
                    model.MaterialDesc   = materialdesc;
                    model.BatchNo        = batch;
                    model.ErpVoucherNo   = erpvoucherno;
                    model.EDate          = Convert.ToDateTime(edate);
                    model.Qty            = Convert.ToDecimal(tailnum);
                    model.SerialNo       = squence[k++];
                    model.Creater        = Userno;
                    model.EAN            = ean;
                    model.ReceiveTime    = string.IsNullOrEmpty(receivetime) ? DateTime.Now : Convert.ToDateTime(receivetime);
                    model.BarCode        = "1@" + model.StrongHoldCode + "@" + model.MaterialNo + "@" + model.EAN + "@" + model.EDate.ToString("yyyy-MM-dd") + "@" + model.BatchNo + "@" + model.Qty + "@" + model.SerialNo;
                    model.RowNo          = RowNO;
                    model.RowNoDel       = RowNODel;
                    model.BarcodeType    = 1;
                    model.ProductClass   = Createname;
                    model.WorkNo         = WarehouseName;
                    listbarcode.Add(model);
                }

                if (print_DB.SubBarcodes(listbarcode, "sup", 1, ref err))
                {
                    string serialnos = "";
                    for (int i = 0; i < listbarcode.Count; i++)
                    {
                        serialnos += listbarcode[i].SerialNo + ",";
                    }
                    return(Json(new { state = true, obj = serialnos }, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    return(Json(new { state = false, obj = err }, JsonRequestBehavior.AllowGet));
                }
            }
            catch (Exception ex)
            {
                return(Json(new { state = false, obj = ex.ToString() }, JsonRequestBehavior.AllowGet));
            }
        }
Пример #4
0
        //专门给U9用
        public bool SaveBarcode(List <Barcode_Model> backmodels, ref string strMsg)
        {
            try
            {
                T_Material_DB MDB      = new T_Material_DB();
                Print_DB      print_DB = new Print_DB();
                bool          flag     = false;
                string        info     = "";
                backmodels.ForEach(item =>
                {
                    int Materialnoid = MDB.GetMaterialNoid(item.MaterialNo, item.StrongHoldCode);
                    if (Materialnoid == 0)
                    {
                        info = "据点【" + item.StrongHoldCode + "】物料主数据没有物料【" + item.MaterialNo + "】信息!";
                        flag = true;
                    }
                    else
                    {
                        item.MaterialNoID = Materialnoid;
                    }

                    item.CompanyCode = "";
                    item.VoucherType = "51";
                    item.Creater     = "U9";
                    item.RowNo       = "1";
                    item.RowNoDel    = "1";
                    item.BarcodeType = 1;
                });

                if (flag)
                {
                    strMsg = info;
                    return(false);
                }

                if (print_DB.SubBarcodes(backmodels, "sup", 1, ref strMsg))
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
                //List<Barcode_Model> listbarcode = new List<Barcode_Model>();
                //foreach (var backmodel in backmodels)
                //{

                //    Barcode_Model model = new Barcode_Model();
                //    model.CompanyCode = "";
                //    model.ErpVoucherNo = backmodel.ErpVoucherNo;
                //    model.VoucherType = "51";
                //    model.StrongHoldCode = backmodel.StrongHoldCode;
                //    model.StrongHoldName = backmodel.StrongHoldName;
                //    model.MaterialNoID = backmodel.MaterialNoID;
                //    model.MaterialNo = backmodel.MaterialNo;
                //    model.MaterialDesc = backmodel.MaterialDesc;
                //    model.spec = backmodel.spec;
                //    model.BatchNo = backmodel.BatchNo;
                //    model.ProductBatch = backmodel.ProductBatch;//给批号加密成8位
                //    model.ErpVoucherNo = backmodel.ErpVoucherNo;
                //    model.Qty = backmodel.Qty;
                //    model.CusCode = backmodel.CusCode;
                //    model.CusName = backmodel.CusName;
                //    model.StoreCondition = backmodel.StoreCondition;
                //    model.ProtectWay = backmodel.ProtectWay;
                //    model.LABELMARK = backmodel.LABELMARK;
                //    model.SerialNo = backmodel.SerialNo;
                //    model.Creater = "U9";
                //    model.ReceiveTime = DateTime.Now;
                //    model.BarCode = "2@" + model.MaterialNo + "@" + model.Qty + "@" + model.SerialNo;
                //    model.RowNo = "1";
                //    model.RowNoDel = "1";
                //    model.BarcodeType = 1;
                //    listbarcode.Add(model);
                //}

                //if (print_DB.SubBarcodes(backmodels, "sup", 1, ref strMsg))
                //{
                //    return true;
                //}
                //else
                //{
                //    return false;
                //}
            }
            catch (Exception ex)
            {
                strMsg = ex.ToString();
                return(false);
            }
        }
Пример #5
0
        public ActionResult SaveBarcode(string data)
        {
            var objT_InStockDetailInfo = JsonConvert.DeserializeObject <T_InStockDetailInfo>(data);

            string EveryQty       = objT_InStockDetailInfo.EveryQty,
                   num            = objT_InStockDetailInfo.num,
                   Userno         = objT_InStockDetailInfo.Userno,
                   erpvoucherno   = objT_InStockDetailInfo.ErpVoucherNo,
                   materialno     = objT_InStockDetailInfo.MaterialNo,
                   materialdesc   = objT_InStockDetailInfo.MaterialDesc,
                   RowNO          = objT_InStockDetailInfo.RowNo,
                   RowNODel       = objT_InStockDetailInfo.RowNoDel,
                   MaterialNoID   = objT_InStockDetailInfo.MaterialNoID.ToString(),
                   StrongHoldCode = objT_InStockDetailInfo.StrongHoldCode,
                   CompanyCode    = objT_InStockDetailInfo.CompanyCode,
                   Createname     = objT_InStockDetailInfo.Creater,
                   WarehouseName  = objT_InStockDetailInfo.WareHouseNo,
                   TracNo         = objT_InStockDetailInfo.TracNo,
                   ProjectNo      = objT_InStockDetailInfo.ProjectNo,
                   BatchNo        = objT_InStockDetailInfo.FromBatchNo;

            T_InStock_Func InFunc      = new T_InStock_Func();
            string         strMsg      = "";
            T_InStockInfo  InStockInfo = new T_InStockInfo()
            {
                ID = objT_InStockDetailInfo.HeaderID
            };

            InFunc.GetModelByID(ref InStockInfo, ref strMsg);
            //查物料
            T_Material_Func       funM      = new T_Material_Func();
            string                strErrMsg = "";
            List <T_MaterialInfo> modelList = funM.GetMaterialModelBySql(materialno, ref strErrMsg);

            if (modelList == null || modelList.Count == 0)//失败
            {
                return(Json(new { state = false, obj = "没有该物料号" + materialno }, JsonRequestBehavior.AllowGet));
            }
            if (string.IsNullOrEmpty(Userno))
            {
                return(Json(new { state = false, obj = "Cookie失效,重新登陆!" }, JsonRequestBehavior.AllowGet));
            }
            try
            {
                DateTime time1 = DateTime.Now;
                DateTime time2 = DateTime.Now.AddSeconds(1);
                string   err   = "";
                //计算外箱数量,和尾箱数量,和尾箱里面的个数
                int     outboxnum = 0;
                int     inboxnum  = 0;
                decimal tailnum   = 0;
                GetBoxInfo(ref outboxnum, ref tailnum, ref inboxnum, num, EveryQty);
                if (outboxnum == 0)
                {
                    return(Json(new { state = false, obj = "打印数量为0" }, JsonRequestBehavior.AllowGet));
                }

                Print_DB             print_DB     = new Print_DB();
                List <string>        squence      = GetSerialnos((outboxnum + inboxnum).ToString(), "外", ref err); //外箱码序列号
                List <string>        squenceforin = GetSerialnos(num, "内", ref err);                               //本体序列号
                List <Barcode_Model> listbarcode  = new List <Barcode_Model>();                                    //存放打印条码内容
                T_Product_DB         proDB        = new T_Product_DB();
                int k = 0;
                for (int i = 0; i < outboxnum; i++)//执行打印外箱命令
                {
                    Barcode_Model model = new Barcode_Model();
                    model.CompanyCode    = CompanyCode;
                    model.StrongHoldCode = StrongHoldCode;
                    model.MaterialNoID   = Convert.ToInt32(MaterialNoID);
                    model.MaterialNo     = materialno;
                    model.MaterialDesc   = materialdesc;
                    //model.BatchNo = DateTime.Now.ToString("yyyyMMdd");
                    model.BatchNo      = BatchNo;
                    model.ProductBatch = objT_InStockDetailInfo.ProductBatch;//给批号加密成8位
                    model.ErpVoucherNo = erpvoucherno;
                    model.Qty          = Convert.ToDecimal(EveryQty);
                    model.SerialNo     = squence[k++];
                    model.Creater      = Userno;
                    model.ReceiveTime  = time1;
                    model.BarCode      = "2@" + model.MaterialNo + "@" + model.Qty + "@" + model.SerialNo;
                    model.RowNo        = RowNO;
                    model.RowNoDel     = RowNODel;
                    model.BarcodeType  = 1;
                    model.ProductClass = Createname;
                    model.WorkNo       = WarehouseName;
                    model.TracNo       = TracNo;
                    model.ProjectNo    = ProjectNo;

                    model.SupCode        = InStockInfo.SupplierNo;
                    model.SupName        = InStockInfo.SupplierName;
                    model.StoreCondition = InStockInfo.StrVoucherType;
                    model.department     = InStockInfo.DepartmentCode;
                    model.departmentname = InStockInfo.DepartmentName;

                    model.ProtectWay = objT_InStockDetailInfo.sale_vouchertypename;
                    model.LABELMARK  = objT_InStockDetailInfo.Customer_voucherno;


                    model.CusCode          = objT_InStockDetailInfo.SupplierNo;
                    model.CusName          = objT_InStockDetailInfo.SUPPLIERSHORTNAME;
                    model.erpwarehousename = objT_InStockDetailInfo.ErpWarehouseName;
                    model.StoreCondition   = objT_InStockDetailInfo.CustomerItemCode;
                    model.spec             = objT_InStockDetailInfo.spec;
                    if (erpvoucherno.Substring(0, 2) == "DC")
                    {
                        model.dimension   = erpvoucherno;
                        model.VoucherType = "30";
                    }

                    listbarcode.Add(model);
                }
                if (inboxnum == 1)
                {
                    Barcode_Model model = new Barcode_Model();
                    model.CompanyCode    = CompanyCode;
                    model.StrongHoldCode = StrongHoldCode;
                    model.MaterialNoID   = Convert.ToInt32(MaterialNoID);
                    model.MaterialNo     = materialno;
                    model.MaterialDesc   = materialdesc;
                    //model.BatchNo = DateTime.Now.ToString("yyyyMMdd");
                    model.BatchNo      = BatchNo;
                    model.ProductBatch = objT_InStockDetailInfo.ProductBatch;//给批号加密成8位
                    model.ErpVoucherNo = erpvoucherno;
                    model.Qty          = Convert.ToDecimal(tailnum);
                    model.SerialNo     = squence[k++];
                    model.Creater      = Userno;
                    model.ReceiveTime  = time1;
                    model.BarCode      = "2@" + model.MaterialNo + "@" + model.Qty + "@" + model.SerialNo;
                    model.RowNo        = RowNO;
                    model.RowNoDel     = RowNODel;
                    model.BarcodeType  = 1;
                    model.ProductClass = Createname;
                    model.WorkNo       = WarehouseName;
                    model.TracNo       = TracNo;
                    model.ProjectNo    = ProjectNo;

                    model.SupCode        = InStockInfo.SupplierNo;
                    model.SupName        = InStockInfo.SupplierName;
                    model.StoreCondition = InStockInfo.StrVoucherType;
                    model.department     = InStockInfo.DepartmentCode;
                    model.departmentname = InStockInfo.DepartmentName;

                    model.ProtectWay = objT_InStockDetailInfo.sale_vouchertypename;
                    model.LABELMARK  = objT_InStockDetailInfo.Customer_voucherno;

                    model.CusCode          = objT_InStockDetailInfo.SupplierNo;
                    model.CusName          = objT_InStockDetailInfo.SUPPLIERSHORTNAME;
                    model.erpwarehousename = objT_InStockDetailInfo.ErpWarehouseName;
                    model.StoreCondition   = objT_InStockDetailInfo.CustomerItemCode;
                    model.spec             = objT_InStockDetailInfo.spec;
                    if (erpvoucherno.Substring(0, 2) == "DC")
                    {
                        model.dimension   = erpvoucherno;
                        model.VoucherType = "30";
                    }
                    listbarcode.Add(model);
                }
                if (print_DB.SubBarcodes(listbarcode, "sup", 1, ref err))
                {
                    string serialnosS = "";
                    for (int i = 0; i < listbarcode.Count; i++)
                    {
                        if (listbarcode[i].BarcodeType != 1)
                        {
                            serialnosS += listbarcode[i].SerialNo + ",";
                        }
                    }
                    if (serialnosS == "")
                    {
                        return(Json(new { state = true, obj = time1.ToString("yyyy/MM/dd HH:mm:ss") }, JsonRequestBehavior.AllowGet));
                    }
                    return(Json(new { state = true, obj = time1.ToString("yyyy/MM/dd HH:mm:ss"), objS = time2.ToString("yyyy/MM/dd HH:mm:ss") }, JsonRequestBehavior.AllowGet));
                }
                return(Json(new { state = false, obj = err }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                return(Json(new { state = false, obj = ex.ToString() }, JsonRequestBehavior.AllowGet));
            }
        }
Пример #6
0
        public string GetSupMan()
        {
            Print_DB db = new Print_DB();

            return(db.GetSupMan());
        }
Пример #7
0
        public bool SaveProDuctBarcode(UserModel user, T_Product modelList, ref Barcode_Model backmodel)
        {
            try
            {
                //不生成外箱,直接做关联
                if (!string.IsNullOrEmpty(backmodel.BarCode))
                {
                    //修改关联量,插入记录表
                    if (updateproduct(modelList, backmodel.BarCode))
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
                else
                {
                    Print_DB             print_DB    = new Print_DB();
                    List <Barcode_Model> listbarcode = new List <Barcode_Model>();
                    Barcode_Model        model       = new Barcode_Model();
                    model.CompanyCode    = "";
                    model.ErpVoucherNo   = modelList.ErpVoucherNo;
                    model.VoucherType    = modelList.VoucherType.ToString();
                    model.StrongHoldCode = modelList.StrongHoldCode;
                    model.StrongHoldName = backmodel.StrongHoldName;
                    model.MaterialNoID   = modelList.MaterialNoID;
                    model.MaterialNo     = modelList.MaterialNo;
                    model.MaterialDesc   = modelList.MaterialName;
                    model.spec           = backmodel.spec;
                    model.BatchNo        = modelList.BatchNo;
                    model.ProductBatch   = modelList.ProductBatch;//给批号加密成8位
                    model.ErpVoucherNo   = modelList.ErpVoucherNo;
                    model.CusCode        = modelList.CustomerCode;
                    model.CusName        = modelList.CustomerName;
                    model.StoreCondition = modelList.PubDescSeg7;
                    model.ProtectWay     = modelList.sale_vouchertypename;
                    model.LABELMARK      = modelList.Customer_voucherno;
                    model.Qty            = Convert.ToDecimal(modelList.ScanQty);

                    var    seed = Guid.NewGuid().GetHashCode();
                    string code = DateTime.Now.ToString("MMdd") + getSqu(Guid.NewGuid().ToString("N"));

                    model.SerialNo    = code;
                    model.Creater     = user.UserNo;
                    model.ReceiveTime = DateTime.Now;
                    model.BarCode     = "2@" + model.MaterialNo + "@" + model.Qty + "@" + model.SerialNo;
                    model.RowNo       = "1";
                    model.RowNoDel    = "1";
                    model.BarcodeType = 1;
                    backmodel         = model;
                    listbarcode.Add(model);
                    string err = "";
                    if (print_DB.SubBarcodes(listbarcode, "sup", 1, ref err))
                    {
                        //修改关联量,插入记录表
                        if (updateproduct(modelList, model.BarCode))
                        {
                            return(true);
                        }
                        else
                        {
                            return(false);
                        }
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
Пример #8
0
        public bool tuisong(ref string err)
        {
            Print_DB db = new Print_DB();

            return(db.tuisong(ref err));
        }
Пример #9
0
        public bool Mes_CheckWoInfoIsOK(string zyid, ref string ErrMsg)
        {
            Print_DB db = new Print_DB();

            return(db.Mes_CheckWoInfoIsOK(zyid, ref ErrMsg));
        }
Пример #10
0
        public bool PrintZplPallet2(List <string> serialnos, ref string ErrMsg, ref List <Barcode_Model> list2)
        {
            Print_DB db = new Print_DB();

            return(db.PrintZplPallet2(serialnos, ref ErrMsg, ref list2));
        }
Пример #11
0
        public bool GetMesWoInfoBarcode(string barcode, string workno, string materialno, ref string ErrMsg)
        {
            Print_DB db = new Print_DB();

            return(db.GetMesWoInfoBarcode(barcode, workno, materialno, ref ErrMsg));
        }
Пример #12
0
        public string QYReprintAndroid(string json)
        {
            Print_DB db = new Print_DB();

            return(db.QYReprintAndroid(json));
        }
Пример #13
0
        public string PrintQYAndroid(string json)
        {
            Print_DB db = new Print_DB();

            return(db.PrintQYAndroid(json));
        }
Пример #14
0
        public bool PrintDeliveryTray(T_StockInfoEX model, List <T_StockInfoEX> list, string ipport, ref string ErrMsg)
        {
            Print_DB db = new Print_DB();

            return(db.PrintDeliveryTray(model, list, ipport, ref ErrMsg));
        }
Пример #15
0
        public List <string> getSqNumAndbarcodeType(int num, string mateid, ref string bt, ref string date)
        {
            Print_DB db = new Print_DB();

            return(db.getSqNumAndbarcodeType(num, mateid, ref bt, ref date));
        }
Пример #16
0
        public List <string> getSqNum(int num, ref string date)
        {
            Print_DB db = new Print_DB();

            return(db.getSqNum(num, ref date));
        }
Пример #17
0
        public string GetParameterById(string group, string id)
        {
            Print_DB db = new Print_DB();

            return(db.GetParameterById(group, id));
        }
Пример #18
0
        public bool GetPrintVoucher2(int vouchertype, string voucherno, ref List <T_InStockDetailInfo> infos, ref string ErrMsg, ref CusSup cs)
        {
            Print_DB db = new Print_DB();

            return(db.GetPrintVoucher2(vouchertype, voucherno, ref infos, ref ErrMsg, ref cs));
        }
Пример #19
0
        public void SetParameterById(string group, int id, string name)
        {
            Print_DB db = new Print_DB();

            db.SetParameterById(group, id, name);
        }
Пример #20
0
        public bool SaveSend(string voucherno, int num)
        {
            Print_DB db = new Print_DB();

            return(db.SaveSend(voucherno, num));
        }
Пример #21
0
        //PC打印外箱码
        public bool SaveBarcodeForPro(UserModel user, View_Product_Model modeljson, DateTime time1, ref string err)
        {
            try
            {
                //计算外箱数量,和尾箱数量,和尾箱里面的个数
                int     outboxnum = 0;
                int     inboxnum  = 0;
                decimal tailnum   = 0;
                GetBoxInfo(ref outboxnum, ref tailnum, ref inboxnum, modeljson.ProductQty.ToDecimal(), modeljson.PackQty);

                List <Barcode_Model> listbarcode = new List <Barcode_Model>();

                T_Product_DB ProductDB = new T_Product_DB();
                T_Product    product   = new T_Product()
                {
                    ErpVoucherNo = modeljson.HeadErpVoucherNo
                };
                T_Product Newproduct = ProductDB.GetModelListADF(user, product)[0];

                for (int i = 0; i < outboxnum; i++)
                {
                    //T_Product_DB ProductDB = new T_Product_DB();
                    //T_Product product = new T_Product() { ErpVoucherNo = modeljson.HeadErpVoucherNo };
                    //T_Product Newproduct = ProductDB.GetModelListADF(user, product)[0];

                    Barcode_Model model = new Barcode_Model();
                    model.CompanyCode      = "";
                    model.ErpVoucherNo     = Newproduct.ErpVoucherNo;
                    model.VoucherType      = Newproduct.VoucherType.ToString();
                    model.StrongHoldCode   = Newproduct.StrongHoldCode;
                    model.StrongHoldName   = Newproduct.StrongHoldName;
                    model.MaterialNoID     = Newproduct.MaterialNoID;
                    model.MaterialNo       = Newproduct.MaterialNo;
                    model.MaterialDesc     = Newproduct.MaterialName;
                    model.spec             = Newproduct.spec;
                    model.BatchNo          = Newproduct.BatchNo;
                    model.ProductBatch     = Newproduct.ProductBatch;//给批号加密成8位
                    model.ErpVoucherNo     = Newproduct.ErpVoucherNo;
                    model.CusCode          = Newproduct.CustomerCode;
                    model.CusName          = Newproduct.CustomerShortName;
                    model.StoreCondition   = Newproduct.PubDescSeg7;
                    model.ProtectWay       = Newproduct.sale_vouchertypename;
                    model.LABELMARK        = Newproduct.Customer_voucherno;
                    model.department       = Newproduct.PubDescSeg10_Code;
                    model.departmentname   = Newproduct.PubDescSeg10_Name;
                    model.erpwarehouseno   = Newproduct.PrivateDescSeg20_Code;
                    model.erpwarehousename = Newproduct.PrivateDescSeg20_Name;
                    model.BarcodeMType     = Newproduct.Customer_PrivateDescSeg5;
                    model.Qty = Convert.ToDecimal(modeljson.PackQty);

                    var    seed = Guid.NewGuid().GetHashCode();
                    string code = DateTime.Now.ToString("MMdd") + getSqu(Guid.NewGuid().ToString("N"));

                    model.SerialNo    = code;
                    model.Creater     = user.UserNo;
                    model.ReceiveTime = time1;
                    model.BarCode     = "2@" + model.MaterialNo + "@" + model.Qty + "@" + model.SerialNo;
                    model.RowNo       = "1";
                    model.RowNoDel    = "1";
                    model.BarcodeType = 1;
                    listbarcode.Add(model);
                }
                //处理尾箱
                if (inboxnum != 0)
                {
                    //T_Product_DB ProductDB = new T_Product_DB();
                    //T_Product product = new T_Product() { ErpVoucherNo = modeljson.HeadErpVoucherNo };
                    //T_Product Newproduct = ProductDB.GetModelListADF(user, product)[0];

                    Barcode_Model model = new Barcode_Model();
                    model.CompanyCode      = "";
                    model.ErpVoucherNo     = Newproduct.ErpVoucherNo;
                    model.VoucherType      = Newproduct.VoucherType.ToString();
                    model.StrongHoldCode   = Newproduct.StrongHoldCode;
                    model.StrongHoldName   = Newproduct.StrongHoldName;
                    model.MaterialNoID     = Newproduct.MaterialNoID;
                    model.MaterialNo       = Newproduct.MaterialNo;
                    model.MaterialDesc     = Newproduct.MaterialName;
                    model.spec             = Newproduct.spec;
                    model.BatchNo          = Newproduct.BatchNo;
                    model.ProductBatch     = Newproduct.ProductBatch;//给批号加密成8位
                    model.ErpVoucherNo     = Newproduct.ErpVoucherNo;
                    model.CusCode          = Newproduct.CustomerCode;
                    model.CusName          = Newproduct.CustomerShortName;
                    model.StoreCondition   = Newproduct.PubDescSeg7;
                    model.ProtectWay       = Newproduct.sale_vouchertypename;
                    model.LABELMARK        = Newproduct.Customer_voucherno;
                    model.department       = Newproduct.PubDescSeg10_Code;
                    model.departmentname   = Newproduct.PubDescSeg10_Name;
                    model.erpwarehouseno   = Newproduct.PrivateDescSeg20_Code;
                    model.erpwarehousename = Newproduct.PrivateDescSeg20_Name;
                    model.BarcodeMType     = Newproduct.Customer_PrivateDescSeg5;

                    model.Qty = Convert.ToDecimal(tailnum);

                    var    seed = Guid.NewGuid().GetHashCode();
                    string code = DateTime.Now.ToString("MMdd") + getSqu(Guid.NewGuid().ToString("N"));

                    model.SerialNo    = code;
                    model.Creater     = user.UserNo;
                    model.ReceiveTime = time1;
                    model.BarCode     = "2@" + model.MaterialNo + "@" + model.Qty + "@" + model.SerialNo;
                    model.RowNo       = "1";
                    model.RowNoDel    = "1";
                    model.BarcodeType = 1;
                    listbarcode.Add(model);
                }
                Print_DB print_DB = new Print_DB();

                if (print_DB.SubBarcodes(listbarcode, "sup", 1, ref err))
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                err = ex.ToString();
                return(false);
            }
        }
Пример #22
0
        public string GetBatch(string company, string mateno, string supcode)
        {
            Print_DB db = new Print_DB();

            return(db.GetBatch(company, mateno, supcode));
        }
Пример #23
0
        public JsonResult Print(string IDs, string Path)
        {
            try
            {
                List <Barcode_Model> barcodelist = new List <Barcode_Model>();
                var       Isxls = System.IO.Path.GetExtension(Path).ToString().ToLower();
                DataTable dt    = new DataTable();
                if (Isxls == ".xls")
                {
                    dt = ImportExcelFile(Path);
                }
                if (Isxls == ".xlsx")
                {
                    dt = ImportExcelFilexlsx(Path);
                }
                barcodelist = Print_DB.ConvertToModel <Barcode_Model>(dt);
                List <Barcode_Model> barcodelistnew = new List <Barcode_Model>();
                string[]             ids            = IDs.Split(',');
                for (int i = 0; i < ids.Length; i++)
                {
                    List <Barcode_Model> barcodes = new List <Barcode_Model>();
                    barcodes.AddRange(barcodelist.Where(P => P.RowNo == ids[i]));

                    if (barcodes.Count == 1 && barcodes[0].BoxCount >= 1)
                    {
                        for (int j = 0; j < barcodes[0].BoxCount; j++)
                        {
                            Barcode_Model model = (Barcode_Model)DeepCopy(barcodes[0]);
                            barcodelistnew.Add(model);
                        }
                    }
                }

                if (barcodelistnew != null && barcodelistnew.Count > 0)
                {
                    string        strMsg  = "";
                    List <string> squence = GetSerialnos(barcodelistnew.Count, ref strMsg);
                    int           k       = 0;
                    DateTime      time    = DateTime.Now;
                    for (int i = 0; i < barcodelistnew.Count; i++)
                    {
                        barcodelistnew[i].CompanyCode = "10";
                        barcodelistnew[i].BarcodeType = 3;
                        barcodelistnew[i].SerialNo    = squence[k++];
                        barcodelistnew[i].Creater     = currentUser.UserNo;
                        barcodelistnew[i].ReceiveTime = time;
                        barcodelistnew[i].BarCode     = "3" + barcodelistnew[i].MaterialNo.PadLeft(16, '0') + barcodelistnew[i].BatchNo.PadLeft(11, '0') + barcodelistnew[i].SerialNo;
                    }

                    Print_DB func = new Print_DB();
                    if (func.SubBarcodesNoPrint(barcodelistnew, ref strMsg))
                    {
                        //string serialnos = "";
                        //for (int j = 0; j < barcodelistnew.Count; j++)
                        //{
                        //    serialnos += barcodelistnew[j].SerialNo + ",";
                        //}

                        return(Json(new { state = true, obj = time.ToString("yyyy/MM/dd HH:mm:ss") }, JsonRequestBehavior.AllowGet));
                        //保存ok,打印
                        //Redirect("/Report/Print/PrintIn.aspx?serialnos= " + serialnos);
                    }
                    else
                    {
                        //失败
                        return(Json(new { state = false, obj = strMsg }, JsonRequestBehavior.AllowGet));
                    }
                }
                else
                {
                    //失败
                    return(Json(new { state = false, obj = "数据为空" }, JsonRequestBehavior.AllowGet));
                }
            }
            catch (Exception ex)
            {
                return(Json(new { state = false, obj = ex.ToString() }, JsonRequestBehavior.AllowGet));
            }
        }
Пример #24
0
        public string GetBatch2(DateTime dt, string company, string matenoid, string supbatch)
        {
            Print_DB db = new Print_DB();

            return(db.GetBatch2(dt, company, matenoid, supbatch));
        }
Пример #25
0
        public JsonResult SaveBarcode(string erpvoucherno, string materialno, string materialdesc, string ean, string batch, string edate, string num, string everynum, string receivetime, string RowNO, string RowNODel, string MaterialNoID, string StrongHoldCode, string CompanyCode, string Createname, string WarehouseName, string TracNo, string ProjectNo, string flag = "")//flag=1 是预留释放打印
        {
            //查物料
            T_Material_Func       funM      = new T_Material_Func();
            string                strErrMsg = "";
            List <T_MaterialInfo> modelList = funM.GetMaterialModelBySql(materialno, ref strErrMsg);

            if (modelList == null || modelList.Count == 0)
            {
                //失败
                return(Json(new { state = false, obj = "没有该物料号" + materialno }, JsonRequestBehavior.AllowGet));
            }

            if (string.IsNullOrEmpty(Userno))
            {
                return(Json(new { state = false, obj = "Cookie失效,重新登陆!" }, JsonRequestBehavior.AllowGet));
            }
            try
            {
                DateTime time1 = DateTime.Now;
                DateTime time2 = DateTime.Now.AddSeconds(1);
                string   err   = "";
                //计算外箱数量,和尾箱数量,和尾箱里面的个数
                int     outboxnum = 0;
                int     inboxnum  = 0;
                decimal tailnum   = 0;
                GetBoxInfo(ref outboxnum, ref tailnum, ref inboxnum, num, everynum);
                if (outboxnum == 0)
                {
                    return(Json(new { state = false, obj = "打印数量为0" }, JsonRequestBehavior.AllowGet));
                }

                Print_DB      print_DB     = new Print_DB();
                List <string> squence      = GetSerialnos(outboxnum + inboxnum, "外", ref err); //外箱码序列号
                List <string> squenceforin = GetSerialnos(Int16.Parse(num), "内", ref err);     //本体序列号

                //int matenoid = selectItem.MaterialNoID;
                sq = "";
                //存放打印条码内容
                List <Barcode_Model> listbarcode = new List <Barcode_Model>();
                int k   = 0;
                int kIn = 0;
                //执行打印外箱命令
                for (int i = 0; i < outboxnum; i++)
                {
                    Barcode_Model model = new Barcode_Model();
                    model.CompanyCode    = CompanyCode;
                    model.StrongHoldCode = StrongHoldCode;
                    model.MaterialNoID   = Convert.ToInt32(MaterialNoID);
                    model.MaterialNo     = materialno;
                    model.MaterialDesc   = materialdesc;
                    model.BatchNo        = DateTime.Now.ToString("yyyyMMdd");
                    model.ErpVoucherNo   = erpvoucherno;
                    //model.EDate = Convert.ToDateTime(edate);
                    model.Qty      = Convert.ToDecimal(everynum);
                    model.SerialNo = squence[k++];
                    model.Creater  = Userno;
                    //model.EAN = ean;
                    //model.ReceiveTime = string.IsNullOrEmpty(receivetime) ? DateTime.Now : Convert.ToDateTime(receivetime);
                    model.ReceiveTime  = time1;
                    model.BarCode      = "1@" + model.StrongHoldCode + "@" + model.MaterialNo + "@" + model.BatchNo + "@" + model.Qty + "@" + model.SerialNo;
                    model.RowNo        = RowNO;
                    model.RowNoDel     = RowNODel;
                    model.BarcodeType  = 1;
                    model.ProductClass = Createname;
                    model.WorkNo       = WarehouseName;
                    model.TracNo       = TracNo;
                    model.ProjectNo    = ProjectNo;
                    model.originalCode = flag;
                    listbarcode.Add(model);
                    if (modelList[0].sku == "是")
                    {
                        //本体打印
                        for (int ii = 0; ii < Convert.ToDecimal(everynum); ii++)
                        {
                            Barcode_Model modelIn1 = new Barcode_Model();
                            modelIn1.CompanyCode    = CompanyCode;
                            modelIn1.StrongHoldCode = StrongHoldCode;
                            modelIn1.MaterialNoID   = Convert.ToInt32(MaterialNoID);
                            modelIn1.MaterialNo     = materialno;
                            modelIn1.MaterialDesc   = materialdesc;
                            modelIn1.BatchNo        = DateTime.Now.ToString("yyyyMMdd");
                            modelIn1.ErpVoucherNo   = erpvoucherno;
                            modelIn1.Qty            = 1;
                            modelIn1.SerialNo       = squenceforin[kIn++];
                            modelIn1.Creater        = Userno;
                            modelIn1.ReceiveTime    = time2;
                            //modelIn1.ReceiveTime = string.IsNullOrEmpty(receivetime) ? DateTime.Now : Convert.ToDateTime(receivetime);
                            modelIn1.BarCode      = "2@" + modelIn1.StrongHoldCode + "@" + modelIn1.MaterialNo + "@" + modelIn1.BatchNo + "@" + modelIn1.Qty + "@" + modelIn1.SerialNo;
                            modelIn1.RowNo        = RowNO;
                            modelIn1.RowNoDel     = RowNODel;
                            modelIn1.BarcodeType  = 2;
                            modelIn1.ProductClass = Createname;
                            modelIn1.WorkNo       = WarehouseName;
                            modelIn1.TracNo       = TracNo;
                            modelIn1.ProjectNo    = ProjectNo;
                            modelIn1.fserialno    = model.SerialNo;
                            modelIn1.originalCode = flag;
                            listbarcode.Add(modelIn1);
                        }
                    }
                }
                if (inboxnum == 1)
                {
                    Barcode_Model model = new Barcode_Model();
                    model.CompanyCode    = CompanyCode;
                    model.StrongHoldCode = StrongHoldCode;
                    model.MaterialNoID   = Convert.ToInt32(MaterialNoID);
                    model.MaterialNo     = materialno;
                    model.MaterialDesc   = materialdesc;
                    model.BatchNo        = DateTime.Now.ToString("yyyyMMdd");
                    model.ErpVoucherNo   = erpvoucherno;
                    //model.EDate = Convert.ToDateTime(edate);
                    model.Qty      = Convert.ToDecimal(tailnum);
                    model.SerialNo = squence[k++];
                    model.Creater  = Userno;
                    //model.EAN = ean;
                    //model.ReceiveTime = string.IsNullOrEmpty(receivetime) ? DateTime.Now : Convert.ToDateTime(receivetime);
                    model.ReceiveTime  = time1;
                    model.BarCode      = "1@" + model.StrongHoldCode + "@" + model.MaterialNo + "@" + model.BatchNo + "@" + model.Qty + "@" + model.SerialNo;
                    model.RowNo        = RowNO;
                    model.RowNoDel     = RowNODel;
                    model.BarcodeType  = 1;
                    model.ProductClass = Createname;
                    model.WorkNo       = WarehouseName;
                    model.TracNo       = TracNo;
                    model.ProjectNo    = ProjectNo;
                    model.originalCode = flag;
                    listbarcode.Add(model);
                    if (modelList[0].sku == "是")
                    {
                        //本体打印
                        for (int ii = 0; ii < Convert.ToDecimal(tailnum); ii++)
                        {
                            Barcode_Model modelIn2 = new Barcode_Model();
                            modelIn2.CompanyCode    = CompanyCode;
                            modelIn2.StrongHoldCode = StrongHoldCode;
                            modelIn2.MaterialNoID   = Convert.ToInt32(MaterialNoID);
                            modelIn2.MaterialNo     = materialno;
                            modelIn2.MaterialDesc   = materialdesc;
                            modelIn2.BatchNo        = DateTime.Now.ToString("yyyyMMdd");
                            modelIn2.ErpVoucherNo   = erpvoucherno;
                            modelIn2.Qty            = 1;
                            modelIn2.SerialNo       = squenceforin[kIn++];
                            modelIn2.Creater        = Userno;
                            modelIn2.ReceiveTime    = time2;
                            //modelIn2.ReceiveTime = string.IsNullOrEmpty(receivetime) ? DateTime.Now : Convert.ToDateTime(receivetime);
                            modelIn2.BarCode      = "2@" + modelIn2.StrongHoldCode + "@" + modelIn2.MaterialNo + "@" + modelIn2.BatchNo + "@" + modelIn2.Qty + "@" + modelIn2.SerialNo;
                            modelIn2.RowNo        = RowNO;
                            modelIn2.RowNoDel     = RowNODel;
                            modelIn2.BarcodeType  = 2;
                            modelIn2.ProductClass = Createname;
                            modelIn2.WorkNo       = WarehouseName;
                            modelIn2.TracNo       = TracNo;
                            modelIn2.ProjectNo    = ProjectNo;
                            modelIn2.fserialno    = model.SerialNo;
                            modelIn2.originalCode = flag;
                            listbarcode.Add(modelIn2);
                        }
                    }
                }
                if (print_DB.SubBarcodes(listbarcode, "sup", 1, ref err))
                {
                    string serialnosB = "";
                    string serialnosS = "";
                    for (int i = 0; i < listbarcode.Count; i++)
                    {
                        if (listbarcode[i].BarcodeType == 1)
                        {
                            serialnosB += listbarcode[i].SerialNo + ",";
                        }
                        else
                        {
                            serialnosS += listbarcode[i].SerialNo + ",";
                        }
                    }
                    if (serialnosS == "")
                    {
                        return(Json(new { state = true, obj = time1.ToString("yyyy/MM/dd HH:mm:ss") }, JsonRequestBehavior.AllowGet));
                    }
                    else
                    {
                        return(Json(new { state = true, obj = time1.ToString("yyyy/MM/dd HH:mm:ss"), objS = time2.ToString("yyyy/MM/dd HH:mm:ss") }, JsonRequestBehavior.AllowGet));
                    }

                    //return Json(new { state = true, obj = serialnosB, objS = serialnosS }, JsonRequestBehavior.AllowGet);
                }
                else
                {
                    return(Json(new { state = false, obj = err }, JsonRequestBehavior.AllowGet));
                }
            }
            catch (Exception ex)
            {
                return(Json(new { state = false, obj = ex.ToString() }, JsonRequestBehavior.AllowGet));
            }
        }
Пример #26
0
        public Dictionary <string, decimal> GetPack(string mateno)
        {
            Print_DB db = new Print_DB();

            return(db.GetPack(mateno));
        }
Пример #27
0
        public JsonResult Print(string IDs, string Path)
        {
            try
            {
                List <Barcode_Model> barcodelist = new List <Barcode_Model>();
                var       Isxls = System.IO.Path.GetExtension(Path).ToString().ToLower();
                DataTable dt    = new DataTable();
                if (Isxls == ".xls")
                {
                    dt = ImportExcelFile(Path);
                }
                if (Isxls == ".xlsx")
                {
                    dt = ImportExcelFilexlsx(Path);
                }
                barcodelist = Print_DB.ConvertToModel <Barcode_Model>(dt);
                List <Barcode_Model> barcodelistnew    = new List <Barcode_Model>();
                List <Barcode_Model> barcodelistnewsub = new List <Barcode_Model>();
                List <Barcode_Model> barcodelistnewAll = new List <Barcode_Model>();
                string[]             ids = IDs.Split(',');
                for (int i = 0; i < ids.Length; i++)
                {
                    if (ids[i] != "")
                    {
                        List <Barcode_Model> barcodes = new List <Barcode_Model>();
                        barcodes.AddRange(barcodelist.Where(P => P.RowNo == ids[i]));
                        //单张条码
                        //Barcode_Model model = (Barcode_Model)DeepCopy(barcodes[0]);
                        //barcodelistnew.Add(model);
                        //多张条码
                        if (barcodes.Count == 1 && barcodes[0].BoxCount >= 1)
                        {
                            for (int j = 0; j < barcodes[0].BoxCount; j++)
                            {
                                Barcode_Model model = (Barcode_Model)DeepCopy(barcodes[0]);
                                barcodelistnew.Add(model);
                            }
                        }
                    }
                }

                if (barcodelistnew != null && barcodelistnew.Count > 0)
                {
                    string            strMsg  = "";
                    PrintInController printIn = new PrintInController();
                    List <string>     squence = printIn.GetSerialnos(barcodelistnew.Count, "外", ref strMsg);
                    int      k    = 0;
                    DateTime time = DateTime.Now;
                    for (int i = 0; i < barcodelistnew.Count; i++)
                    {
                        barcodelistnew[i].CompanyCode = "SHJC";
                        barcodelistnew[i].BarcodeType = 1;
                        barcodelistnew[i].SerialNo    = squence[k++];
                        barcodelistnew[i].Creater     = currentUser.UserNo;
                        barcodelistnew[i].ReceiveTime = time;
                        barcodelistnew[i].BarCode     = "1@" + barcodelistnew[i].StrongHoldCode + "@" + barcodelistnew[i].MaterialNo + "@" + barcodelistnew[i].BatchNo + "@" + barcodelistnew[i].Qty + "@" + barcodelistnew[i].SerialNo;

                        //查物料
                        T_Material_Func       funM      = new T_Material_Func();
                        string                strErrMsg = "";
                        List <T_MaterialInfo> modelList = funM.GetMaterialModelBySql(barcodelistnew[i].MaterialNo, ref strErrMsg);
                        if (modelList == null || modelList.Count == 0)
                        {
                            //失败
                            return(Json(new { state = false, obj = "没有该物料号" + barcodelistnew[i].MaterialNo }, JsonRequestBehavior.AllowGet));
                        }
                        if (modelList[0].sku == "是")
                        {
                            for (int kk = 0; kk < barcodelistnew[i].Qty; kk++)
                            {
                                Barcode_Model modelsub = (Barcode_Model)DeepCopy(barcodelistnew[i]);
                                modelsub.fserialno = barcodelistnew[i].SerialNo;
                                barcodelistnewsub.Add(modelsub);
                            }
                        }
                    }

                    //本体打印
                    DateTime timesub = DateTime.Now.AddSeconds(5);
                    if (barcodelistnewsub != null && barcodelistnewsub.Count > 0)
                    {
                        List <string> squencesub = printIn.GetSerialnos(barcodelistnewsub.Count, "内", ref strMsg);
                        int           ksub       = 0;

                        for (int isub = 0; isub < barcodelistnewsub.Count; isub++)
                        {
                            barcodelistnewsub[isub].CompanyCode = "SHJC";
                            barcodelistnewsub[isub].BarcodeType = 2;
                            barcodelistnewsub[isub].SerialNo    = squencesub[ksub++];
                            barcodelistnewsub[isub].Creater     = currentUser.UserNo;
                            barcodelistnewsub[isub].ReceiveTime = timesub;
                            barcodelistnewsub[isub].Qty         = 1;

                            barcodelistnewsub[isub].BarCode = "2@" + barcodelistnewsub[isub].StrongHoldCode + "@" + barcodelistnewsub[isub].MaterialNo + "@" + barcodelistnewsub[isub].BatchNo + "@1@" + barcodelistnewsub[isub].SerialNo;
                        }
                    }
                    barcodelistnewAll.AddRange(barcodelistnew);
                    barcodelistnewAll.AddRange(barcodelistnewsub);
                    Print_DB func = new Print_DB();
                    if (func.SubBarcodesNoPrint(barcodelistnewAll, ref strMsg))
                    {
                        if (barcodelistnewsub != null && barcodelistnewsub.Count > 0)
                        {
                            return(Json(new { state = true, obj = time.ToString("yyyy/MM/dd HH:mm:ss"), obj1 = timesub.ToString("yyyy/MM/dd HH:mm:ss") }, JsonRequestBehavior.AllowGet));
                        }
                        else
                        {
                            return(Json(new { state = true, obj = time.ToString("yyyy/MM/dd HH:mm:ss"), obj1 = "" }, JsonRequestBehavior.AllowGet));
                        }
                    }
                    else
                    {
                        //失败
                        return(Json(new { state = false, obj = strMsg }, JsonRequestBehavior.AllowGet));
                    }
                }
                else
                {
                    //失败
                    return(Json(new { state = false, obj = "数据为空" }, JsonRequestBehavior.AllowGet));
                }
            }
            catch (Exception ex)
            {
                return(Json(new { state = false, obj = ex.ToString() }, JsonRequestBehavior.AllowGet));
            }
        }
Пример #28
0
        public bool SubBarcodes(List <Barcode_Model> list, string ipport, decimal hasprint, ref string ErrMsg)
        {
            Print_DB db = new Print_DB();

            return(db.SubBarcodes(list, ipport, hasprint, ref ErrMsg, 0));
        }
Пример #29
0
        public JsonResult PrintList(string IDs)
        {
            if (string.IsNullOrEmpty(Userno))
            {
                return(Json(new { state = false, obj = "Cookie失效,重新登陆!" }, JsonRequestBehavior.AllowGet));
            }
            string strError = string.Empty;
            List <T_AdvInStockDetailInfo> lstAdvInStockDetailInfo = new List <T_AdvInStockDetailInfo>();

            string[] strId = IDs.Split(',');
            for (int i = 0; i < strId.Length; i++)
            {
                if (!string.IsNullOrEmpty(strId[i]))
                {
                    T_AdvInStockDetailInfo model = new T_AdvInStockDetailInfo();
                    model.ID = Convert.ToInt32(strId[i]);
                    if (!advInStockDetailService.GetModelByID(ref model, ref strError))
                    {
                        return(Json(new { state = false, obj = strError }, JsonRequestBehavior.AllowGet));
                    }
                    lstAdvInStockDetailInfo.Add(model);
                }
            }

            string               err         = "";
            Print_DB             print_DB    = new Print_DB();
            List <Barcode_Model> listbarcode = new List <Barcode_Model>();

            //每行打印
            if (lstAdvInStockDetailInfo != null && lstAdvInStockDetailInfo.Count != 0)
            {
                List <string> squence = GetSerialnos(lstAdvInStockDetailInfo.Count, ref err);
                int           k       = 0;
                for (int i = 0; i < lstAdvInStockDetailInfo.Count; i++)
                {
                    Barcode_Model model = new Barcode_Model();
                    model.CompanyCode    = lstAdvInStockDetailInfo[i].CompanyCode;
                    model.MaterialNoID   = lstAdvInStockDetailInfo[i].MaterialNoID;
                    model.MaterialNo     = lstAdvInStockDetailInfo[i].MaterialNo;
                    model.MaterialDesc   = lstAdvInStockDetailInfo[i].MaterialDesc;
                    model.BatchNo        = lstAdvInStockDetailInfo[i].SupBatch;
                    model.ErpVoucherNo   = lstAdvInStockDetailInfo[i].ErpVoucherNo;
                    model.EDate          = Convert.ToDateTime(lstAdvInStockDetailInfo[i].EDate);
                    model.Qty            = Convert.ToDecimal(lstAdvInStockDetailInfo[i].AdvQty);
                    model.StrongHoldCode = lstAdvInStockDetailInfo[i].StrongHoldCode;
                    model.SerialNo       = squence[k++];
                    model.Creater        = Userno;
                    model.EAN            = lstAdvInStockDetailInfo[i].EAN;
                    model.ReceiveTime    = Convert.ToDateTime(lstAdvInStockDetailInfo[i].CreateTime);
                    model.BarCode        = "1@" + model.StrongHoldCode + "@" + model.MaterialNo + "@" + model.EAN + "@" + model.EDate.ToString("yyyy-MM-dd") + "@" + model.BatchNo + "@" + model.Qty + "@" + model.SerialNo;
                    model.RowNo          = lstAdvInStockDetailInfo[i].RowNO;
                    model.RowNoDel       = lstAdvInStockDetailInfo[i].RowNODel;
                    model.BarcodeType    = 1;
                    model.ProductClass   = lstAdvInStockDetailInfo[i].Createname;
                    model.WorkNo         = lstAdvInStockDetailInfo[i].WarehouseName;
                    listbarcode.Add(model);
                }
            }


            if (print_DB.SubBarcodes(listbarcode, "sup", 1, ref err))
            {
                string serialnos = "";
                for (int i = 0; i < listbarcode.Count; i++)
                {
                    serialnos += listbarcode[i].SerialNo + ",";
                }
                return(Json(new { state = true, obj = serialnos }, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(new { state = false, obj = err }, JsonRequestBehavior.AllowGet));
            }
        }
Пример #30
0
        public bool FirstPrint(ref List <Barcode_Model> list, string ipport, ref string ErrMsg)
        {
            Print_DB db = new Print_DB();

            return(db.FirstPrint(ref list, ipport, ref ErrMsg));
        }