Exemplo n.º 1
0
 private string removeInventory(HttpContext context)
 {
     try
     {
         //using (DXInfo.Models.AMSCM amscm = new DXInfo.Models.AMSCM())
         //{
         DXInfo.Models.tbInventory inventory = Uow.tbInventory.GetById(g => g.cnvcInvCode == context.Request.Form["cnvcInvCode"]);
         Uow.tbInventory.Delete(inventory);
         DXInfo.Models.tbGoods tbGoods = Uow.tbGoods.GetById(g => g.vcGoodsID == inventory.cnvcInvCode);
         if (tbGoods != null)
         {
             Uow.tbGoods.Delete(tbGoods);
         }
         Uow.Commit();
         //}
     }
     catch (ArgumentNullException aex)
     {
         ExceptionPolicy.HandleException(aex, ServiceHelper.ExceptionPolicy);
         return(ServiceHelper.JsonSerializer <JEasyUIResult>(new JEasyUIResult(false, aex.Message)));
     }
     catch (DbUpdateException dex)
     {
         ExceptionPolicy.HandleException(dex, ServiceHelper.ExceptionPolicy);
         return(ServiceHelper.JsonSerializer <JEasyUIResult>(new JEasyUIResult(false, dex.Message)));
     }
     return(ServiceHelper.JsonSerializer <JEasyUIResult>(new JEasyUIResult(true, "")));
 }
Exemplo n.º 2
0
 public static void SyncGoods(DXInfo.Models.tbInventory inv, IAMSCMUow uow)
 {
     DXInfo.Models.tbGoods tbGoods = uow.tbGoods.GetById(g => g.vcGoodsID == inv.cnvcInvCode);
     if (inv.cnbSale)
     {
         if (tbGoods == null)
         {
             DXInfo.Models.tbGoods gs = new DXInfo.Models.tbGoods();
             gs.vcGoodsID   = inv.cnvcInvCode;
             gs.vcGoodsName = inv.cnvcInvName;
             gs.vcSpell     = Helper.GetChineseSpell(inv.cnvcInvName);
             gs.nPrice      = Convert.ToDecimal(inv.cnfRetailPrice);
             gs.nRate       = 0;
             gs.iIgValue    = -1;
             gs.cNewFlag    = "0";
             gs.vcComments  = "存货档案添加同步";
             uow.tbGoods.Add(gs);
         }
         else
         {
             if (tbGoods.vcGoodsName != inv.cnvcInvName)
             {
                 tbGoods.vcGoodsName = inv.cnvcInvName;
                 tbGoods.vcSpell     = Helper.GetChineseSpell(inv.cnvcInvName);
             }
             if (inv.cnfRetailPrice > 0)
             {
                 tbGoods.nPrice = Convert.ToDecimal(inv.cnfRetailPrice);
             }
             tbGoods.vcComments = "存货档案修改同步";
         }
     }
     else
     {
         if (tbGoods != null)
         {
             uow.tbGoods.Delete(tbGoods);
         }
     }
 }
