Example #1
0
        private void ProcessDetail(InWarehouse iwEnt)
        {
            ropEnts = ReturnOrderPart.FindAllByProperty(ReturnOrderPart.Prop_ReturnOrderId, id);
            foreach (ReturnOrderPart ropEnt in ropEnts)
            {
                ropEnt.DoDelete();
            }
            IList <string> entStrList = RequestData.GetList <string>("data");

            ropEnts = entStrList.Select(tent => JsonHelper.GetObject <ReturnOrderPart>(tent) as ReturnOrderPart).ToList();
            foreach (ReturnOrderPart ropEnt in ropEnts)
            {
                ropEnt.ReturnOrderId = ent.Id;
                ropEnt.DoCreate();
                OrdersPart opEnt = OrdersPart.Find(ropEnt.OrderPartId);//更新销售单明细的退货数量
                opEnt.ReturnCount = (opEnt.ReturnCount.HasValue ? opEnt.ReturnCount : 0) + ropEnt.Count;
                opEnt.DoUpdate();
                OtherInWarehouseDetail oidEnt = new OtherInWarehouseDetail();//创建入库单明细
                oidEnt.InWarehouseId    = iwEnt.Id;
                oidEnt.ProductId        = ropEnt.ProductId;
                oidEnt.ProductName      = ropEnt.ProductName;
                oidEnt.ProductCode      = ropEnt.ProductCode;
                oidEnt.ProductISBN      = ropEnt.Isbn;
                oidEnt.ProductType      = Product.Find(ropEnt.ProductId).ProductType;
                oidEnt.Quantity         = ropEnt.Count;
                oidEnt.InWarehouseState = "未入库";
                oidEnt.Remark           = ropEnt.Remark;
                oidEnt.DoCreate();
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            switch (RequestActionString)
            {
            case "batchdelete":
                IList <object> idList = RequestData.GetList <object>("IdList");
                if (idList != null && idList.Count > 0)
                {
                    foreach (object obj in idList)
                    {
                        InWarehouse[] iwEnts = InWarehouse.FindAllByProperties("PublicInterface", obj.ToString());
                        if (iwEnts.Length > 0)
                        {
                            OtherInWarehouseDetail.DeleteAll("InWarehouseId='" + iwEnts[0].Id + "'");
                            InWarehouse.DeleteAll("PublicInterface='" + obj.ToString() + "'");
                        }
                        DeliveryOrder[] doEnts = DeliveryOrder.FindAllByProperties("PId", obj.ToString());
                        if (doEnts.Length > 0)
                        {
                            DelieryOrderPart.DeleteAll("DId='" + doEnts[0].Id + "'");
                            DeliveryOrder.DeleteAll("PId='" + obj.ToString() + "'");
                        }
                        DataHelper.ExecSql("delete SHHG_AimExamine..WarehouseExchange where Id='" + obj.ToString() + "'");
                        DataHelper.ExecSql("delete SHHG_AimExamine..WarehouseExchangeDetail where WarehouseExchangeId='" + obj.ToString() + "'");
                        PageState.Add("Message", "删除成功!");
                    }
                }
                break;

            default:
                DoSelect();
                break;
            }
        }
Example #3
0
        private void DoBatchDelete()
        {
            int            index  = 0;
            IList <object> idList = RequestData.GetList <object>("IdList");

            if (idList != null && idList.Count > 0)
            {
                foreach (object obj in idList)
                {
                    Compressor compEnt = Compressor.Find(obj.ToString());
                    string     sql1    = @"from InWarehouseDetail  WHERE PATINDEX('%{0}%', SeriesArray) >0";
                    sql1 = string.Format(sql1, compEnt.SeriesNo);
                    IList <InWarehouseDetail> iwdEnts = InWarehouseDetail.FindAll(sql1);
                    if (iwdEnts.Count > 0)
                    {
                        index = iwdEnts[0].SeriesArray.IndexOf(compEnt.SeriesNo);
                        iwdEnts[0].SeriesArray = iwdEnts[0].SeriesArray.Remove(index, compEnt.SeriesNo.Length);
                        iwdEnts[0].DoUpdate();
                    }
                    string sql2 = @"from OtherInWarehouseDetail  WHERE PATINDEX('%{0}%', SeriesArray) > 0";
                    sql2 = string.Format(sql2, compEnt.SeriesNo);
                    IList <OtherInWarehouseDetail> oiwdEnts = OtherInWarehouseDetail.FindAll(sql2);
                    if (oiwdEnts.Count > 0)
                    {
                        index = oiwdEnts[0].SeriesArray.IndexOf(compEnt.SeriesNo);
                        oiwdEnts[0].SeriesArray = oiwdEnts[0].SeriesArray.Remove(index, compEnt.SeriesNo.Length);
                        oiwdEnts[0].DoUpdate();
                    }
                }
            }
            Compressor.DoBatchDelete(idList.ToArray());//不能仅仅删除压缩机记录 还得把InWarehouseDetail 或者OtherInWarehouseDetail 记录的压缩机序列号删除
        }
Example #4
0
        string type = String.Empty; // 对象类型

        protected void Page_Load(object sender, EventArgs e)
        {
            op   = RequestData.Get <string>("op");
            id   = RequestData.Get <string>("id");
            type = RequestData.Get <string>("type");
            IList <string> entStrList = RequestData.GetList <string>("data");
            InWarehouse    ent        = null;

            switch (RequestActionString)
            {
            case "create":
                ent               = this.GetPostedData <InWarehouse>();
                ent.State         = "未入库";
                ent.InWarehouseNo = DataHelper.QueryValue("select  SHHG_AimExamine.dbo.fun_getInWarehouseNo()").ToString();
                ent.CreateId      = UserInfo.UserID;
                ent.CreateName    = UserInfo.Name;
                ent.CreateTime    = System.DateTime.Now;
                ent.DoCreate();
                ProcessDetail(entStrList, ent);    //添加其他入库详情
                break;

            case "update":
                ent = this.GetMergedData <InWarehouse>();
                ent.DoUpdate();
                OtherInWarehouseDetail.DeleteAll("InWarehouseId='" + ent.Id + "'");
                ProcessDetail(entStrList, ent);    //添加其他入库详情
                break;

            case "batchdelete":
                DoBatchDelete();
                break;

            default:
                DoSelect();
                break;
            }
            if (op != "c" && op != "cs")
            {
                if (!String.IsNullOrEmpty(id))
                {
                    string sql = @"select A.*,C.Name from SHHG_AimExamine..InWarehouse as A 
                    left join SHHG_AimExamine..Warehouse as C on A.WarehouseId=C.Id where A.Id='{0}'";
                    sql = string.Format(sql, id);
                    IList <EasyDictionary> Dics = DataHelper.QueryDictList(sql);
                    if (Dics.Count > 0)
                    {
                        this.SetFormData(Dics[0]);
                    }
                }
            }
            else
            {
                //添加的时候自动生成入库单流水号
                PageState.Add("InWarehouseNo", DataHelper.QueryValue("select  SHHG_AimExamine.dbo.fun_getInWarehouseNo()"));
            }
        }
Example #5
0
        private void DoBatchDelete()
        {
            IList <string> entStrList = RequestData.GetList <string>("data");

            if (entStrList != null && entStrList.Count > 0)
            {
                for (int j = 0; j < entStrList.Count; j++)
                {
                    Newtonsoft.Json.Linq.JObject objL = JsonHelper.GetObject <Newtonsoft.Json.Linq.JObject>(entStrList[j]);
                    //这个地方不用判断    能进入修改的话。肯定没有实际入库记录。直接删除就可以
                    OtherInWarehouseDetail.DeleteAll("Id='" + objL.Value <string>("Id") + "'");
                }
            }
        }
Example #6
0
 private void ProcessInWarehouseDetail(IList <string> entStrList, InWarehouse iwEnt)
 {
     if (entStrList != null && entStrList.Count > 0)
     {
         for (int j = 0; j < entStrList.Count; j++)
         {
             JObject json = JsonHelper.GetObject <JObject>(entStrList[j]);
             OtherInWarehouseDetail oiwdEnt = new OtherInWarehouseDetail();
             oiwdEnt.InWarehouseId    = iwEnt.Id;
             oiwdEnt.ProductId        = json.Value <string>("ProductId");
             oiwdEnt.ProductName      = json.Value <string>("ProductName");
             oiwdEnt.ProductCode      = json.Value <string>("ProductCode");
             oiwdEnt.ProductPCN       = json.Value <string>("ProductPcn");
             oiwdEnt.ProductISBN      = json.Value <string>("ProductIsbn");
             oiwdEnt.InWarehouseState = "未入库";
             oiwdEnt.Quantity         = json.Value <int>("ExchangeQuantity");
             oiwdEnt.DoCreate();
         }
     }
 }
Example #7
0
 private void ProcessDetail(IList <string> entStrList, InWarehouse iwEnt)
 {
     if (entStrList != null && entStrList.Count > 0)
     {
         for (int j = 0; j < entStrList.Count; j++)
         {
             Newtonsoft.Json.Linq.JObject objL   = JsonHelper.GetObject <Newtonsoft.Json.Linq.JObject>(entStrList[j]);
             OtherInWarehouseDetail       oidEnt = new OtherInWarehouseDetail();
             oidEnt.InWarehouseId    = iwEnt.Id;
             oidEnt.ProductId        = objL.Value <string>("ProductId");
             oidEnt.ProductName      = objL.Value <string>("ProductName");
             oidEnt.ProductCode      = objL.Value <string>("ProductCode");
             oidEnt.ProductPCN       = objL.Value <string>("ProductPCN");
             oidEnt.ProductISBN      = objL.Value <string>("ProductISBN");
             oidEnt.ProductType      = objL.Value <string>("ProductType");
             oidEnt.Quantity         = objL.Value <int>("Quantity");
             oidEnt.InWarehouseState = "未入库";
             oidEnt.Remark           = objL.Value <string>("Remark");
             oidEnt.DoCreate();
         }
     }
 }
Example #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            id = RequestData.Get <string>("id");
            if (!string.IsNullOrEmpty(id))
            {
                roEnt = ReturnOrder.Find(id);
            }
            switch (RequestActionString)
            {
            case "delete":
                //先删除入库单及入库明细
                InWarehouse iwEnt = InWarehouse.FindAllByProperty(InWarehouse.Prop_PublicInterface, roEnt.Id).FirstOrDefault <InWarehouse>();
                IList <OtherInWarehouseDetail> oiwdEnts = OtherInWarehouseDetail.FindAllByProperty(OtherInWarehouseDetail.Prop_InWarehouseId, iwEnt.Id);
                foreach (OtherInWarehouseDetail oiwdEnt in oiwdEnts)
                {
                    oiwdEnt.DoDelete();
                }
                iwEnt.DoDelete();
                //更新销售单及销售明细
                SaleOrder soEnt = SaleOrder.FindAllByProperty(SaleOrder.Prop_Number, roEnt.OrderNumber).FirstOrDefault <SaleOrder>();
                soEnt.ReturnAmount = (soEnt.ReturnAmount.HasValue ? soEnt.ReturnAmount.Value : 0) - (roEnt.ReturnMoney.HasValue ? roEnt.ReturnMoney.Value : 0);
                soEnt.DoUpdate();
                IList <ReturnOrderPart> ropEnts = ReturnOrderPart.FindAllByProperty(ReturnOrderPart.Prop_ReturnOrderId, roEnt.Id);
                foreach (ReturnOrderPart ropEnt in ropEnts)
                {
                    OrdersPart opEnt = OrdersPart.Find(ropEnt.OrderPartId);
                    opEnt.ReturnCount = (opEnt.ReturnCount.HasValue ? opEnt.ReturnCount.Value : 0) - ropEnt.Count;
                    opEnt.DoUpdate();
                    ropEnt.DoDelete();
                }
                roEnt.DoDelete();
                break;

            default:
                DoSelect();
                break;
            }
        }
