Beispiel #1
0
        public static int CreateSKUCode(string sku, int count, string planNo, ISession NSession)
        {
            int    code   = GetSKUCode(count, NSession);
            string create = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");

            using (var tr = NSession.BeginTransaction())
            {
                for (int i = code; i < code + count; i++)
                {
                    SKUCodeType SKUCode = new SKUCodeType();
                    SKUCode.Code     = i;
                    SKUCode.SKU      = sku;
                    SKUCode.IsOut    = 0;
                    SKUCode.IsNew    = 1;
                    SKUCode.IsSend   = 0;
                    SKUCode.IsScan   = 0;
                    SKUCode.CreateOn = create;
                    SKUCode.PlanNo   = planNo;
                    SKUCode.SendOn   = "";
                    SKUCode.PeiOn    = "";
                    NSession.Save(SKUCode);
                }
                tr.Commit();
            }


            return(code);
        }
Beispiel #2
0
        public ActionResult SetSKUCode2(int code)
        {
            IList <SKUCodeType> list =
                NSession.CreateQuery("from SKUCodeType where Code=:p").SetInt32("p", code).SetMaxResults(1).List
                <SKUCodeType>();

            if (list.Count > 0)
            {
                SKUCodeType sku = list[0];
                if (sku.IsOut == 1 || sku.IsSend == 1)
                {
                    return(Json(new { IsSuccess = false, Result = "条码:" + code + " 已经配过货,SKU:" + sku.SKU + " 出库时间:" + sku.PeiOn + ",出库订单:" + sku.OrderNo + " ,请将此产品单独挑出来!" }));
                }
                if (sku.IsScan == 1)
                {
                    return(Json(new { IsSuccess = false, Result = "条码:" + code + " 已经清点扫描了,SKU:" + sku.SKU + " 刚刚已经扫描过了。你查看下是条码重复扫描了,还是有贴重复的了!" }));
                }
                sku.IsScan = 1;
                NSession.Save(sku);
                NSession.Flush();
                object obj =
                    NSession.CreateQuery("select count(Id) from SKUCodeType where SKU=:p and IsScan=1 and IsOut=0").SetString("p", sku.SKU).
                    UniqueResult();
                return(Json(new { IsSuccess = true, Result = "条码:" + code + " 的信息.SKU:" + sku.SKU + " 此条码未出库。条码正确!!!", ccc = sku.SKU + "已经扫描了" + obj + "个" }));
            }
            else
            {
                return(Json(new { IsSuccess = false, Result = "条码:" + code + " 无法找到 ,请查看扫描是否正确!" }));
            }
        }
Beispiel #3
0
 public JsonResult DeleteConfirmed2(int id)
 {
     try
     {
         SKUCodeType obj = NSession.Get <SKUCodeType>(id);
         NSession.Delete(obj);
         NSession.Flush();
     }
     catch (Exception ee)
     {
         return(Json(new { IsSuccess = false, ErrorMsg = "出错了" }));
     }
     return(Json(new { IsSuccess = true }));
 }
Beispiel #4
0
        public ActionResult SetSKUCode(int code, string sku)
        {
            return(Json(new { IsSuccess = false, Result = "此功能作废,请不要这个功能!" }));

            object count = NSession.CreateQuery("select count(Id) from ProductType where SKU='" + sku + "'").UniqueResult();

            sku = sku.Trim();
            SqlConnection conn = new SqlConnection("server=122.227.207.204;database=Feidu;uid=sa;pwd=`1q2w3e4r");
            string        sql  = "select top 1 SKU from SkuCode where Code={0}or Code={1} ";

            conn.Open();
            SqlCommand sqlCommand = new SqlCommand(string.Format(sql, code, (code + 1000000)), conn);
            object     objSKU     = sqlCommand.ExecuteScalar();

            conn.Close();
            if (objSKU != null)
            {
                if (objSKU.ToString().Trim().ToUpper() != sku.Trim().ToUpper())
                {
                    return(Json(new { IsSuccess = false, Result = "这个条码对应是的" + objSKU + ",不是现在的:" + sku + "!" }));
                }
            }

            if (Convert.ToInt32(count) > 0)
            {
                object count1 =
                    NSession.CreateQuery("select count(Id) from SKUCodeType where Code=:p").SetInt32("p", code).
                    UniqueResult();
                if (Convert.ToInt32(count1) == 0)
                {
                    SKUCodeType skuCode = new SKUCodeType {
                        Code = code, SKU = sku, IsNew = 0, IsOut = 0
                    };
                    NSession.Save(skuCode);
                    NSession.Flush();
                    Utilities.StockIn(1, sku, 1, 0, "条码清点入库", CurrentUser.Realname, "", NSession);
                    return(Json(new { IsSuccess = true, Result = "添加成功!" }));
                }
                else
                {
                    return(Json(new { IsSuccess = false, Result = "这个条码已经添加!" }));
                }
            }
            else
            {
                return(Json(new { IsSuccess = false, Result = "没有这个产品!" }));
            }
        }
Beispiel #5
0
        public ActionResult GetSKUByCode(string code)
        {
            IList <SKUCodeType> list =
                NSession.CreateQuery("from SKUCodeType where Code=:p").SetString("p", code).SetMaxResults(1).List
                <SKUCodeType>();

            if (list.Count > 0)
            {
                SKUCodeType sku = list[0];
                if (sku.IsOut == 0)
                {
                    return(Json(new { IsSuccess = true, Result = sku.SKU.Trim() }));
                }
                else
                {
                    return(Json(new { IsSuccess = false, Result = "当前产品已经出库过了!" }));
                }
            }
            return(Json(new { IsSuccess = false, Result = "没有找到这个产品!" }));
        }