Exemple #1
0
        public bool UpdateT_InStockStatus(UserInfo user, ref T_InStockInfo t_instock, ref string strError)
        {
            T_InStock_Func tfunc = new T_InStock_Func();

            return(tfunc.UpadteModelByModelSql(user, t_instock, ref strError));
        }
Exemple #2
0
        public bool GetT_InStockListByPage(ref List <T_InStockInfo> modelList, UserInfo user, T_InStockInfo t_instock, ref DividPage page, ref string strError)
        {
            T_InStock_Func tfunc = new T_InStock_Func();

            return(tfunc.GetModelListByPage(ref modelList, user, t_instock, ref page, ref strError));
        }
Exemple #3
0
        public bool GetT_InStockByID(ref T_InStockInfo model, ref string strError)
        {
            T_InStock_Func tfunc = new T_InStock_Func();

            return(tfunc.GetModelByID(ref model, ref strError));
        }
Exemple #4
0
        public bool DeleteT_InStockByModel(UserInfo user, T_InStockInfo model, ref string strError)
        {
            T_InStock_Func tfunc = new T_InStock_Func();

            return(tfunc.DeleteModelByModel(user, model, ref strError));
        }
Exemple #5
0
        public bool SaveT_InStock(UserInfo user, ref T_InStockInfo t_instock, ref string strError)
        {
            T_InStock_Func tfunc = new T_InStock_Func();

            return(tfunc.SaveModelBySqlToDB(user, ref t_instock, ref strError));
        }
Exemple #6
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));
            }
        }