Exemplo n.º 3
0
        private string updateInventory(HttpContext context)
        {
            try
            {
                //using (DXInfo.Models.AMSCM amscm = new DXInfo.Models.AMSCM())
                //{
                DXInfo.Models.tbInventory inventory = Uow.tbInventory.GetById(g => g.cnvcInvCode == context.Request.Form["cnvcInvCode"]);
                inventory.cnbProductBill = context.Request.Form["cnbProductBill"] == "on" ? true : false;

                inventory.cnvcInvName = context.Request.Form["cnvcInvName"];
                inventory.cnvcInvStd  = context.Request.Form["cnvcInvStd"];
                inventory.cnbSale     = context.Request.Form["cnbSale"] == "on"?true:false;
                inventory.cnbPurchase = context.Request.Form["cnbPurchase"] == "on"?true:false;
                inventory.cnbSelf     = context.Request.Form["cnbSelf"] == "on"?true:false;
                inventory.cnbComsume  = context.Request.Form["cnbComsume"] == "on" ? true : false;
                if (context.Request.Form["cniInvCCost"] != "")
                {
                    inventory.cniInvCCost = Convert.ToDecimal(context.Request.Form["cniInvCCost"]);
                }
                if (context.Request.Form["cniInvNCost"] != "")
                {
                    inventory.cniInvNCost = Convert.ToDecimal(context.Request.Form["cniInvNCost"]);
                }
                if (context.Request.Form["cniSafeNum"] != "")
                {
                    inventory.cniSafeNum = Convert.ToDecimal(context.Request.Form["cniSafeNum"]);
                }
                if (context.Request.Form["cniLowSum"] != "")
                {
                    inventory.cniLowSum = Convert.ToDecimal(context.Request.Form["cniLowSum"]);
                }
                if (context.Request.Form["cndSDate"] != "")
                {
                    inventory.cndSDate = Convert.ToDateTime(context.Request.Form["cndSDate"]);
                }
                if (context.Request.Form["cndEDate"] != "")
                {
                    inventory.cndEDate = Convert.ToDateTime(context.Request.Form["cndEDate"]);
                }
                inventory.cnvcCreatePerson = context.Request.Form["cnvcCreatePerson"];
                inventory.cnvcModifyPerson = context.Request.Form["cnvcModifyPerson"];

                inventory.cndModifyDate       = DateTime.Now;
                inventory.cnvcValueType       = context.Request.Form["cnvcValueType"];
                inventory.cnvcGroupCode       = context.Request.Form["cnvcGroupCode"];
                inventory.cnvcComUnitCode     = context.Request.Form["cnvcComUnitCode"];
                inventory.cnvcSAComUnitCode   = context.Request.Form["cnvcSAComUnitCode"];
                inventory.cnvcPUComUnitCode   = context.Request.Form["cnvcPUComUnitCode"];
                inventory.cnvcSTComUnitCode   = context.Request.Form["cnvcSTComUnitCode"];
                inventory.cnvcProduceUnitCode = context.Request.Form["cnvcProduceUnitCode"];
                if (context.Request.Form["cnfRetailPrice"] != "")
                {
                    inventory.cnfRetailPrice = Convert.ToDecimal(context.Request.Form["cnfRetailPrice"]);
                }
                inventory.cnvcShopUnitCode = context.Request.Form["cnvcShopUnitCode"];
                inventory.cnvcFeel         = context.Request.Form["cnvcFeel"];
                inventory.cnvcOrganise     = context.Request.Form["cnvcOrganise"];
                inventory.cnvcColor        = context.Request.Form["cnvcColor"];
                inventory.cnvcTaste        = context.Request.Form["cnvcTaste"];
                if (context.Request.Form["cnnExpire"] != "")
                {
                    inventory.cnnExpire = Convert.ToInt32(context.Request.Form["cnnExpire"]);
                }
                if (context.Request.Form["cnnDue"] != "")
                {
                    inventory.cnnDue = Convert.ToInt32(context.Request.Form["cnnDue"]);
                }

                ServiceHelper.SyncGoods(inventory, Uow);
                Uow.Commit();
                //}
            }
            catch (NullReferenceException nex)
            {
                ExceptionPolicy.HandleException(nex, ServiceHelper.ExceptionPolicy);
                return(ServiceHelper.JsonSerializer <JEasyUIResult>(new JEasyUIResult(false, nex.Message)));
            }
            catch (DbUpdateException dex)
            {
                ExceptionPolicy.HandleException(dex, ServiceHelper.ExceptionPolicy);
                return(ServiceHelper.JsonSerializer <JEasyUIResult>(new JEasyUIResult(false, dex.Message)));
            }
            return(ServiceHelper.JsonSerializer <JEasyUIResult>(new JEasyUIResult(true, "")));
        }