Exemple #1
0
        /// <summary>
        /// 获得实体
        /// </summary>
        /// <returns></returns>
        private StorgeLock GetEntity()
        {
            StorgeLock entity = new StorgeLock();

            entity.ID = saveLockID;
            entity.SelectByID();
            entity.WHID     = saveItemWHID;
            entity.ItemCode = saveItemCode;
            entity.ItemName = saveItemName;
            entity.ItemStd  = saveItemStd;
            entity.LockSO   = txtLockSO.Text.Trim();
            entity.LockQty  = SysConvert.ToDecimal(txtLockQty.Text.Trim());
            entity.LockTime = DateTime.Now.Date;
            //ParamSetRule rule = new ParamSetRule();
            //if (this.FormListAID == (int)WHType.色纱)
            //{
            //    entity.NeedDate = DateTime.Now.AddDays(rule.RShowInt((int)ParamSet.色纱锁定期限));
            //}
            //else if (this.FormListAID == (int)WHType.坯纱)
            //{
            //    entity.NeedDate = DateTime.Now.AddDays(rule.RShowInt((int)ParamSet.坯纱锁定期限));
            //}
            entity.LockOPID = SysConvert.ToString(drpOPID.EditValue);
            entity.LockDesc = txtRemark.Text.Trim();
            entity.Remark   = txtRemark.Text.Trim();
            //entity.StorgeID = saveStorgeID;
            entity.Batch       = saveBatch;
            entity.VendorBatch = saveVendorBatch;
            entity.ColorNum    = saveColorNum;
            entity.ColorName   = saveColorName;
            entity.JarNum      = saveJarNum;
            //entity.DSN = saveDSN;
            //entity.SSN = saveSSN;
            return(entity);
        }
Exemple #2
0
        /// <summary>
        /// 解锁
        /// </summary>
        /// <param name="p_StorgeLockID">锁定记录ID</param>
        /// <param name="sqlTrans">事务类</param>
        public void RUnLock(int p_StorgeLockID, decimal p_UnLockQty, string p_Remark, bool p_AboveFlag, IDBTransAccess sqlTrans)
        {
            try
            {
                StorgeLock entity = new StorgeLock(sqlTrans);
                entity.ID = p_StorgeLockID;
                entity.SelectByID();

                StorgeLockHisRule rule      = new StorgeLockHisRule();
                StorgeLockHis     entityhis = new StorgeLockHis(sqlTrans);

                //entityhis.StorgeID = p_StorgeLockID;
                //entityhis.LockStorgeID = p_StorgeLockID;
                entityhis.ID   = entity.ID;
                entityhis.WHID = entity.WHID;
                // entityhis.StorgeID = entity.StorgeID;
                entityhis.ItemCode = entity.ItemCode;
                entityhis.ItemName = entity.ItemName;
                entityhis.ItemStd  = entity.ItemStd;
                entityhis.LockOPID = entity.LockOPID;
                //entityhis.LockQty = entity.LockQty;
                entityhis.LockSO      = entity.LockSO;
                entityhis.Batch       = entity.Batch;
                entityhis.VendorBatch = entity.VendorBatch;
                entityhis.ColorName   = entity.ColorName;
                entityhis.ColorNum    = entity.ColorNum;
                entityhis.JarNum      = entity.JarNum;
                entityhis.VendorBatch = entity.VendorBatch;
                entityhis.LockTime    = entity.LockTime;
                entityhis.NeedDate    = entity.NeedDate;
                entityhis.LockDesc    = entity.Remark;
                //entityhis.LockTypeID = (int)LockType.解除锁定;

                //entityhis.LockQty = p_UnLockQty;
                //entityhis.UnLockQty = p_UnLockQty;
                //entityhis.UnlockOPID = ParamConfig.LoginID;
                //entityhis.UnlockTime = DateTime.Now;
                //entityhis.UnlockDesc = p_Remark;
                entityhis.Remark = p_Remark;

                entityhis.LastUpdOP   = ParamConfig.LoginName;
                entityhis.LastUpdTime = DateTime.Now;

                if (p_UnLockQty >= entity.LockQty)//已经全部解锁
                {
                    if (p_AboveFlag && (p_UnLockQty > entity.LockQty))
                    {
                        throw new Exception("解锁数量:" + p_UnLockQty.ToString() + " 大于当前锁定数量:" + entity.LockQty.ToString() + ",解锁失败");
                    }
                    this.RDelete(entity, sqlTrans);
                    StorgeRule rules = new StorgeRule();
                    // rules.UpdateStorge(entity.StorgeID, SysConvert.ToFloat(entity.LockQty), false, sqlTrans);
                }
                else//未全部解锁
                {
                    entity.LockQty     = entity.LockQty - p_UnLockQty;
                    entity.LastUpdOP   = ParamConfig.LoginName;
                    entity.LastUpdTime = DateTime.Now.Date;
                    this.RUpdate(entity, sqlTrans);
                    StorgeRule rules = new StorgeRule();
                    //rules.UpdateStorge(entity.StorgeID, SysConvert.ToFloat(p_UnLockQty), false, sqlTrans);
                }

                rule.RAdd(entityhis, sqlTrans);//新增解锁历史记录
            }
            catch (BaseException)
            {
                throw;
            }
            catch (Exception E)
            {
                throw new BaseException(E.Message);
            }
        }