Example #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string id = RequestData.Get <string>("id");

            switch (RequestActionString)
            {
            case "Modify":
                PageState.Add("result", AllowOperate(id) == true ? "true" : "false");
                break;

            case "batchdelete":
                IList <object> idList = RequestData.GetList <object>("IdList");
                if (idList != null && idList.Count > 0)
                {
                    foreach (object obj in idList)
                    {
                        bool allowDelete = AllowOperate(obj.ToString());
                        if (allowDelete)
                        {
                            DataHelper.ExecSql("delete SHHG_AimExamine..InWarehouse where Id='" + obj.ToString() + "'");
                            OtherInWarehouseDetail.DeleteAll("InWarehouseId='" + obj + "'");
                            PageState.Add("Message", "删除成功!");
                        }
                        else
                        {
                            PageState.Add("Message", "有实际入库记录的入库单不允许删除!");
                            return;
                        }
                    }
                }
                break;

            default:
                DoSelect();
                break;
            }
        }
Example #10
0
        private void CreateLog()
        {
            IList <InWarehouseDetailDetail> iwddEnts = InWarehouseDetailDetail.FindAll();//入库

            foreach (InWarehouseDetailDetail iwddEnt in iwddEnts)
            {
                StockLog    slEnt = new StockLog();
                InWarehouse iwEnt = null;
                if (!string.IsNullOrEmpty(iwddEnt.InWarehouseDetailId))
                {
                    slEnt.InOrOutDetailId = iwddEnt.InWarehouseDetailId;
                    InWarehouseDetail iwdEnt = InWarehouseDetail.Find(iwddEnt.InWarehouseDetailId);
                    iwEnt = InWarehouse.Find(iwdEnt.InWarehouseId);
                }
                else
                {
                    slEnt.InOrOutDetailId = iwddEnt.OtherInWarehouseDetailId;
                    OtherInWarehouseDetail oiwdEnt = OtherInWarehouseDetail.Find(iwddEnt.OtherInWarehouseDetailId);
                    iwEnt = InWarehouse.Find(oiwdEnt.InWarehouseId);
                }
                slEnt.InOrOutBillNo = iwEnt.InWarehouseNo;
                slEnt.OperateType   = "产品入库";
                slEnt.WarehouseId   = iwEnt.WarehouseId;
                slEnt.WarehouseName = iwEnt.WarehouseName;
                //IList<StockInfo> siEnts = StockInfo.FindAllByProperties(StockInfo.Prop_ProductId, iwddEnt.ProductId, StockInfo.Prop_WarehouseId, iwEnt.WarehouseId);
                //if (siEnts.Count > 0)
                //{
                //    slEnt.StockQuantity = siEnts[0].StockQuantity;
                //}
                slEnt.Quantity  = iwddEnt.Quantity;
                slEnt.ProductId = iwddEnt.ProductId;
                Product pEnt = Product.TryFind(iwddEnt.ProductId);
                if (pEnt != null)
                {
                    slEnt.ProductName = pEnt.Name;
                    slEnt.ProductCode = pEnt.Code;
                    slEnt.ProductIsbn = pEnt.Isbn;
                    slEnt.ProductPcn  = pEnt.Pcn;
                    slEnt.CreateId    = iwddEnt.CreateId;
                    slEnt.CreateName  = iwddEnt.CreateName;
                    slEnt.CreateTime  = iwddEnt.CreateTime;
                    slEnt.DoCreate();
                }
            }
            //生成出库日志
            IList <DelieryOrderPart> dopEnts = DelieryOrderPart.FindAllByProperty(DelieryOrderPart.Prop_State, "已出库");

            foreach (DelieryOrderPart dopEnt in dopEnts)
            {
                StockLog slEnt = new StockLog();
                slEnt.InOrOutDetailId = dopEnt.Id;
                DeliveryOrder doEnt = DeliveryOrder.Find(dopEnt.DId);
                slEnt.InOrOutBillNo = doEnt.Number;
                slEnt.OperateType   = "产品出库";
                slEnt.WarehouseId   = doEnt.WarehouseId;
                slEnt.WarehouseName = doEnt.WarehouseName;
                //IList<StockInfo> siEnts = StockInfo.FindAllByProperties(StockInfo.Prop_ProductId, iwddEnt.ProductId, StockInfo.Prop_WarehouseId, iwEnt.WarehouseId);
                //if (siEnts.Count > 0)
                //{
                //    slEnt.StockQuantity = siEnts[0].StockQuantity;
                //}
                slEnt.Quantity = dopEnt.OutCount;
                if (!string.IsNullOrEmpty(dopEnt.ProductId))
                {
                    slEnt.ProductId = dopEnt.ProductId;
                    Product pEnt = Product.TryFind(dopEnt.ProductId);
                    if (pEnt != null)
                    {
                        slEnt.ProductName = pEnt.Name;
                        slEnt.ProductCode = pEnt.Code;
                        slEnt.ProductIsbn = pEnt.Isbn;
                        slEnt.ProductPcn  = pEnt.Pcn;
                        slEnt.CreateId    = dopEnt.CreateId;
                        slEnt.CreateName  = dopEnt.CreateName;
                        slEnt.CreateTime  = dopEnt.CreateTime;
                        slEnt.DoCreate();
                    }
                }
            }
            //盘点操作库存日志
            string sql = "select * from SHHG_AimExamine..StockCheckDetail where StockCheckResult!='正常' and StockCheckState='盘点结束'";
            IList <EasyDictionary> scdDics = DataHelper.QueryDictList(sql);

            foreach (EasyDictionary scdDic in scdDics)
            {
                StockLog slEnt = new StockLog();
                slEnt.InOrOutDetailId = scdDic.Get <string>("Id");
                StockCheck scEnt = StockCheck.Find(scdDic.Get <string>("StockCheckId"));
                slEnt.InOrOutBillNo = scEnt.StockCheckNo;
                slEnt.OperateType   = "库存盘点";
                slEnt.WarehouseId   = scEnt.WarehouseId;
                slEnt.WarehouseName = scEnt.WarehouseName;
                slEnt.StockQuantity = scdDic.Get <Int32>("StockQuantity");
                slEnt.Quantity      = scdDic.Get <Int32>("StockCheckQuantity") - scdDic.Get <Int32>("StockQuantity");
                slEnt.ProductId     = scdDic.Get <string>("ProductId");
                Product pEnt = Product.TryFind(slEnt.ProductId);
                if (pEnt != null)
                {
                    slEnt.ProductName = pEnt.Name;
                    slEnt.ProductCode = pEnt.Code;
                    slEnt.ProductIsbn = pEnt.Isbn;
                    slEnt.ProductPcn  = pEnt.Pcn;
                    slEnt.CreateId    = scEnt.CreateId;
                    slEnt.CreateName  = scEnt.CreateName;
                    slEnt.CreateTime  = scEnt.CreateTime;
                    slEnt.DoCreate();
                }
            }
        }
        private void ProcessInWarehouse(InWarehouse tempEnt)
        {
            if (tempEnt.InWarehouseType == "采购入库")
            {
                //判断其下所有的入库详细状态都未已入库 则自己的状态改为已入库
                IList <InWarehouseDetail> iwdEnts = InWarehouseDetail.FindAll("from InWarehouseDetail where InWarehouseState='未入库' and InWarehouseId='" + tempEnt.Id + "'");
                if (iwdEnts.Count == 0)
                {
                    tempEnt.State = "已入库";
                    tempEnt.InWarehouseEndTime = System.DateTime.Now;
                    tempEnt.CheckUserId        = UserInfo.UserID;
                    tempEnt.CheckUserName      = UserInfo.Name;
                    tempEnt.DoUpdate();
                }
            }
            else
            {
                IList <OtherInWarehouseDetail> oiwdEnts = OtherInWarehouseDetail.FindAll("from OtherInWarehouseDetail where InWarehouseState='未入库' and InWarehouseId='" + tempEnt.Id + "'");
                if (oiwdEnts.Count == 0)//如果明细都入库了
                {
                    //add by cc
                    string db = ConfigurationManager.AppSettings["ExamineDB"];
                    if (tempEnt.InWarehouseType == "退货入库")
                    {
                        ReturnOrder rtnOrder = ReturnOrder.TryFind(tempEnt.PublicInterface);
                        if (rtnOrder != null)
                        {
                            rtnOrder.State = "已完成";
                            rtnOrder.DoSave();
                            //判断是否已经全部退货
                            //string DeliveryState = "";
                            //string tempId = DataHelper.QueryValue<string>("select top 1 Id from " + db + "..Saleorders where number='" + rtnOrder.OrderNumber + "'");
                            //if (!string.IsNullOrEmpty(tempId))
                            //{
                            //    DeliveryState = DataHelper.QueryValue<string>("select " + db + ".dbo.fun_getDeliveryState('" + tempId + "')");
                            //}

                            ////更新SaleOrder表出库状态
                            //if (DeliveryState == "已全部退货")
                            //{
                            //    DataHelper.ExecSql("update " + db + "..SaleOrders set DeState='已全部退货',DeliveryState='已全部退货' where Number='" + rtnOrder.OrderNumber + "'");
                            //}
                            //else
                            //{
                            //    DataHelper.ExecSql("update " + db + "..SaleOrders set DeState='" + DeliveryState + "' where Number='" + rtnOrder.OrderNumber + "'");
                            //    //DataHelper.ExecSql("update " + db + "..SaleOrders set DeState=" + db + ".dbo.fun_getDeliveryState(Id) where Number='" + rtnOrder.OrderNumber + "'");
                            //}
                        }
                    }
                    //else if (tempEnt.InWarehouseType == "换货入库")
                    //{
                    //    ChangeProduct dorder = ChangeProduct.TryFind(tempEnt.PublicInterface);
                    //    if (dorder != null)
                    //    {
                    //        if ((dorder.State + "").Contains("已出库"))
                    //        {
                    //            dorder.State = "已完成";
                    //        }
                    //        else
                    //        {
                    //            dorder.State += ",仓库已入库:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm");
                    //        }
                    //        dorder.DoSave();

                    //        //更新SaleOrder表出库状态
                    //        DataHelper.ExecSql("update " + db + "..SaleOrders set DeState=" + db + ".dbo.fun_getDeliveryState(Id) where Number='" + dorder.OrderNumber + "'");
                    //    }
                    //}
                    //end add by cc
                    else if (tempEnt.InWarehouseType == "调拨入库")
                    {
                        WarehouseExchange weEnt = WarehouseExchange.TryFind(tempEnt.PublicInterface);
                        weEnt.InWarehouseState = "已入库";
                        weEnt.DoUpdate();
                        if (weEnt.OutWarehouseState == "已出库")
                        {
                            weEnt.ExchangeState = "已结束";
                            weEnt.EndTime       = System.DateTime.Now;
                            weEnt.DoUpdate();
                        }
                    }
                    tempEnt.State = "已入库";
                    tempEnt.InWarehouseEndTime = System.DateTime.Now;
                    tempEnt.CheckUserId        = UserInfo.UserID;
                    tempEnt.CheckUserName      = UserInfo.Name;
                    tempEnt.DoUpdate();
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            op = RequestData.Get <string>("op");
            id = RequestData.Get <string>("id");
            switch (RequestActionString)
            {
            case "IsIsbn":
                string          val     = RequestData.Get <string>("Value");
                IList <Product> proEnts = Product.FindAll("from Product where Isbn='" + val + "'");
                if (proEnts.Count > 0)
                {
                    PageState.Add("IsIsbn", true);
                }
                else
                {
                    PageState.Add("IsIsbn", false);
                }
                break;

            case "GetPackageInfo":
                string Isbn = RequestData.Get <string>("Isbn");
                sql = "select * from SHHG_AimExamine..Products where FirstSkinIsbn='" + Isbn + "' and FirstSkinCapacity is not null";
                IList <EasyDictionary> dics = DataHelper.QueryDictList(sql);
                if (dics.Count > 0)
                {
                    PageState.Add("ProductIsbn", dics[0].Get <string>("Isbn").ToUpper());
                    PageState.Add("ProductQuan", dics[0].Get <int>("FirstSkinCapacity"));
                }
                sql  = "select * from SHHG_AimExamine..Products where SecondSkinIsbn='" + Isbn + "' and SecondSkinCapacity is not null";
                dics = DataHelper.QueryDictList(sql);
                if (dics.Count > 0)
                {
                    PageState.Add("ProductIsbn", dics[0].Get <string>("Isbn").ToUpper());
                    PageState.Add("ProductQuan", dics[0].Get <int>("SecondSkinCapacity"));
                }
                break;

            case "ScanSkin":    //判断包装编号是否存在
                string       skinNo = RequestData.Get <string>("SkinNo");
                IList <Skin> sEnts  = Skin.FindAll("from Skin where SkinNo='" + skinNo + "'");
                if (sEnts.Count > 0)    //如果该包装的记录不存在
                {
                    PageState.Add("SkinExist", true);
                }
                else
                {
                    PageState.Add("SkinExist", false);
                }
                break;

            case "ScanCompressor":
                string             seriesNo = RequestData.Get <string>("SeriesNo");
                IList <Compressor> cEnts    = Compressor.FindAll("from Compressor where SeriesNo='" + seriesNo + "'");
                if (cEnts.Count == 0)
                {
                    PageState.Add("CompressorExist", false);
                }
                else
                {
                    PageState.Add("CompressorExist", true);
                }
                break;

            case "InWarehouse":
                InWarehouse    iwEnt      = InWarehouse.TryFind(id);
                IList <string> entStrList = RequestData.GetList <string>("data");
                if (entStrList != null && entStrList.Count > 0)
                {
                    for (int j = 0; j < entStrList.Count; j++)
                    {
                        Newtonsoft.Json.Linq.JObject objL = JsonHelper.GetObject <Newtonsoft.Json.Linq.JObject>(entStrList[j]);
                        if (Convert.ToInt32(objL.Value <string>("ActuallyQuantity")) > 0)    //只有输入了入库数量才会增加实际入库记录
                        {
                            InWarehouseDetailDetail iwddEnt = new InWarehouseDetailDetail(); //新建一个实际入库详细信息
                            if (iwEnt.InWarehouseType == "采购入库")
                            {
                                iwddEnt.InWarehouseDetailId   = objL.Value <string>("Id");
                                iwddEnt.PurchaseOrderDetailId = objL.Value <string>("PurchaseOrderDetailId");
                            }
                            else    //其他入库的情形
                            {
                                iwddEnt.OtherInWarehouseDetailId = objL.Value <string>("Id");
                            }
                            iwddEnt.Quantity  = Convert.ToInt32(objL.Value <string>("ActuallyQuantity"));
                            iwddEnt.ProductId = objL.Value <string>("ProductId");
                            iwddEnt.Remark    = objL.Value <string>("Remark");
                            iwddEnt.DoCreate();

                            StockLog slEnt = new StockLog();    //创建库存变更日志
                            slEnt.InOrOutDetailId = objL.Value <string>("Id");
                            slEnt.InOrOutBillNo   = iwEnt.InWarehouseNo;
                            slEnt.OperateType     = "产品入库";
                            slEnt.WarehouseId     = iwEnt.WarehouseId;
                            slEnt.WarehouseName   = iwEnt.WarehouseName;
                            IList <StockInfo> siEnts = StockInfo.FindAllByProperties(StockInfo.Prop_ProductId, objL.Value <string>("ProductId"), StockInfo.Prop_WarehouseId, iwEnt.WarehouseId);
                            if (siEnts.Count > 0)
                            {
                                slEnt.StockQuantity = siEnts[0].StockQuantity;
                            }
                            slEnt.Quantity  = Convert.ToInt32(objL.Value <string>("ActuallyQuantity"));
                            slEnt.ProductId = objL.Value <string>("ProductId");
                            Product pEnt = Product.Find(objL.Value <string>("ProductId"));
                            slEnt.ProductName = pEnt.Name;
                            slEnt.ProductCode = pEnt.Code;
                            slEnt.ProductIsbn = pEnt.Isbn;
                            slEnt.ProductPcn  = pEnt.Pcn;
                            slEnt.DoCreate();

                            ProcessSkin(objL.Value <string>("SkinArray"), objL.Value <string>("ISBN"), iwEnt.Id);
                            ProcessCompressor(objL.Value <string>("SeriesArray"), objL.Value <string>("ISBN"), iwEnt.Id);
                            processremark(objL.Value <string>("Remark"), pEnt, iwEnt.Id);

                            //如果实际入库数量和未入库的数量相等 则入库状态为已入库
                            if (objL.Value <string>("ActuallyQuantity") == objL.Value <string>("NoIn"))
                            {
                                if (iwEnt.InWarehouseType == "采购入库")
                                {
                                    InWarehouseDetail iwdEnt = InWarehouseDetail.Find(objL.Value <string>("Id"));
                                    if (!string.IsNullOrEmpty(objL.Value <string>("SkinArray")))
                                    {
                                        iwdEnt.SkinArray = objL.Value <string>("SkinArray").ToString();
                                    }
                                    if (!string.IsNullOrEmpty(objL.Value <string>("SeriesArray")))
                                    {
                                        iwdEnt.SeriesArray = objL.Value <string>("SeriesArray").ToString();
                                    }
                                    iwdEnt.InWarehouseState = "已入库";
                                    iwdEnt.DoUpdate();
                                }
                                else
                                {
                                    OtherInWarehouseDetail oiwdEnt = OtherInWarehouseDetail.Find(objL.Value <string>("Id"));
                                    oiwdEnt.InWarehouseState = "已入库";
                                    if (!string.IsNullOrEmpty(objL.Value <string>("SkinArray")))
                                    {
                                        oiwdEnt.SkinArray = objL.Value <string>("SkinArray").ToString();
                                    }
                                    if (!string.IsNullOrEmpty(objL.Value <string>("SeriesArray")))
                                    {
                                        oiwdEnt.SeriesArray = objL.Value <string>("SeriesArray").ToString();
                                    }
                                    oiwdEnt.DoUpdate();
                                }
                            }
                            else    //如果未入库的数量不等于现在输入的数量。只更新包装和压缩机序列号集合
                            {
                                if (iwEnt.InWarehouseType == "采购入库")
                                {
                                    InWarehouseDetail iwdEnt = InWarehouseDetail.Find(objL.Value <string>("Id"));
                                    iwdEnt.Remark = objL.Value <string>("Remark");
                                    if (!string.IsNullOrEmpty(objL.Value <string>("SkinArray")))
                                    {
                                        iwdEnt.SkinArray = objL.Value <string>("SkinArray").ToString();
                                    }
                                    if (!string.IsNullOrEmpty(objL.Value <string>("SeriesArray")))
                                    {
                                        iwdEnt.SeriesArray = objL.Value <string>("SeriesArray").ToString();
                                    }
                                    iwdEnt.DoUpdate();
                                }
                                else
                                {
                                    OtherInWarehouseDetail oiwdEnt = OtherInWarehouseDetail.Find(objL.Value <string>("Id"));
                                    oiwdEnt.Remark = objL.Value <string>("Remark");
                                    if (!string.IsNullOrEmpty(objL.Value <string>("SkinArray")))
                                    {
                                        oiwdEnt.SkinArray = objL.Value <string>("SkinArray").ToString();
                                    }
                                    if (!string.IsNullOrEmpty(objL.Value <string>("SeriesArray")))
                                    {
                                        oiwdEnt.SeriesArray = objL.Value <string>("SeriesArray").ToString();
                                    }
                                    oiwdEnt.DoUpdate();
                                }
                            }
                            //修改库存
                            InStorage(iwddEnt.ProductId, iwddEnt.Quantity.Value, iwEnt.WarehouseId);
                        }
                    }
                }
                ProcessInWarehouse(iwEnt);
                if (iwEnt.InWarehouseType == "采购入库")    //处理采购单和采购单详细
                {
                    ProcessPurchaseOrderAndDetail(iwEnt);
                }
                break;

            default:
                DoSelect();
                break;
            }
        }