예제 #1
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="p_Entity">实体类</param>
        /// <returns>操作影响的记录行数</returns>
        public override int Delete(BaseEntity p_Entity)
        {
            try
            {
                IOFormDts MasterEntity = (IOFormDts)p_Entity;
                if (MasterEntity.ID == 0)
                {
                    return(0);
                }

                //删除主表数据
                string Sql = "";
                Sql = "DELETE FROM WH_IOFormDts WHERE " + "ID=" + SysString.ToDBString(MasterEntity.ID);
                //执行
                int AffectedRows = 0;
                if (!this.sqlTransFlag)
                {
                    AffectedRows = this.ExecuteNonQuery(Sql);
                }
                else
                {
                    AffectedRows = sqlTrans.ExecuteNonQuery(Sql);
                }

                return(AffectedRows);
            }
            catch (BaseException E)
            {
                throw new BaseException(E.Message, E);
            }
            catch (Exception E)
            {
                throw new BaseException(FrameWorkMessage.GetAlertMessage((int)Message.CommonDBDelete), E);
            }
        }
예제 #2
0
        /// <summary>
        /// 撤销核销处理
        /// </summary>
        public void RHXCancel(InvoiceOperation entity, int p_DtsID, IDBTransAccess sqlTrans)
        {
            try
            {
                string sql = string.Empty;
                //First 处理发票主表数据
                InvoiceOperation entityinvoice = new InvoiceOperation(sqlTrans);//处理收付款主表数据
                entityinvoice.ID = entity.ID;
                entityinvoice.SelectByID();


                //Second 删除发票核销明细数据
                InvoiceOperationDtsRule dtsRule   = new InvoiceOperationDtsRule();
                InvoiceOperationDts     entityDts = new InvoiceOperationDts(sqlTrans);
                entityDts.ID = p_DtsID;
                entityDts.SelectByID();
                if (entityDts.PayAmount != 0)
                {
                    throw new Exception("不能操作,数据有收付款数据了,不能进行撤销");
                }

                dtsRule.RDelete(entityDts, sqlTrans);//删除明细实体


                //First 处理发票主表数据
                entityinvoice.PreHXFlag    = (int)YesOrNo.No;
                entityinvoice.PreHXQty    -= entityDts.DInvoiceQty;
                entityinvoice.PreHXAmount -= entityDts.DInvoiceAmount;
                this.RUpdate(entityinvoice, sqlTrans);



                IOFormDtsRule ioformdtsRule = new IOFormDtsRule();     //处理出入库单据明细数据
                IOFormDts     entityIOF     = new IOFormDts(sqlTrans); //出入库单据明细
                entityIOF.ID = entityDts.DLOADDtsID;
                entityIOF.SelectByID();
                //处理发票明细数据;出入库明细数据
                if (entityIOF.PayAmount != 0)
                {
                    throw new Exception("不能操作,数据已有收付款数据 ID:" + entityDts.DLOADDtsID + " " + entityIOF.ItemCode + " " + entityIOF.ColorNum);
                }

                sql  = "UPDATE WH_IOFormDts SET InvoiceQty=ISNULL(InvoiceQty,0)-" + "(" + SysString.ToDBString(entityDts.DInvoiceQty) + ")";
                sql += ",InvoiceAmount=ISNULL(InvoiceAmount,0)-" + "(" + SysString.ToDBString(entityDts.DInvoiceAmount) + ")";
                sql += ",DtsInvoiceDelOPID=" + SysString.ToDBString(entity.SaleOPID);
                sql += ",DtsInvoiceDelTime=null";
                sql += ",DtsInvoiceNo=''";
                sql += ",DtsInvoiceDelFlag=0";//开票完成标志
                sql += " WHERE ID=" + SysString.ToDBString(entityDts.DLOADDtsID);
                sqlTrans.ExecuteNonQuery(sql);
            }
            catch (BaseException)
            {
                throw;
            }
            catch (Exception E)
            {
                throw new BaseException(E.Message);
            }
        }
예제 #3
0
        /// <summary>
        /// 修改销售合同站别
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnLoad_Click(object sender, EventArgs e)
        {
            try
            {
                if (m_ID == 0 || m_DtsID == 0)
                {
                    this.ShowMessage("单据有误,请查看");
                    return;
                }
                if (SysConvert.ToString(txtOldSinglePrice.Text.Trim()) == string.Empty)
                {
                    this.ShowMessage("旧单价为空,请检查");
                    return;
                }
                if (SysConvert.ToString(txtNewSinglePrice.Text.Trim()) == string.Empty)
                {
                    this.ShowMessage("新单价为空,请检查");
                    return;
                }
                if (SysConvert.ToString(txtOldSinglePrice.Text.Trim()) == SysConvert.ToString(txtNewSinglePrice.Text.Trim()))
                {
                    this.ShowMessage("新旧单价相同,请检查");
                    return;
                }

                IOForm entity = new IOForm();
                entity.ID = m_ID;
                entity.SelectByID();

                IOFormDts entityDts = new IOFormDts();
                entityDts.ID = m_DtsID;
                entityDts.SelectByID();

                UpdateWHSinglePriceRule rule     = new UpdateWHSinglePriceRule();
                UpdateWHSinglePrice     entityWH = new UpdateWHSinglePrice();
                entityWH.FormNo         = entity.FormNo;
                entityWH.DtsID          = entityDts.ID;
                entityWH.ItemCode       = entityDts.ItemCode;
                entityWH.ColorNum       = entityDts.ColorNum;
                entityWH.ColorName      = entityDts.ColorName;
                entityWH.NewSinglePrice = SysConvert.ToDecimal(txtNewSinglePrice.Text.Trim());
                entityWH.OldSinglePrice = SysConvert.ToDecimal(txtOldSinglePrice.Text.Trim());
                entityWH.UpdateDate     = DateTime.Now;
                entityWH.UpdateOPName   = FParamConfig.LoginName;
                rule.RAdd(entityWH);


                string sql = "UPDATE WH_IOFormDts SET SinglePrice=" + SysString.ToDBString(SysConvert.ToDecimal(txtNewSinglePrice.Text.Trim()));
                sql += ",Amount=ISNULL(DYPrice,0)+ISNULL(Qty,0)*" + SysString.ToDBString(SysConvert.ToDecimal(txtNewSinglePrice.Text.Trim()));
                sql += " WHERE ID=" + SysString.ToDBString(m_DtsID);
                SysUtils.ExecuteNonQuery(sql);
                this.ShowInfoMessage("修改成功");
                this.Close();
            }
            catch (Exception E)
            {
            }
        }
예제 #4
0
        /// <summary>
        /// 获得实体
        /// </summary>
        /// <returns></returns>
        private IOFormDts[] EntityDtsGet()
        {
            int index = GetDataCompleteNum();

            IOFormDts[] entitydts = new IOFormDts[index];
            index = 0;
            for (int i = 0; i < gridView1.RowCount; i++)
            {
                if (CheckDataCompleteDts(i))
                {
                    entitydts[index]        = new IOFormDts();
                    entitydts[index].MainID = HTDataID;
                    entitydts[index].Seq    = i + 1;
                    entitydts[index].SelectByID();

                    entitydts[index].WHTypeID = SysConvert.ToInt32(drpWHTypeID.EditValue);

                    entitydts[index].CompanyTypeID = SysConvert.ToInt32(drpCompanyTypeID.EditValue);//公司类型

                    entitydts[index].WHID        = SysConvert.ToString(drpWHID.EditValue);
                    entitydts[index].SectionID   = SysConvert.ToString(gridView1.GetRowCellValue(i, "SectionID"));
                    entitydts[index].SBitID      = SysConvert.ToString(gridView1.GetRowCellValue(i, "SBitID"));
                    entitydts[index].DtsVendorID = SysConvert.ToString(drpVendorID.EditValue);
                    entitydts[index].ItemCode    = SysConvert.ToString(gridView1.GetRowCellValue(i, "ItemCode"));
                    entitydts[index].ItemName    = SysConvert.ToString(gridView1.GetRowCellValue(i, "ItemName"));
                    entitydts[index].ItemStd     = SysConvert.ToString(gridView1.GetRowCellValue(i, "ItemStd"));
                    entitydts[index].ItemModel   = SysConvert.ToString(gridView1.GetRowCellValue(i, "ItemModel"));
                    entitydts[index].Batch       = SysConvert.ToString(gridView1.GetRowCellValue(i, "Batch"));
                    entitydts[index].VendorBatch = SysConvert.ToString(gridView1.GetRowCellValue(i, "VendorBatch"));
                    entitydts[index].JarNum      = SysConvert.ToString(gridView1.GetRowCellValue(i, "JarNum"));
                    entitydts[index].ColorNum    = SysConvert.ToString(gridView1.GetRowCellValue(i, "ColorNum"));
                    entitydts[index].ColorName   = SysConvert.ToString(gridView1.GetRowCellValue(i, "ColorName"));
                    //entitydts[index].DesignNO = SysConvert.ToString(gridView1.GetRowCellValue(i, "DesignNO"));


                    entitydts[index].YarnStatus = SysConvert.ToString(gridView1.GetRowCellValue(i, "YarnStatus"));
                    //entitydts[index].YarnTypeID = SysConvert.ToInt32(gridView1.GetRowCellValue(i, "YarnTypeID"));
                    entitydts[index].Qty         = SysConvert.ToDecimal(gridView1.GetRowCellValue(i, "Qty"));
                    entitydts[index].Weight      = SysConvert.ToDecimal(gridView1.GetRowCellValue(i, "Weight"));
                    entitydts[index].SinglePrice = SysConvert.ToDecimal(gridView1.GetRowCellValue(i, "SinglePrice"));
                    entitydts[index].Unit        = SysConvert.ToString(gridView1.GetRowCellValue(i, "Unit"));
                    entitydts[index].Amount      = SysConvert.ToDecimal(gridView1.GetRowCellValue(i, "Amount"));
                    entitydts[index].WAmount     = SysConvert.ToDecimal(gridView1.GetRowCellValue(i, "WAmount"));
                    entitydts[index].DtsSO       = SysConvert.ToString(gridView1.GetRowCellValue(i, "DtsSO"));

                    entitydts[index].DtsSaleOPID = SysConvert.ToString(drpDutyOP.EditValue);
                    //entitydts[index].PackNum = SysConvert.ToInt32(gridView1.GetRowCellValue(i, "PackNum"));

                    entitydts[index].Remark = SysConvert.ToString(gridView1.GetRowCellValue(i, "Remark"));



                    index++;
                }
            }
            return(entitydts);
        }
예제 #5
0
        /// <summary>
        /// 获得实体
        /// </summary>
        /// <returns></returns>
        private IOFormDts[] EntityDtsGet()
        {
            int index = GetDataCompleteNum();

            IOFormDts[] entitydts = new IOFormDts[index];
            index = 0;
            for (int i = 0; i < gridView1.RowCount; i++)
            {
                if (CheckDataCompleteDts(i))
                {
                    entitydts[index]    = new IOFormDts();
                    entitydts[index].ID = SysConvert.ToInt32(gridView1.GetRowCellValue(i, "ID"));
                    entitydts[index].SelectByID();
                    entitydts[index].MainID         = HTDataID;
                    entitydts[index].Seq            = i + 1;
                    entitydts[index].WHID           = "001";
                    entitydts[index].SectionID      = SysConvert.ToString(gridView1.GetRowCellValue(i, "SectionID"));
                    entitydts[index].SBitID         = SysConvert.ToString(gridView1.GetRowCellValue(i, "SBitID"));
                    entitydts[index].WHTypeID       = SysConvert.ToInt32(Common.GetWHTypeByWHID("001"));
                    entitydts[index].ItemCode       = SysConvert.ToString(gridView1.GetRowCellValue(i, "ItemCode"));
                    entitydts[index].ItemName       = SysConvert.ToString(gridView1.GetRowCellValue(i, "ItemName"));
                    entitydts[index].ItemStd        = SysConvert.ToString(gridView1.GetRowCellValue(i, "ItemStd"));
                    entitydts[index].ItemModel      = SysConvert.ToString(gridView1.GetRowCellValue(i, "ItemModel"));
                    entitydts[index].Batch          = SysConvert.ToString(gridView1.GetRowCellValue(i, "Batch"));
                    entitydts[index].VendorBatch    = SysConvert.ToString(gridView1.GetRowCellValue(i, "VendorBatch"));
                    entitydts[index].ColorNum       = SysConvert.ToString(gridView1.GetRowCellValue(i, "ColorNum"));
                    entitydts[index].ColorName      = SysConvert.ToString(gridView1.GetRowCellValue(i, "ColorName"));
                    entitydts[index].JarNum         = SysConvert.ToString(gridView1.GetRowCellValue(i, "JarNum"));
                    entitydts[index].StyleNo        = SysConvert.ToString(gridView1.GetRowCellValue(i, "StyleNo"));
                    entitydts[index].Remark         = SysConvert.ToString(gridView1.GetRowCellValue(i, "Remark"));
                    entitydts[index].Qty            = SysConvert.ToDecimal(gridView1.GetRowCellValue(i, "Qty"));
                    entitydts[index].PieceQty       = SysConvert.ToInt32(gridView1.GetRowCellValue(i, "PieceQty"));
                    entitydts[index].Unit           = SysConvert.ToString(gridView1.GetRowCellValue(i, "Unit"));
                    entitydts[index].Weight         = SysConvert.ToDecimal(gridView1.GetRowCellValue(i, "Weight"));
                    entitydts[index].SinglePrice    = SysConvert.ToDecimal(gridView1.GetRowCellValue(i, "SinglePrice"));
                    entitydts[index].Amount         = entitydts[index].SinglePrice * entitydts[index].Qty;
                    entitydts[index].DLCode         = SysConvert.ToString(gridView1.GetRowCellValue(i, "DLCode"));
                    entitydts[index].GoodsCode      = SysConvert.ToString(gridView1.GetRowCellValue(i, "GoodsCode"));
                    entitydts[index].GoodsLevel     = SysConvert.ToString(gridView1.GetRowCellValue(i, "GoodsLevel"));
                    entitydts[index].VColorNum      = SysConvert.ToString(gridView1.GetRowCellValue(i, "VColorNum"));
                    entitydts[index].VColorName     = SysConvert.ToString(gridView1.GetRowCellValue(i, "VColorName"));
                    entitydts[index].VItemCode      = SysConvert.ToString(gridView1.GetRowCellValue(i, "VItemCode"));
                    entitydts[index].MWidth         = SysConvert.ToString(gridView1.GetRowCellValue(i, "MWidth"));
                    entitydts[index].MWeight        = SysConvert.ToString(gridView1.GetRowCellValue(i, "MWeight"));
                    entitydts[index].WeightUnit     = SysConvert.ToString(gridView1.GetRowCellValue(i, "WeightUnit"));
                    entitydts[index].DtsVendorID    = SysConvert.ToString(drpVendorID.EditValue);
                    entitydts[index].DtsSO          = SysConvert.ToString(gridView1.GetRowCellValue(i, "DtsSO"));
                    entitydts[index].DtsOrderFormNo = SysConvert.ToString(gridView1.GetRowCellValue(i, "DtsOrderFormNo"));
                    entitydts[index].DtsSaleOPID    = SysConvert.ToString(drpSaleOPID.EditValue);
                    entitydts[index].MLType         = SysConvert.ToInt32(gridView1.GetRowCellValue(i, "MLType"));
                    index++;
                }
            }
            return(entitydts);
        }
예제 #6
0
        /// <summary>
        /// 获得实体
        /// </summary>
        /// <returns></returns>
        private IOFormDts[] EntityDtsGet()
        {
            int index = GetDataCompleteNum();

            IOFormDts[] entitydts = new IOFormDts[index];
            index = 0;
            for (int i = 0; i < gridView1.RowCount; i++)
            {
                if (CheckDataCompleteDts(i))
                {
                    entitydts[index]    = new IOFormDts();
                    entitydts[index].ID = SysConvert.ToInt32(gridView1.GetRowCellValue(i, "ID"));
                    entitydts[index].SelectByID();
                    entitydts[index].MainID    = HTDataID;
                    entitydts[index].Seq       = i + 1;
                    entitydts[index].WHID      = SysConvert.ToString(gridView1.GetRowCellValue(i, "WHID"));
                    entitydts[index].SectionID = SysConvert.ToString(gridView1.GetRowCellValue(i, "SectionID"));
                    entitydts[index].SBitID    = SysConvert.ToString(gridView1.GetRowCellValue(i, "SBitID"));

                    entitydts[index].ItemCode    = SysConvert.ToString(gridView1.GetRowCellValue(i, "ItemCode"));
                    entitydts[index].ItemName    = SysConvert.ToString(gridView1.GetRowCellValue(i, "ItemName"));
                    entitydts[index].ItemStd     = SysConvert.ToString(gridView1.GetRowCellValue(i, "ItemStd"));
                    entitydts[index].ItemModel   = SysConvert.ToString(gridView1.GetRowCellValue(i, "ItemModel"));
                    entitydts[index].Batch       = SysConvert.ToString(gridView1.GetRowCellValue(i, "Batch"));
                    entitydts[index].VendorBatch = SysConvert.ToString(gridView1.GetRowCellValue(i, "VendorBatch"));
                    entitydts[index].ColorNum    = SysConvert.ToString(gridView1.GetRowCellValue(i, "ColorNum"));
                    entitydts[index].ColorName   = SysConvert.ToString(gridView1.GetRowCellValue(i, "ColorName"));
                    entitydts[index].JarNum      = SysConvert.ToString(gridView1.GetRowCellValue(i, "JarNum"));

                    entitydts[index].Remark      = SysConvert.ToString(gridView1.GetRowCellValue(i, "Remark"));
                    entitydts[index].Qty         = SysConvert.ToDecimal(gridView1.GetRowCellValue(i, "Qty"));
                    entitydts[index].PieceQty    = SysConvert.ToInt32(gridView1.GetRowCellValue(i, "PieceQty"));
                    entitydts[index].Unit        = SysConvert.ToString(gridView1.GetRowCellValue(i, "Unit"));
                    entitydts[index].Weight      = SysConvert.ToDecimal(gridView1.GetRowCellValue(i, "Weight"));
                    entitydts[index].SinglePrice = SysConvert.ToDecimal(gridView1.GetRowCellValue(i, "SinglePrice"));
                    entitydts[index].Amount      = entitydts[index].SinglePrice * entitydts[index].Qty;
                    entitydts[index].YarnType    = SysConvert.ToString(gridView1.GetRowCellValue(i, "YarnType"));
                    entitydts[index].VColorNum   = SysConvert.ToString(gridView1.GetRowCellValue(i, "VColorNum"));
                    entitydts[index].VColorName  = SysConvert.ToString(gridView1.GetRowCellValue(i, "VColorName"));

                    entitydts[index].DtsVendorID    = SysConvert.ToString(drpVendorID.EditValue);//SysConvert.ToString(gridView1.GetRowCellValue(i, "DtsVendorID"));
                    entitydts[index].DtsSO          = SysConvert.ToString(gridView1.GetRowCellValue(i, "DtsSO"));
                    entitydts[index].DtsOrderFormNo = SysConvert.ToString(gridView1.GetRowCellValue(i, "DtsOrderFormNo"));
                    if (entitydts[index].DtsOrderFormNo == string.Empty && index > 0)
                    {
                        entitydts[index].DtsOrderFormNo = entitydts[index - 1].DtsOrderFormNo;
                    }
                    entitydts[index].DtsSaleOPID = SysConvert.ToString(drpSaleOPID.EditValue);                   //SysConvert.ToString(gridView1.GetRowCellValue(i, "DtsSaleOPID"));
                    entitydts[index].PackDts     = SysConvert.ToString(gridView1.GetRowCellValue(i, "PackDts")); //细码
                    entitydts[index].MLType      = SysConvert.ToInt32(gridView1.GetRowCellValue(i, "MLType"));   //区分成品面料和白坯布
                    index++;
                }
            }
            return(entitydts);
        }
예제 #7
0
        private void EntitySet()
        {
            IOFormDts entity = new IOFormDts();

            entity.ID = m_ID;
            entity.SelectByID();

            txtQty.Text        = m_Qty.ToString();
            txtYQQty.Text      = entity.YQQty.ToString();
            txtInvoiceQty.Text = entity.InvoiceQty.ToString();
            txtNOKPQty.Text    = SysConvert.ToString(m_Qty + entity.YQQty - entity.InvoiceQty);
            lbShow.Text        = "产品编号:" + entity.ItemCode + ",商品码:" + entity.GoodsCode + ",颜色:" + entity.ColorNum + " " + entity.ColorName;
        }
예제 #8
0
        /// <summary>
        /// 获得数据库里没有被删除的ID(即数据库里有而且UI里也没有删除的数据)
        /// </summary>
        /// <param name="p_BE"></param>
        /// <returns></returns>
        private string GetIDExist(BaseEntity[] p_BE)
        {
            string outstr = "0";

            for (int i = 0; i < p_BE.Length; i++)
            {
                IOFormDts entitydts = (IOFormDts)p_BE[i];
                if (entitydts.ID != 0)
                {
                    outstr += "," + entitydts.ID;
                }
            }
            return(outstr);
        }
예제 #9
0
 /// <summary>
 /// 拷贝数据到实体内
 /// </summary>
 /// <param name="p_MainDts"></param>
 /// <param name="p_BE"></param>
 public void CopyEntityData(IOFormDts p_MainDts, IOFormDtsPack p_BE, PackBox p_PBEntity)
 {
     p_PBEntity.ColorName     = p_MainDts.ColorName;
     p_PBEntity.ColorNum      = p_MainDts.ColorNum;
     p_PBEntity.CompanyTypeID = p_MainDts.CompanyTypeID;
     p_PBEntity.GoodsCode     = p_MainDts.GoodsCode;
     p_PBEntity.GoodsLevel    = p_MainDts.GoodsLevel;
     p_PBEntity.ItemCode      = p_MainDts.ItemCode;
     p_PBEntity.ItemName      = p_MainDts.ItemName;
     p_PBEntity.ItemStd       = p_MainDts.ItemStd;
     p_PBEntity.JarNum        = p_MainDts.JarNum;
     p_PBEntity.Batch         = p_MainDts.Batch;
     p_PBEntity.VendorBatch   = p_MainDts.VendorBatch;
     p_PBEntity.MWeight       = p_MainDts.MWeight;
     p_PBEntity.MWidth        = p_MainDts.MWidth;
     p_PBEntity.Qty           = p_BE.Qty;
 }
예제 #10
0
 /// <summary>
 /// 删除
 /// </summary>
 /// <param name="p_BE">要删除的实体</param>
 /// <param name="sqlTrans">事务类</param>
 public void RDelete(BaseEntity p_BE, IDBTransAccess sqlTrans)
 {
     try
     {
         this.CheckCorrect(p_BE);
         IOFormDts    entity  = (IOFormDts)p_BE;
         IOFormDtsCtl control = new IOFormDtsCtl(sqlTrans);
         control.Delete(entity);
     }
     catch (BaseException)
     {
         throw;
     }
     catch (Exception E)
     {
         throw new BaseException(E.Message);
     }
 }
예제 #11
0
        /// <summary>
        /// 新增(传入事务处理)
        /// </summary>
        /// <param name="p_BE">要新增的实体</param>
        /// <param name="sqlTrans">事务类</param>
        public void RAdd(BaseEntity p_BE, IDBTransAccess sqlTrans)
        {
            try
            {
                this.CheckCorrect(p_BE);
                IOFormDts    entity  = (IOFormDts)p_BE;
                IOFormDtsCtl control = new IOFormDtsCtl(sqlTrans);

                entity.ID = (int)EntityIDTable.GetID((long)SysEntity.WH_IOFormDts, sqlTrans);
                control.AddNew(entity);
            }
            catch (BaseException)
            {
                throw;
            }
            catch (Exception E)
            {
                throw new BaseException(E.Message);
            }
        }
예제 #12
0
        /// <summary>
        /// 窗体加载
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void frmWait_Load(object sender, EventArgs e)
        {
            try
            {
                IOForm entity = new IOForm();
                entity.ID = m_ID;
                entity.SelectByID();

                IOFormDts entityDts = new IOFormDts();
                entityDts.ID = m_DtsID;
                entityDts.SelectByID();

                lbShow.Text            = "出入库单号:" + entity.FormNo + ",产品编码:" + entityDts.ItemCode + ",颜色:" + entityDts.ColorNum + " " + entityDts.ColorName;
                txtOldSinglePrice.Text = entityDts.SinglePrice.ToString();
                txtNewSinglePrice.Text = entityDts.SinglePrice.ToString();
            }
            catch (Exception E)
            {
            }
        }
예제 #13
0
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="p_BE">要修改的实体</param>
        /// <param name="sqlTrans">事务类</param>
        public void RUpdateOther(IOFormDts p_MainDts, BaseEntity p_BE, IDBTransAccess sqlTrans)
        {
            try
            {
                this.CheckCorrect(p_BE);
                IOFormDtsPack entity = (IOFormDtsPack)p_BE;

                RSaveOtherCheck(p_MainDts, p_BE, sqlTrans);

                this.RUpdate(p_BE, sqlTrans);
            }
            catch (BaseException)
            {
                throw;
            }
            catch (Exception E)
            {
                throw new BaseException(E.Message);
            }
        }
예제 #14
0
        /// <summary>
        /// 保存其它单据时检查匹配性
        /// </summary>
        public void RSaveOtherCheck(IOFormDts p_MainDts, BaseEntity p_BE, IDBTransAccess sqlTrans)
        {
            this.CheckCorrect(p_BE);
            IOFormDtsPack entity = (IOFormDtsPack)p_BE;

            if (entity.BoxNo == string.Empty)
            {
                throw new Exception("异常,没有读取到码单箱号");
            }
            PackBoxRule pbrule   = new PackBoxRule();
            PackBox     pbentity = pbrule.RGetEntityByBoxNo(entity.BoxNo, sqlTrans);

            if (pbentity.BoxStatusID != (int)EnumBoxStatus.入库)
            {
                throw new Exception("异常,码单箱号" + entity.BoxNo + "当前未处于入库状态,不允许操作");
            }
            if (pbentity.ItemCode != p_MainDts.ItemCode || pbentity.ColorNum != p_MainDts.ColorNum ||
                pbentity.ColorName != p_MainDts.ColorName)//|| pbentity.GoodsLevel != p_MainDts.GoodsLevel 先不管等级
            {
                throw new Exception("异常,码单箱号" + entity.BoxNo + "和单据明细属性不匹配");
            }
        }
예제 #15
0
        /// <summary>
        /// 新增(传入事务处理)
        /// </summary>
        /// <param name="p_BE">要新增的实体</param>
        /// <param name="sqlTrans">事务类</param>
        public void RAdd(IOForm p_MainEntity, IOFormDts p_MainDts, BaseEntity p_BE, IDBTransAccess sqlTrans)
        {
            try
            {
                this.CheckCorrect(p_BE);
                IOFormDtsPack entity = (IOFormDtsPack)p_BE;

                PackBox pbentity = new PackBox(sqlTrans);
                pbentity.SourceTypeID = (int)PackBoxSourceType.入库单;
                pbentity.BoxStatusID  = (int)EnumBoxStatus.未入库;
                CopyEntityData(p_MainDts, entity, pbentity);
                //if (entity.BoxNo != string.Empty && p_MainEntity.Remark == "EIN")//仅仅在导数据时使用到
                if (entity.BoxNo != string.Empty)//仅仅在导数据时使用到
                {
                    pbentity.CreateTime = p_MainEntity.FormDate;
                    pbentity.BoxNo      = entity.BoxNo;
                }
                pbentity.DID    = p_MainDts.ID;
                pbentity.SubSeq = entity.SubSeq;
                PackBoxRule pbrule = new PackBoxRule();
                pbrule.RAdd(pbentity, sqlTrans);



                entity.DID   = p_MainDts.ID; //20141009 zhoufc
                entity.BoxNo = pbentity.BoxNo;
                this.RAdd(entity, sqlTrans); //后插入的原因是箱号是在插入箱号实体时生成的
            }
            catch (BaseException)
            {
                throw;
            }
            catch (Exception E)
            {
                throw new BaseException(E.Message);
            }
        }
예제 #16
0
        /// <summary>
        /// 保存(传入事务处理)
        /// </summary>
        /// <param name="p_Entity"></param>
        /// <param name="p_BE"></param>
        /// <param name="sqlTrans"></param>
        public void RSave(IOForm p_Entity, BaseEntity[] p_BE, IDBTransAccess sqlTrans)
        {
            try
            {
                string sql = string.Empty;

                sql = "";//删除码单明细表,代码待补充;如果是入库要删除原始码单表,需要仔细研究,因为某些情况下(先验布)原始码单还是需要保存的

                sql  = "DELETE FROM WH_IOFormDts WHERE MainID=" + p_Entity.ID.ToString();
                sql += " AND ID NOT IN" + string.Format("({0})", GetIDExist(p_BE));
                sqlTrans.ExecuteNonQuery(sql);//删除原单据里应该删除的明细数据,即数据库里有但是UI里已经删除的数据


                for (int i = 0; i < p_BE.Length; i++)
                {
                    IOFormDts entitydts = (IOFormDts)p_BE[i];
                    if (entitydts.ID != 0)//ID不为0说明数据库中已经存在
                    {
                        this.RUpdate(entitydts, sqlTrans);
                    }
                    else
                    {
                        entitydts.MainID = p_Entity.ID;
                        this.RAdd(entitydts, sqlTrans);
                    }
                }
            }
            catch (BaseException)
            {
                throw;
            }
            catch (Exception E)
            {
                throw new BaseException(E.Message);
            }
        }
예제 #17
0
 /// <summary>
 /// 获得单据明细类数组
 /// </summary>
 /// <param name="p_IOFormID">单据ID</param>
 /// <param name="sqlTrans">事务类</param>
 private IOFormDts[] RGetFormDts(int p_IOFormID, IDBTransAccess sqlTrans)
 {
     try
     {
         string      sql    = "SELECT ID FROM WH_IOFormDts WHERE MainID=" + p_IOFormID.ToString();
         DataTable   dt     = sqlTrans.Fill(sql);
         IOFormDts[] entity = new IOFormDts[dt.Rows.Count];
         for (int i = 0; i < dt.Rows.Count; i++)
         {
             entity[i]    = new IOFormDts(sqlTrans);
             entity[i].ID = SysConvert.ToInt32(dt.Rows[i][0].ToString());
             entity[i].SelectByID();
         }
         return(entity);
     }
     catch (BaseException)
     {
         throw;
     }
     catch (Exception E)
     {
         throw new BaseException(E.Message);
     }
 }
예제 #18
0
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="p_BE">要修改的实体</param>
        /// <param name="sqlTrans">事务类</param>
        public void RUpdate(IOFormDts p_MainDts, BaseEntity p_BE, IDBTransAccess sqlTrans)
        {
            try
            {
                this.CheckCorrect(p_BE);
                IOFormDtsPack entity = (IOFormDtsPack)p_BE;
                this.RUpdate(p_BE, sqlTrans);

                PackBoxRule pbrule   = new PackBoxRule();
                PackBox     pbentity = pbrule.RGetEntityByBoxNo(entity.BoxNo, sqlTrans); //获得箱单实体

                CopyEntityData(p_MainDts, entity, pbentity);                             //拷贝数据

                pbrule.RUpdate(pbentity, sqlTrans);                                      //更新
            }
            catch (BaseException)
            {
                throw;
            }
            catch (Exception E)
            {
                throw new BaseException(E.Message);
            }
        }
예제 #19
0
        /// <summary>
        /// 保存(传入事务处理)
        /// </summary>
        /// <param name="p_BE">要新增的实体</param>
        /// <param name="sqlTrans">事务类</param>
        public void RSave(int p_ID, int p_MainID, int p_Seq, BaseEntity[] p_BE, bool p_UpdateFlag, IDBTransAccess sqlTrans)
        {
            try
            {
                string sql = "";
                if (p_UpdateFlag)                //修改状态下首先清除被删除的码单明细
                {
                    string idStr = string.Empty; //ID字符串
                    idStr = "0";
                    for (int i = 0; i < p_BE.Length; i++)
                    {
                        IOFormDtsPack entity = (IOFormDtsPack)p_BE[i];
                        if (entity.ID != 0)//有ID
                        {
                            if (idStr != string.Empty)
                            {
                                idStr += ",";
                            }
                            idStr += entity.ID.ToString();
                        }
                    }

                    if (idStr != string.Empty)
                    {
                        sql = "DELETE FROM WH_PackBox WHERE BoxNo IN (SELECT BoxNo FROM WH_IOFormDtsPack WHERE DID=" + SysString.ToDBString(p_ID) + " AND ID NOT IN(" + idStr + ") )";
                        sqlTrans.ExecuteNonQuery(sql);                                                                                  //执行条形码删除

                        sql = "DELETE FROM WH_IOFormDtsPack WHERE DID=" + SysString.ToDBString(p_ID) + " AND ID NOT IN(" + idStr + ")"; //WH_IOFormDtsPack WH_PackBox
                        sqlTrans.ExecuteNonQuery(sql);
                    }
                }
                else//新增状态
                {
                    sql = "SELECT TOP 1 ID FROM WH_IOFormDtsPack WHERE DID=" + SysString.ToDBString(p_ID);
                    DataTable dt = sqlTrans.Fill(sql);
                    if (dt.Rows.Count > 0)
                    {
                        throw new BaseException("不能重复保存!");
                    }
                }


                IOForm p_Main = new IOForm(sqlTrans);
                p_Main.ID = p_MainID;
                p_Main.SelectByID();

                IOFormDts p_MainDts = new IOFormDts(sqlTrans);
                p_MainDts.ID = p_ID;
                p_MainDts.SelectByID();



                IOFormDtsPackRule rule     = new IOFormDtsPackRule();
                PackBoxRule       Brule    = new PackBoxRule();
                decimal           Qty      = 0;
                decimal           PieceQty = 0;
                for (int i = 0; i < p_BE.Length; i++)
                {
                    FormNoControlRule frule  = new FormNoControlRule();
                    IOFormDtsPack     entity = (IOFormDtsPack)p_BE[i];
                    int boxNoCreateTypeID    = 0;//箱号条码来源
                    if (entity.ID == 0)
                    {
                        if (entity.BoxNo == string.Empty)//没有箱号条码
                        {
                            entity.BoxNo = frule.RGetFormNo((int)FormNoControlEnum.码单箱号, sqlTrans);
                            rule.RAdd(entity, sqlTrans);
                            frule.RAddSort((int)FormNoControlEnum.码单箱号, sqlTrans);
                        }
                        else//有箱号条码说明是验布产生的条码
                        {
                            boxNoCreateTypeID = 1;//验布来源
                        }
                    }
                    else
                    {
                        rule.RUpdate(entity, sqlTrans);
                    }


                    PackBox entityBox = new PackBox();
                    if (entity.ID != 0)//仓库明细已生成,则寻找箱号ID 此处判断其实无意义,经过上面的代码肯定有ID值了
                    {
                        sql = "SELECT ID FROM WH_PackBox WHERE BoxNo=" + SysString.ToDBString(entity.BoxNo);
                        DataTable dtPackBox = sqlTrans.Fill(sql);
                        if (dtPackBox.Rows.Count != 0)//如果找到条码
                        {
                            entityBox.ID = SysConvert.ToInt32(dtPackBox.Rows[0]["ID"]);
                        }
                        else//如果未找到条码
                        {
                            entityBox.CreateSourceID = boxNoCreateTypeID;////原始条码表加个字段表示来源 0:表示入库录入
                        }
                    }
                    entityBox.BoxNo         = entity.BoxNo;
                    entityBox.WHID          = p_MainDts.WHID;
                    entityBox.SectionID     = p_MainDts.SectionID;
                    entityBox.SBitID        = p_MainDts.SBitID;
                    entityBox.ColorName     = p_MainDts.ColorName;
                    entityBox.ColorNum      = p_MainDts.ColorNum;
                    entityBox.CompanyTypeID = p_MainDts.CompanyTypeID;
                    entityBox.GoodsCode     = p_MainDts.GoodsCode;
                    entityBox.GoodsLevel    = p_MainDts.GoodsLevel;
                    entityBox.ItemCode      = p_MainDts.ItemCode;
                    entityBox.ItemName      = p_MainDts.ItemName;
                    entityBox.ItemStd       = p_MainDts.ItemStd;
                    entityBox.JarNum        = p_MainDts.JarNum;
                    entityBox.Batch         = p_MainDts.Batch;
                    entityBox.VendorBatch   = p_MainDts.VendorBatch;
                    entityBox.MWeight       = p_MainDts.MWeight;
                    entityBox.MWidth        = p_MainDts.MWidth;
                    entityBox.Qty           = entity.Qty;
                    entityBox.Unit          = p_MainDts.Unit;
                    entityBox.BoxStatusID   = (int)EnumBoxStatus.未入库;
                    entityBox.DID           = p_ID;
                    entityBox.InFormNo      = p_Main.FormNo;
                    entityBox.OrderFormNo   = p_MainDts.DtsOrderFormNo;//合同号明细


                    if (entityBox.ID == 0)//没有ID则新增
                    {
                        Brule.RAdd(entityBox, sqlTrans);
                    }
                    else//有ID则修改
                    {
                        Brule.RUpdate(entityBox, sqlTrans);
                    }

                    Qty += entity.Qty;
                    PieceQty++;
                }

                //if (PieceQty == 0)
                //{
                //    throw new BaseException("请填写细码后点击保存");
                //}

                sql  = "UPDATE WH_IOFormDts SET Qty=" + SysString.ToDBString(Qty);
                sql += ",PieceQty=" + SysString.ToDBString(PieceQty);
                sql += ",PackFlag=1 ";
                sql += " WHERE ID=" + SysString.ToDBString(p_ID);
                sqlTrans.ExecuteNonQuery(sql);
            }
            catch (BaseException)
            {
                throw;
            }
            catch (Exception E)
            {
                throw new BaseException(E.Message);
            }
        }
예제 #20
0
        /// <summary>
        /// 新增(传入事务处理)
        /// </summary>
        /// <param name="p_BE">要新增的实体</param>
        /// <param name="sqlTrans">事务类</param>
        public void RAdd(int p_ID, string p_IDStr, IDBTransAccess sqlTrans)
        {
            try
            {
                string sql = "SELECT WHID,SectionID,SBitID,JarNum,Batch FROM WH_PackBox WHERE ID IN (" + p_IDStr + ")";
                sql += " GROUP BY WHID,SectionID,SBitID,JarNum,Batch";
                DataTable     dt     = sqlTrans.Fill(sql);
                int           MaxSeq = GetMaxSeq(p_ID);
                decimal       Qty    = 0;
                IOFormDtsRule rule   = new IOFormDtsRule();

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    if (i == 0)//第一行更新
                    {
                        sql  = "SELECT * FROM WH_PackBox WHERE ID IN (" + p_IDStr + ")";
                        sql += " AND WHID=" + SysString.ToDBString(SysConvert.ToString(dt.Rows[i]["WHID"]));
                        sql += " AND SectionID=" + SysString.ToDBString(SysConvert.ToString(dt.Rows[i]["SectionID"]));
                        sql += " AND SBitID=" + SysString.ToDBString(SysConvert.ToString(dt.Rows[i]["SBitID"]));
                        sql += " AND JarNum=" + SysString.ToDBString(SysConvert.ToString(dt.Rows[i]["JarNum"]));
                        sql += " AND Batch=" + SysString.ToDBString(SysConvert.ToString(dt.Rows[i]["Batch"]));
                        DataTable dtsql = sqlTrans.Fill(sql);

                        IOFormDts entitydts = new IOFormDts(sqlTrans);
                        entitydts.ID = p_ID;
                        entitydts.SelectByID();
                        entitydts.WHID      = SysConvert.ToString(dt.Rows[i]["WHID"]);
                        entitydts.SectionID = SysConvert.ToString(dt.Rows[i]["SectionID"]);
                        entitydts.SBitID    = SysConvert.ToString(dt.Rows[i]["SBitID"]);
                        entitydts.JarNum    = SysConvert.ToString(dt.Rows[i]["JarNum"]);
                        entitydts.Batch     = SysConvert.ToString(dt.Rows[i]["Batch"]);
                        entitydts.Qty       = SysConvert.ToDecimal(SysConvert.ToDecimal(dtsql.Compute("SUM(Qty)", "")), 2);
                        entitydts.Weight    = SysConvert.ToDecimal(SysConvert.ToDecimal(dtsql.Compute("SUM(Weight)", "")), 2);
                        entitydts.Yard      = SysConvert.ToDecimal(SysConvert.ToDecimal(dtsql.Compute("SUM(Yard)", "")), 2);
                        entitydts.PieceQty  = dtsql.Rows.Count;
                        entitydts.PackFlag  = 1;
                        if (entitydts.Unit == "RMB/KG" || entitydts.Unit == "USD/KG")
                        {
                            entitydts.Amount = entitydts.Weight * entitydts.SinglePrice;
                        }
                        if (entitydts.Unit == "RMB/M" || entitydts.Unit == "USD/M")
                        {
                            entitydts.Amount = entitydts.Qty * entitydts.SinglePrice;
                        }
                        if (entitydts.Unit == "RMB/Y" || entitydts.Unit == "USD/Y")
                        {
                            entitydts.Amount = entitydts.Yard * entitydts.SinglePrice;
                        }
                        rule.RUpdate(entitydts, sqlTrans);

                        IOFormDtsPackRule prule = new IOFormDtsPackRule();
                        sql  = "DELETE WH_IOFormDtsPack WHERE MainID=" + SysString.ToDBString(entitydts.MainID);
                        sql += " AND Seq=" + SysString.ToDBString(entitydts.Seq);
                        sqlTrans.ExecuteNonQuery(sql);
                        for (int j = 0; j < dtsql.Rows.Count; j++)
                        {
                            IOFormDtsPack pentity = new IOFormDtsPack(sqlTrans);
                            pentity.MainID     = entitydts.MainID;
                            pentity.Seq        = entitydts.Seq;
                            pentity.SubSeq     = SysConvert.ToInt32(dtsql.Rows[j]["SubSeq"]); //zhoufc 2014.10.17 SubSeq表示卷号
                            pentity.GoodsLevel = SysConvert.ToString(dtsql.Rows[j]["GoodsLevel"]);
                            pentity.BoxNo      = SysConvert.ToString(dtsql.Rows[j]["BoxNo"]);
                            pentity.Weight     = SysConvert.ToDecimal(dtsql.Rows[j]["Weight"]);
                            pentity.Qty        = SysConvert.ToDecimal(dtsql.Rows[j]["Qty"]);
                            pentity.Yard       = SysConvert.ToDecimal(dtsql.Rows[j]["Yard"]);
                            pentity.DID        = entitydts.ID;
                            prule.RAdd(pentity, sqlTrans);
                        }
                    }
                    else
                    {
                        sql  = "SELECT * FROM WH_PackBox WHERE ID IN (" + p_IDStr + ")";
                        sql += " AND WHID=" + SysString.ToDBString(SysConvert.ToString(dt.Rows[i]["WHID"]));
                        sql += " AND SectionID=" + SysString.ToDBString(SysConvert.ToString(dt.Rows[i]["SectionID"]));
                        sql += " AND SBitID=" + SysString.ToDBString(SysConvert.ToString(dt.Rows[i]["SBitID"]));
                        sql += " AND JarNum=" + SysString.ToDBString(SysConvert.ToString(dt.Rows[i]["JarNum"]));
                        sql += " AND Batch=" + SysString.ToDBString(SysConvert.ToString(dt.Rows[i]["Batch"]));
                        DataTable dtsql = sqlTrans.Fill(sql);

                        IOFormDts entitydts = new IOFormDts(sqlTrans);
                        entitydts.ID = p_ID;
                        entitydts.SelectByID();
                        entitydts.Seq       = MaxSeq + i;
                        entitydts.WHID      = SysConvert.ToString(dt.Rows[i]["WHID"]);
                        entitydts.SectionID = SysConvert.ToString(dt.Rows[i]["SectionID"]);
                        entitydts.SBitID    = SysConvert.ToString(dt.Rows[i]["SBitID"]);
                        entitydts.JarNum    = SysConvert.ToString(dt.Rows[i]["JarNum"]);
                        entitydts.Batch     = SysConvert.ToString(dt.Rows[i]["Batch"]);
                        entitydts.Qty       = SysConvert.ToDecimal(SysConvert.ToDecimal(dtsql.Compute("SUM(Qty)", "")));
                        entitydts.Weight    = SysConvert.ToDecimal(SysConvert.ToDecimal(dtsql.Compute("SUM(Weight)", "")), 2);
                        entitydts.Yard      = SysConvert.ToDecimal(SysConvert.ToDecimal(dtsql.Compute("SUM(Yard)", "")), 2);
                        entitydts.PieceQty  = dtsql.Rows.Count;
                        entitydts.PackFlag  = 1;
                        if (entitydts.Unit == "RMB/KG" || entitydts.Unit == "USD/KG")
                        {
                            entitydts.Amount = entitydts.Weight * entitydts.SinglePrice;
                        }
                        if (entitydts.Unit == "RMB/M" || entitydts.Unit == "USD/M")
                        {
                            entitydts.Amount = entitydts.Qty * entitydts.SinglePrice;
                        }
                        if (entitydts.Unit == "RMB/Y" || entitydts.Unit == "USD/Y")
                        {
                            entitydts.Amount = entitydts.Yard * entitydts.SinglePrice;
                        }
                        sql  = "SELECT ID FROM WH_IOFormDts WHERE MainID=" + SysString.ToDBString(entitydts.MainID);
                        sql += " AND Seq=" + SysString.ToDBString(entitydts.Seq);
                        if (sqlTrans.Fill(sql).Rows.Count > 0)
                        {
                            throw new BaseException("不能增行,该行已存在");
                        }
                        rule.RAdd(entitydts, sqlTrans);
                        IOFormDtsPackRule prule = new IOFormDtsPackRule();
                        sql  = "DELETE WH_IOFormDtsPack WHERE MainID=" + SysString.ToDBString(entitydts.MainID);
                        sql += " AND Seq=" + SysString.ToDBString(entitydts.Seq);
                        sqlTrans.ExecuteNonQuery(sql);
                        for (int j = 0; j < dtsql.Rows.Count; j++)
                        {
                            IOFormDtsPack pentity = new IOFormDtsPack(sqlTrans);
                            pentity.MainID     = entitydts.MainID;
                            pentity.Seq        = entitydts.Seq;
                            pentity.SubSeq     = SysConvert.ToInt32(dtsql.Rows[j]["SubSeq"]); //zhoufc 2014.10.17 SubSeq表示卷号
                            pentity.GoodsLevel = SysConvert.ToString(dtsql.Rows[j]["GoodsLevel"]);
                            pentity.BoxNo      = SysConvert.ToString(dtsql.Rows[j]["BoxNo"]);
                            pentity.Weight     = SysConvert.ToDecimal(dtsql.Rows[j]["Weight"]);
                            pentity.Qty        = SysConvert.ToDecimal(dtsql.Rows[j]["Qty"]);
                            pentity.Yard       = SysConvert.ToDecimal(dtsql.Rows[j]["Yard"]);
                            pentity.DID        = entitydts.ID;
                            prule.RAdd(pentity, sqlTrans);
                        }
                    }
                }
            }
            catch (BaseException)
            {
                throw;
            }
            catch (Exception E)
            {
                throw new BaseException(E.Message);
            }
        }
예제 #21
0
 /// <summary>
 /// 检查将要操作的数据是否符合业务规则
 /// </summary>
 /// <param name="p_BE"></param>
 private void CheckCorrect(BaseEntity p_BE)
 {
     IOFormDts entity = (IOFormDts)p_BE;
 }
예제 #22
0
        /// <summary>
        /// 新增(传入事务处理)
        /// </summary>
        /// <param name="p_BE">要新增的实体</param>
        /// <param name="sqlTrans">事务类</param>
        public void RAdd(int p_ID, string p_IDStr, IDBTransAccess sqlTrans)
        {
            try
            {
                string sql = "SELECT SectionID,JarNum,Batch FROM WH_PackBox WHERE ID IN (" + p_IDStr + ")";
                sql += " GROUP BY SectionID,JarNum,Batch";
                DataTable     dt     = sqlTrans.Fill(sql);
                int           MaxSeq = GetMaxSeq(p_ID);
                decimal       Qty    = 0;
                IOFormDtsRule rule   = new IOFormDtsRule();

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    if (i == 0)//第一行更新
                    {
                        sql  = "SELECT * FROM WH_PackBox WHERE ID IN (" + p_IDStr + ")";
                        sql += " AND SectionID=" + SysString.ToDBString(SysConvert.ToString(dt.Rows[i]["SectionID"]));
                        sql += " AND JarNum=" + SysString.ToDBString(SysConvert.ToString(dt.Rows[i]["JarNum"]));
                        sql += " AND Batch=" + SysString.ToDBString(SysConvert.ToString(dt.Rows[i]["Batch"]));
                        DataTable dtsql = sqlTrans.Fill(sql);

                        IOFormDts entitydts = new IOFormDts(sqlTrans);
                        entitydts.ID = p_ID;
                        entitydts.SelectByID();
                        entitydts.SectionID = SysConvert.ToString(dt.Rows[i]["SectionID"]);
                        entitydts.JarNum    = SysConvert.ToString(dt.Rows[i]["JarNum"]);
                        entitydts.Batch     = SysConvert.ToString(dt.Rows[i]["Batch"]);
                        entitydts.Qty       = SysConvert.ToDecimal(dtsql.Compute("SUM(Qty)", ""));
                        entitydts.PieceQty  = dtsql.Rows.Count;
                        entitydts.PackFlag  = 1;
                        entitydts.Amount    = entitydts.Qty * entitydts.SinglePrice;

                        rule.RUpdate(entitydts, sqlTrans);

                        IOFormDtsPackRule prule = new IOFormDtsPackRule();
                        sql  = "DELETE WH_IOFormDtsPack WHERE MainID=" + SysString.ToDBString(entitydts.MainID);
                        sql += " AND Seq=" + SysString.ToDBString(entitydts.Seq);
                        sqlTrans.ExecuteNonQuery(sql);
                        for (int j = 0; j < dtsql.Rows.Count; j++)
                        {
                            IOFormDtsPack pentity = new IOFormDtsPack(sqlTrans);
                            pentity.MainID = entitydts.MainID;
                            pentity.Seq    = entitydts.Seq;
                            pentity.SubSeq = j + 1;
                            pentity.BoxNo  = SysConvert.ToString(dtsql.Rows[j]["BoxNo"]);
                            pentity.Qty    = SysConvert.ToDecimal(dtsql.Rows[j]["Qty"]);
                            pentity.DID    = entitydts.ID;
                            prule.RAdd(pentity, sqlTrans);
                        }
                    }
                    else
                    {
                        sql  = "SELECT * FROM WH_PackBox WHERE ID IN (" + p_IDStr + ")";
                        sql += " AND SectionID=" + SysString.ToDBString(SysConvert.ToString(dt.Rows[i]["SectionID"]));
                        sql += " AND JarNum=" + SysString.ToDBString(SysConvert.ToString(dt.Rows[i]["JarNum"]));
                        sql += " AND Batch=" + SysString.ToDBString(SysConvert.ToString(dt.Rows[i]["Batch"]));
                        DataTable dtsql = sqlTrans.Fill(sql);

                        IOFormDts entitydts = new IOFormDts(sqlTrans);
                        entitydts.ID = p_ID;
                        entitydts.SelectByID();
                        entitydts.Seq       = MaxSeq + i;
                        entitydts.SectionID = SysConvert.ToString(dt.Rows[i]["SectionID"]);
                        entitydts.JarNum    = SysConvert.ToString(dt.Rows[i]["JarNum"]);
                        entitydts.Batch     = SysConvert.ToString(dt.Rows[i]["Batch"]);
                        entitydts.Qty       = SysConvert.ToDecimal(dtsql.Compute("SUM(Qty)", ""));
                        entitydts.PieceQty  = dtsql.Rows.Count;
                        entitydts.PackFlag  = 1;
                        entitydts.Amount    = entitydts.Qty * entitydts.SinglePrice;

                        sql  = "SELECT ID FROM WH_IOFormDts WHERE MainID=" + SysString.ToDBString(entitydts.MainID);
                        sql += " AND Seq=" + SysString.ToDBString(entitydts.Seq);
                        if (sqlTrans.Fill(sql).Rows.Count > 0)
                        {
                            throw new BaseException("不能增行,该行已存在");
                        }
                        rule.RAdd(entitydts, sqlTrans);

                        IOFormDtsPackRule prule = new IOFormDtsPackRule();
                        sql  = "DELETE WH_IOFormDtsPack WHERE MainID=" + SysString.ToDBString(entitydts.MainID);
                        sql += " AND Seq=" + SysString.ToDBString(entitydts.Seq);
                        sqlTrans.ExecuteNonQuery(sql);
                        for (int j = 0; j < dtsql.Rows.Count; j++)
                        {
                            IOFormDtsPack pentity = new IOFormDtsPack(sqlTrans);
                            pentity.MainID = entitydts.MainID;
                            pentity.Seq    = entitydts.Seq;
                            pentity.SubSeq = j + 1;
                            pentity.BoxNo  = SysConvert.ToString(dtsql.Rows[j]["BoxNo"]);
                            pentity.Qty    = SysConvert.ToDecimal(dtsql.Rows[j]["Qty"]);
                            pentity.DID    = entitydts.ID;
                            prule.RAdd(pentity, sqlTrans);
                        }
                    }
                }
            }
            catch (BaseException)
            {
                throw;
            }
            catch (Exception E)
            {
                throw new BaseException(E.Message);
            }
        }
예제 #23
0
        /// <summary>
        /// 新增(传入事务处理)
        /// </summary>
        /// <param name="p_BE">要新增的实体</param>
        /// <param name="sqlTrans">事务类</param>
        public void RSubmitInWH(List <BProductCheckDts> p_BE, string WHID, string SectionID, IDBTransAccess sqlTrans)
        {
            try
            {
                string CheckItem = GetListID(p_BE);
                //1检验是否入库
                string    sql = "SELECT StatusID,ID FROM WO_BProductCheckDts WHERE StatusID>" + (int)EnumBoxStatus.未入库 + " AND ID IN (" + CheckItem + ")";
                DataTable dt  = sqlTrans.Fill(sql);
                if (dt.Rows.Count != 0)
                {
                    BProductCheckDts entity = new BProductCheckDts(sqlTrans);
                    entity.ID = SysConvert.ToInt32(dt.Rows[0]["ID"]);
                    entity.SelectByID();
                    throw new Exception("条码" + entity.DISN + " 已经入库请检查");
                }

                //2校验通过,开始创建入库单。
                sql  = "SELECT ItemCode,ItemName,ItemStd,ItemModel,ColorNum,ColorName,JarNum,MF,KZ,ShopID,VendorID,SUM(Qty) Qty,SUM(YQty) Weight,DLever,CompactNo,SaleOPID,JSUnit FROM UV1_WO_BProductCheckDts WHERE DID IN(" + CheckItem + ")";
                sql += " GROUP BY ItemCode,ItemName,ItemStd,ItemModel,ColorNum,ColorName,JarNum,MF,KZ,ShopID,VendorID,DLever,CompactNo,SaleOPID,JSUnit";
                dt   = sqlTrans.Fill(sql);

                sql = "SELECT DISTINCT ShopID FROM UV1_WO_BProductCheckDts WHERE DID IN(" + CheckItem + ")";
                DataTable dtshop = sqlTrans.Fill(sql);//本次勾选的是那几家染厂的数据


                sql = "SELECT * FROM UV1_WO_BProductCheckDts WHERE DID IN(" + CheckItem + ")";

                DataTable dtall = sqlTrans.Fill(sql);

                foreach (DataRow drshop in dtshop.Rows)//一家染厂一个入库单
                {
                    IOForm IOentity = new IOForm(sqlTrans);

                    IOentity.FormDate = DateTime.Now.Date;

                    IOentity.WHID     = WHID;
                    IOentity.WHType   = WHID;
                    IOentity.HeadType = 11;
                    IOentity.SubType  = 1107;

                    IOentity.VendorID = drshop["ShopID"].ToString();

                    FormNoControlRule ruleno = new FormNoControlRule();
                    IOentity.FormNo = ruleno.RGetWHFormNo(IOentity.HeadType, IOentity.SubType, IOentity.WHID, sqlTrans);
                    IOentity.Remark = "检验后入库";

                    DataRow[]   Shopinwh  = dt.Select("ShopID=" + SysString.ToDBString(drshop["ShopID"].ToString()));//一家染厂多个缸号或品种
                    IOFormDts[] entitydts = new IOFormDts[Shopinwh.Length];
                    ArrayList   List      = new ArrayList();
                    int         i         = 0;
                    foreach (DataRow drinwh in Shopinwh)//一家染厂多个缸号或品种
                    {
                        entitydts[i]           = new IOFormDts(sqlTrans);
                        entitydts[i].Seq       = i + 1;
                        entitydts[i].WHID      = IOentity.WHID;
                        entitydts[i].SectionID = SectionID;
                        entitydts[i].SBitID    = "";

                        entitydts[i].ItemCode = drinwh["ItemCode"].ToString();
                        //entitydts[i].CPItemCode = entitydts[i].ItemCode;
                        entitydts[i].ItemName  = drinwh["ItemName"].ToString();
                        entitydts[i].ItemModel = drinwh["ItemName"].ToString();
                        entitydts[i].ItemStd   = drinwh["ItemStd"].ToString();
                        entitydts[i].ItemModel = drinwh["ItemModel"].ToString();
                        entitydts[i].ColorNum  = drinwh["ColorNum"].ToString();
                        entitydts[i].ColorName = drinwh["ColorName"].ToString();
                        entitydts[i].JarNum    = drinwh["JarNum"].ToString();

                        entitydts[i].MWeight = SysConvert.ToDecimal(drinwh["KZ"]);
                        entitydts[i].MWidth  = SysConvert.ToDecimal(drinwh["MF"]);

                        entitydts[i].DtsSO          = drinwh["CompactNo"].ToString();
                        entitydts[i].DtsOrderFormNo = drinwh["CompactNo"].ToString();
                        //entitydts[i].DtsOrderFormNo = drinwh["SO"].ToString();
                        //entitydts[i].InSO = drinwh["SO"].ToString();
                        entitydts[i].InSaleOPID  = drinwh["SaleOPID"].ToString();
                        entitydts[i].DtsVendorID = drinwh["VendorID"].ToString();
                        entitydts[i].GoodsLevel  = drinwh["DLever"].ToString();
                        entitydts[i].Qty         = SysConvert.ToDecimal(drinwh["Qty"]);
                        entitydts[i].Weight      = SysConvert.ToDecimal(drinwh["Weight"]);
                        entitydts[i].Remark      = "检验入成品库";
                        entitydts[i].Unit        = drinwh["JSUnit"].ToString();
                        entitydts[i].PackFlag    = 1;//细码标志
                        // ItemCode,ItemName,ItemStd,ColorNum,ColorName,JarNum,ShopID,VendorID,SUM(Qty) Qty,SUM(YQty) Weight,DLever,CompactNo,SO,SaleOPID
                        // ,,,,,,,,SUM(Qty) Qty,SUM(YQty) Weight,,,,

                        DataRow[] ISN = dtall.Select("ISNULL(ItemCode,'')=" + SysString.ToDBString(drinwh["ItemCode"].ToString())
                                                     + " AND ISNULL(ItemName,'')=" + SysString.ToDBString(drinwh["ItemName"].ToString())
                                                     + " AND ISNULL(ItemStd,'')=" + SysString.ToDBString(drinwh["ItemStd"].ToString())
                                                     + " AND ISNULL(ItemModel,'')=" + SysString.ToDBString(drinwh["ItemModel"].ToString())
                                                     + " AND ISNULL(ColorName,'')=" + SysString.ToDBString(drinwh["ColorName"].ToString())
                                                     + " AND ISNULL(ColorNum,'')=" + SysString.ToDBString(drinwh["ColorNum"].ToString())
                                                     + " AND ISNULL(JarNum,'')=" + SysString.ToDBString(drinwh["JarNum"].ToString())
                                                     //+ " AND ISNULL(MF,'')=" + SysString.ToDBString(drinwh["MF"].ToString())
                                                     //      + " AND ISNULL(KZ,'')=" + SysString.ToDBString(drinwh["KZ"].ToString())
                                                     + " AND ISNULL(ShopID,'')=" + SysString.ToDBString(dt.Rows[i]["ShopID"].ToString())
                                                     + " AND ISNULL(VendorID,'')=" + SysString.ToDBString(dt.Rows[i]["VendorID"].ToString())
                                                     + " AND ISNULL(DLever,'')=" + SysString.ToDBString(dt.Rows[i]["DLever"].ToString())
                                                     + " AND ISNULL(CompactNo,'')=" + SysString.ToDBString(dt.Rows[i]["CompactNo"].ToString())
                                                     + " AND ISNULL(SaleOPID,'')=" + SysString.ToDBString(dt.Rows[i]["SaleOPID"].ToString()));
                        entitydts[i].PieceQty = ISN.Length;

                        int m = 0;
                        foreach (DataRow dr in ISN)
                        {
                            IOFormDtsPack entity = new IOFormDtsPack(sqlTrans);
                            entity.Seq    = i + 1;
                            entity.SubSeq = m + 1;
                            entity.BoxNo  = dr["DISN"].ToString();

                            entity.Qty = SysConvert.ToDecimal(dr["Qty"]);

                            entity.Remark = "检验入成品库";
                            List.Add(entity);

                            m++;
                        }
                        i++;
                    }

                    decimal TotalQty = 0;
                    for (int j = 0; j < entitydts.Length; j++)
                    {
                        TotalQty += entitydts[j].Qty;
                    }

                    IOentity.TotalQty = TotalQty;



                    IOFormRule rule2 = new IOFormRule();
                    rule2.RAdd(IOentity, entitydts, List, sqlTrans);



                    rule2.RSubmit(IOentity.ID, (int)ConfirmFlag.已提交, sqlTrans);
                }

                //3更新条码状态(这步动作是在入库提交的时候处理)
                sql = "Update WO_BProductCheckDts Set InWHFlag=1 WHERE ID IN(" + CheckItem + ")";
                sqlTrans.ExecuteNonQuery(sql);
            }
            catch (BaseException)
            {
                throw;
            }
            catch (Exception E)
            {
                throw new BaseException(E.Message);
            }
        }
예제 #24
0
        /// <summary>
        /// 新增(传入事务处理)
        /// </summary>
        /// <param name="p_BE">要新增的实体</param>
        /// <param name="sqlTrans">事务类</param>
        public void RAdd(BaseEntity p_BE, BaseEntity[] p_BE2, IDBTransAccess sqlTrans)
        {
            try
            {
                this.RAdd(p_BE, sqlTrans);
                IOForm        entity  = (IOForm)p_BE;
                IOFormDtsRule ruledts = new IOFormDtsRule();
                for (int i = 0; i < p_BE2.Length; i++)
                {
                    IOFormDts entityDts = (IOFormDts)p_BE2[i];
                    entityDts.MainID = entity.ID;
                    entityDts.Seq    = i + 1;
                    ruledts.RAdd(entityDts, sqlTrans);
                }

                //ruledts.RSave((IOForm)p_BE, p_BE2, sqlTrans);//保存从表
                //FormNoControlRule rulest = new FormNoControlRule();
                //rulest.RAddSort((int)FormNoControlEnum.入库单号,sqlTrans);


                FormNoControlRule rulefn      = new FormNoControlRule();//更新单号
                int       tempFormNoControlID = 0;
                string    sql = "SELECT FormNoControlID FROM Enum_FormList WHERE ID=" + SysString.ToDBString(entity.SubType);
                DataTable dt  = sqlTrans.Fill(sql);
                if (dt.Rows.Count != 0)
                {
                    tempFormNoControlID = SysConvert.ToInt32(dt.Rows[0]["FormNoControlID"].ToString());
                    if (tempFormNoControlID == 0)//子类型没有配置 则读取主类型单号配置
                    {
                        sql = "SELECT FormNoControlID FROM Enum_FormList WHERE ID=" + SysString.ToDBString(entity.HeadType);
                        dt  = sqlTrans.Fill(sql);
                        if (dt.Rows.Count != 0)
                        {
                            tempFormNoControlID = SysConvert.ToInt32(dt.Rows[0]["FormNoControlID"].ToString());
                        }
                    }
                }
                rulefn.RAddSort(tempFormNoControlID, sqlTrans);

                #region 加载自动保存

                //sql = "SELECT * FROM Enum_FormList WHERE ID=" + SysString.ToDBString(entity.SubType);
                //dt = sqlTrans.Fill(sql);
                //if (dt.Rows.Count != 0)
                //{
                //    int saveLoadFormType = SysConvert.ToInt32(dt.Rows[0]["LoadFormTypeID"]);
                //    if (saveLoadFormType == (int)LoadFormType.送货单)
                //    {
                //        sql = "SELECT LoadDtsID,ID,Seq FROM WH_IOFormDts WHERE MainID=" + SysString.ToDBString(entity.ID);
                //        dt = sqlTrans.Fill(sql);
                //        for (int i = 0; i < dt.Rows.Count; i++)
                //        {
                //            int LoadDtsID = SysConvert.ToInt32(dt.Rows[i]["LoadDtsID"]);
                //            int Seq = SysConvert.ToInt32(dt.Rows[i]["Seq"]);
                //            int ID = SysConvert.ToInt32(dt.Rows[i]["ID"]);
                //            int SubSeq = 1;
                //            if (LoadDtsID > 0)
                //            {
                //                sql = "SELECT * FROM Sale_FHFormDtsPack WHERE DID=" + SysString.ToDBString(LoadDtsID);
                //                DataTable dtfh = sqlTrans.Fill(sql);

                //                for (int j = 0; j < dtfh.Rows.Count; j++)
                //                {
                //                    IOFormDtsPackRule rulePack = new IOFormDtsPackRule();
                //                    IOFormDtsPack entityPack = new IOFormDtsPack();
                //                    entityPack.MainID = entity.ID;
                //                    entityPack.Seq = Seq;
                //                    entityPack.DID = ID;
                //                    entityPack.SubSeq = SubSeq;
                //                    entityPack.BoxNo = SysConvert.ToString(dtfh.Rows[j]["BoxNo"]);
                //                    entityPack.Remark = SysConvert.ToString(dtfh.Rows[j]["BoxNo"]);
                //                    entityPack.Qty = SysConvert.ToDecimal(dtfh.Rows[j]["Qty"]);
                //                    SubSeq++;
                //                    rulePack.RAdd(entityPack,sqlTrans);

                //                }
                //            }
                //        }

                //    }
                //}


                #endregion
            }
            catch (BaseException)
            {
                throw;
            }
            catch (Exception E)
            {
                throw new BaseException(E.Message);
            }
        }
예제 #25
0
        /// <summary>
        /// 新增
        /// </summary>
        /// <param name="p_Entity">实体类</param>
        /// <returns>操作影响的记录行数</returns>
        public override int AddNew(BaseEntity p_Entity)
        {
            try
            {
                IOFormDts MasterEntity = (IOFormDts)p_Entity;
                if (MasterEntity.ID == 0)
                {
                    return(0);
                }

                //新增主表数据
                StringBuilder MasterField = new StringBuilder();
                StringBuilder MasterValue = new StringBuilder();
                MasterField.Append("INSERT INTO WH_IOFormDts(");
                MasterValue.Append(" VALUES(");
                MasterField.Append("ID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.ID) + ",");
                MasterField.Append("MainID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.MainID) + ",");
                MasterField.Append("Seq" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.Seq) + ",");
                MasterField.Append("CompanyTypeID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.CompanyTypeID) + ",");
                MasterField.Append("WHTypeID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.WHTypeID) + ",");
                MasterField.Append("WHID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.WHID) + ",");
                MasterField.Append("SectionID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.SectionID) + ",");
                MasterField.Append("SBitID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.SBitID) + ",");
                MasterField.Append("DtsVendorID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.DtsVendorID) + ",");
                MasterField.Append("FromWHID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.FromWHID) + ",");
                MasterField.Append("FromSectionID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.FromSectionID) + ",");
                MasterField.Append("FromSBitID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.FromSBitID) + ",");
                MasterField.Append("ItemCode" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.ItemCode) + ",");
                MasterField.Append("ItemName" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.ItemName) + ",");
                MasterField.Append("ItemStd" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.ItemStd) + ",");
                MasterField.Append("ItemModel" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.ItemModel) + ",");
                MasterField.Append("Batch" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.Batch) + ",");
                MasterField.Append("VendorBatch" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.VendorBatch) + ",");
                MasterField.Append("ColorNum" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.ColorNum) + ",");
                MasterField.Append("ColorName" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.ColorName) + ",");
                MasterField.Append("JarNum" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.JarNum) + ",");
                MasterField.Append("YarnStatus" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.YarnStatus) + ",");
                MasterField.Append("YarnTypeID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.YarnTypeID) + ",");
                MasterField.Append("SizeName" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.SizeName) + ",");
                MasterField.Append("Remark" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.Remark) + ",");
                MasterField.Append("Qty" + ",");
                if (MasterEntity.Qty != 0)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.Qty) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("Unit" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.Unit) + ",");
                MasterField.Append("Weight" + ",");
                if (MasterEntity.Weight != 0)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.Weight) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("SinglePrice" + ",");
                if (MasterEntity.SinglePrice != 0)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.SinglePrice) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("Amount" + ",");
                if (MasterEntity.Amount != 0)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.Amount) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("WAmount" + ",");
                if (MasterEntity.WAmount != 0)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.WAmount) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("DtsSO" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.DtsSO) + ",");
                MasterField.Append("DtsSaleOPID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.DtsSaleOPID) + ",");
                MasterField.Append("Needle" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.Needle) + ",");
                MasterField.Append("YarnType" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.YarnType) + ",");
                MasterField.Append("SourceQty" + ",");
                if (MasterEntity.SourceQty != 0)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.SourceQty) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("MoveQty" + ",");
                if (MasterEntity.MoveQty != 0)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.MoveQty) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("SourceWeight" + ",");
                if (MasterEntity.SourceWeight != 0)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.SourceWeight) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("MoveWeight" + ",");
                if (MasterEntity.MoveWeight != 0)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.MoveWeight) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("TubeGW" + ",");
                if (MasterEntity.TubeGW != 0)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.TubeGW) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("SourceTubeQty" + ",");
                if (MasterEntity.SourceTubeQty != 0)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.SourceTubeQty) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("MoveTubeQty" + ",");
                if (MasterEntity.MoveTubeQty != 0)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.MoveTubeQty) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("TubeQty" + ",");
                if (MasterEntity.TubeQty != 0)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.TubeQty) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("SourcePieceQty" + ",");
                if (MasterEntity.SourcePieceQty != 0)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.SourcePieceQty) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("MovePieceQty" + ",");
                if (MasterEntity.MovePieceQty != 0)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.MovePieceQty) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("PieceQty" + ",");
                if (MasterEntity.PieceQty != 0)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.PieceQty) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("PieceQtyDesc" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.PieceQtyDesc) + ",");
                MasterField.Append("JarNo" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.JarNo) + ",");
                MasterField.Append("Twist" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.Twist) + ",");
                MasterField.Append("DLCode" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.DLCode) + ",");
                MasterField.Append("GoodsCode" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.GoodsCode) + ",");
                MasterField.Append("GoodsLevel" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.GoodsLevel) + ",");
                MasterField.Append("VColorNum" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.VColorNum) + ",");
                MasterField.Append("VColorName" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.VColorName) + ",");
                MasterField.Append("VItemCode" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.VItemCode) + ",");
                MasterField.Append("PFPrice" + ",");
                if (MasterEntity.PFPrice != 0)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.PFPrice) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("ToWHID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.ToWHID) + ",");
                MasterField.Append("ToSectionID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.ToSectionID) + ",");
                MasterField.Append("ToSBitID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.ToSBitID) + ",");
                MasterField.Append("MWidth" + ",");
                if (MasterEntity.MWidth != 0)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.MWidth) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("MWeight" + ",");
                if (MasterEntity.MWeight != 0)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.MWeight) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("WeightUnit" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.WeightUnit) + ",");
                MasterField.Append("DtsInVendorID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.DtsInVendorID) + ",");
                MasterField.Append("InSO" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.InSO) + ",");
                MasterField.Append("InOrderFormNo" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.InOrderFormNo) + ",");
                MasterField.Append("InvoiceQty" + ",");
                if (MasterEntity.InvoiceQty != 0)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.InvoiceQty) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("InvoiceAmount" + ",");
                if (MasterEntity.InvoiceAmount != 0)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.InvoiceAmount) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("PayAmount" + ",");
                if (MasterEntity.PayAmount != 0)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.PayAmount) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("DtsInvoiceDelFlag" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.DtsInvoiceDelFlag) + ",");
                MasterField.Append("DtsInvoiceDelOPID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.DtsInvoiceDelOPID) + ",");
                MasterField.Append("DtsInvoiceDelTime" + ",");
                if (MasterEntity.DtsInvoiceDelTime != SystemConfiguration.DateTimeDefaultValue)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.DtsInvoiceDelTime.ToString("yyyy-MM-dd HH:mm:ss")) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("DtsInvoiceNo" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.DtsInvoiceNo) + ",");
                MasterField.Append("DZQty" + ",");
                if (MasterEntity.DZQty != 0)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.DZQty) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("DZSinglePrice" + ",");
                if (MasterEntity.DZSinglePrice != 0)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.DZSinglePrice) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("DZAmount" + ",");
                if (MasterEntity.DZAmount != 0)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.DZAmount) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("DZFlag" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.DZFlag) + ",");
                MasterField.Append("DZOPID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.DZOPID) + ",");
                MasterField.Append("DZTime" + ",");
                if (MasterEntity.DZTime != SystemConfiguration.DateTimeDefaultValue)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.DZTime.ToString("yyyy-MM-dd HH:mm:ss")) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("DZNo" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.DZNo) + ",");
                MasterField.Append("FreeNum1" + ",");
                if (MasterEntity.FreeNum1 != 0)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.FreeNum1) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("DtsOrderFormNo" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.DtsOrderFormNo) + ",");
                MasterField.Append("InSaleOPID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.InSaleOPID) + ",");
                MasterField.Append("Tax" + ",");
                if (MasterEntity.Tax != 0)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.Tax) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("TaxAmount" + ",");
                if (MasterEntity.TaxAmount != 0)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.TaxAmount) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("PackDts" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.PackDts) + ",");
                MasterField.Append("MLType" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.MLType) + ",");
                MasterField.Append("DYPrice" + ",");
                if (MasterEntity.DYPrice != 0)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.DYPrice) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("YQQty" + ",");
                if (MasterEntity.YQQty != 0)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.YQQty) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("AQty" + ",");
                if (MasterEntity.AQty != 0)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.AQty) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("NOKPQty" + ",");
                if (MasterEntity.NOKPQty != 0)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.NOKPQty) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("NoKPAmount" + ",");
                if (MasterEntity.NoKPAmount != 0)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.NoKPAmount) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("PackFlag" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.PackFlag) + ",");
                MasterField.Append("LoadDtsID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.LoadDtsID) + ",");
                MasterField.Append("InputQty" + ",");
                if (MasterEntity.InputQty != 0)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.InputQty) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("InputUnit" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.InputUnit) + ",");
                MasterField.Append("InputSinglePrice" + ",");
                if (MasterEntity.InputSinglePrice != 0)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.InputSinglePrice) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("InputAmount" + ",");
                if (MasterEntity.InputAmount != 0)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.InputAmount) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("InputConvertXS" + ",");
                if (MasterEntity.InputConvertXS != 0)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.InputConvertXS) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("QtyConvertXS" + ",");
                if (MasterEntity.QtyConvertXS != 0)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.QtyConvertXS) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("Volume" + ",");
                if (MasterEntity.Volume != 0)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.Volume) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("VConvertXS" + ",");
                if (MasterEntity.VConvertXS != 0)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.VConvertXS) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("CarNo" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.CarNo) + ",");
                MasterField.Append("DVendorID" + ")");
                MasterValue.Append(SysString.ToDBString(MasterEntity.DVendorID) + ")");



                //执行
                int AffectedRows = 0;
                if (!this.sqlTransFlag)
                {
                    AffectedRows = this.ExecuteNonQuery(MasterField.Append(MasterValue.ToString()).ToString());
                }
                else
                {
                    AffectedRows = sqlTrans.ExecuteNonQuery(MasterField.Append(MasterValue.ToString()).ToString());
                }
                return(AffectedRows);
            }
            catch (BaseException E)
            {
                throw new BaseException(E.Message, E);
            }
            catch (Exception E)
            {
                throw new BaseException(FrameWorkMessage.GetAlertMessage((int)Message.CommonDBInsert), E);
            }
        }
예제 #26
0
        /// <summary>
        /// 面料移库查找库存
        /// </summary>
        /// <param name="p_entity"></param>
        /// <param name="sqlTrans"></param>
        /// <returns></returns>
        public int FindStorge(IOFormDts p_entity, int p_Type, IDBTransAccess sqlTrans)
        {
            if (p_entity.WHID == string.Empty)
            {
                throw new Exception("单据仓库未找到,不能操作");
            }

            string    conditionstr = string.Empty;
            string    sql          = "SELECT FieldName FROM UV1_WH_WH WHERE WHID=" + SysString.ToDBString(p_entity.WHID);//获得仓库结算类型字段
            DataTable dt           = sqlTrans.Fill(sql);

            if (dt.Rows.Count != 0)
            {
                conditionstr += SysConvert.ToString(dt.Rows[0]["FieldName"]);
            }



            sql = "SELECT ID FROM WH_Storge WHERE 1=1";//查找库存ID
            int CalFieldName = (int)WHCalMethodFieldName.ItemCode;

            if (conditionstr != string.Empty)
            {
                string[] FieldName = conditionstr.Split('+');

                for (int i = 0; i < FieldName.Length; i++)
                {
                    string    sqlFieldName = "SELECT ID FROM Enum_WHCalMethodFieldName WHERE Name=" + SysString.ToDBString(FieldName[i]);//找到库存结算字段对应的ID
                    DataTable dtFieldName  = sqlTrans.Fill(sqlFieldName);
                    if (dtFieldName.Rows.Count != 0 && dtFieldName.Rows[0]["ID"].ToString() != "")
                    {
                        CalFieldName = SysConvert.ToInt32(dtFieldName.Rows[0]["ID"]);
                    }

                    switch (CalFieldName)
                    {
                    case (int)WHCalMethodFieldName.WHID:    //库 上方已处理
                        break;

                    case (int)WHCalMethodFieldName.SectionID:    //区
                        break;

                    case (int)WHCalMethodFieldName.SBitID:    //位
                        break;

                    case (int)WHCalMethodFieldName.ItemCode:    //产品编码
                        sql += " AND ItemCode=" + SysString.ToDBString(p_entity.ItemCode);
                        break;

                    case (int)WHCalMethodFieldName.JarNum:    //缸号
                        sql += " AND JarNum=" + SysString.ToDBString(p_entity.JarNum);
                        break;

                    case (int)WHCalMethodFieldName.ColorNum:    //色号
                        sql += " AND ColorNum=" + SysString.ToDBString(p_entity.ColorNum);
                        break;

                    case (int)WHCalMethodFieldName.ColorName:    //颜色
                        sql += " AND ColorName=" + SysString.ToDBString(p_entity.ColorName);
                        break;

                    case (int)WHCalMethodFieldName.MWidth:    //门幅
                        sql += " AND MWidth=" + SysString.ToDBString(p_entity.MWidth);
                        break;

                    case (int)WHCalMethodFieldName.MWeight:    //克重
                        sql += " AND MWeight=" + SysString.ToDBString(p_entity.MWeight);
                        break;

                    case (int)WHCalMethodFieldName.VendorID:    //客户
                        sql += " AND VendorID=" + SysString.ToDBString(p_entity.DtsVendorID);
                        break;

                    case (int)WHCalMethodFieldName.GoodsCode:    //商品码
                        sql += " AND GoodsCode=" + SysString.ToDBString(p_entity.GoodsCode);
                        break;

                    case (int)WHCalMethodFieldName.GoodsLevel:    //等级
                        sql += " AND GoodsLevel=" + SysString.ToDBString(p_entity.GoodsLevel);
                        break;

                    case (int)WHCalMethodFieldName.Batch:       //批号
                        sql += " AND Batch=" + SysString.ToDBString(p_entity.Batch);
                        break;

                    case (int)WHCalMethodFieldName.Unit:       //批号
                        sql += " AND Unit=" + SysString.ToDBString(p_entity.Unit);
                        break;

                    case (int)WHCalMethodFieldName.VendorBatch:      //客户批号
                        sql += " AND VendorBatch=" + SysString.ToDBString(p_entity.VendorBatch);
                        break;

                    default:
                        throw new Exception("结算异常,结算定义的字段底层未对应:" + CalFieldName);
                    }
                }
            }
            else
            {
                throw new Exception("没有找到结算类型,请联系管理员检查仓库类型配置信息");
            }
            DataTable dtlog = sqlTrans.Fill(sql);

            if (dtlog.Rows.Count > 0)
            {
                return(SysConvert.ToInt32(dtlog.Rows[0][0].ToString()));
            }
            else
            {
                return(0);
            }
        }
예제 #27
0
        /// <summary>
        /// 获得实体
        /// </summary>
        /// <returns></returns>
        private IOFormDts[] EntityDtsGet()
        {
            int index = GetDataCompleteNum();

            IOFormDts[] entitydts = new IOFormDts[index];
            index = 0;
            for (int i = 0; i < gridView1.RowCount; i++)
            {
                if (CheckDataCompleteDts(i))
                {
                    entitydts[index]    = new IOFormDts();
                    entitydts[index].ID = SysConvert.ToInt32(gridView1.GetRowCellValue(i, "ID"));
                    entitydts[index].SelectByID();
                    entitydts[index].MainID      = HTDataID;
                    entitydts[index].Seq         = i + 1;
                    entitydts[index].WHID        = SysConvert.ToString(gridView1.GetRowCellValue(i, "WHID"));
                    entitydts[index].SectionID   = SysConvert.ToString(gridView1.GetRowCellValue(i, "SectionID"));
                    entitydts[index].SBitID      = SysConvert.ToString(gridView1.GetRowCellValue(i, "SBitID"));
                    entitydts[index].WHTypeID    = SysConvert.ToInt32(Common.GetWHTypeByWHID(SysConvert.ToString(gridView1.GetRowCellValue(i, "WHID"))));
                    entitydts[index].ItemCode    = SysConvert.ToString(gridView1.GetRowCellValue(i, "ItemCode"));
                    entitydts[index].ItemName    = SysConvert.ToString(gridView1.GetRowCellValue(i, "ItemName"));
                    entitydts[index].ItemStd     = SysConvert.ToString(gridView1.GetRowCellValue(i, "ItemStd"));
                    entitydts[index].ItemModel   = SysConvert.ToString(gridView1.GetRowCellValue(i, "ItemModel"));
                    entitydts[index].Batch       = SysConvert.ToString(gridView1.GetRowCellValue(i, "Batch"));
                    entitydts[index].VendorBatch = SysConvert.ToString(gridView1.GetRowCellValue(i, "VendorBatch"));
                    entitydts[index].ColorNum    = SysConvert.ToString(gridView1.GetRowCellValue(i, "ColorNum"));
                    entitydts[index].ColorName   = SysConvert.ToString(gridView1.GetRowCellValue(i, "ColorName"));
                    entitydts[index].JarNum      = SysConvert.ToString(gridView1.GetRowCellValue(i, "JarNum"));
                    entitydts[index].StyleNo     = SysConvert.ToString(gridView1.GetRowCellValue(i, "StyleNo"));
                    entitydts[index].Remark      = SysConvert.ToString(gridView1.GetRowCellValue(i, "Remark"));
                    entitydts[index].Qty         = SysConvert.ToDecimal(gridView1.GetRowCellValue(i, "Qty"));
                    entitydts[index].PieceQty    = SysConvert.ToInt32(gridView1.GetRowCellValue(i, "PieceQty"));
                    entitydts[index].Unit        = SysConvert.ToString(gridView1.GetRowCellValue(i, "Unit"));

                    entitydts[index].OrderQty  = SysConvert.ToDecimal(gridView1.GetRowCellValue(i, "OrderQty"));
                    entitydts[index].OrderUnit = SysConvert.ToString(gridView1.GetRowCellValue(i, "OrderUnit"));

                    entitydts[index].Weight      = SysConvert.ToDecimal(gridView1.GetRowCellValue(i, "Weight"));
                    entitydts[index].Yard        = SysConvert.ToDecimal(gridView1.GetRowCellValue(i, "Yard"));
                    entitydts[index].SinglePrice = SysConvert.ToDecimal(gridView1.GetRowCellValue(i, "SinglePrice"));
                    //if (entitydts[index].Unit == "RMB/KG" || entitydts[index].Unit == "USD/KG")
                    //{
                    //    entitydts[index].Amount = entitydts[index].SinglePrice * entitydts[index].Weight;
                    //}
                    //if (entitydts[index].Unit == "RMB/M" || entitydts[index].Unit == "USD/M")
                    //{
                    //    entitydts[index].Amount = entitydts[index].SinglePrice * entitydts[index].Qty;
                    //}
                    //if (entitydts[index].Unit == "RMB/Y" || entitydts[index].Unit == "USD/Y")
                    //{
                    //    entitydts[index].Amount = entitydts[index].SinglePrice * entitydts[index].Yard;
                    //}

                    //if (entitydts[index].Unit.EndsWith("KG"))
                    //{
                    //    entitydts[index].Amount = entitydts[index].SinglePrice * entitydts[index].Weight;
                    //}
                    //if (entitydts[index].Unit.EndsWith("M"))
                    //{
                    //    entitydts[index].Amount = entitydts[index].SinglePrice * entitydts[index].Qty;
                    //}
                    //if (entitydts[index].Unit.EndsWith("Y"))
                    //{
                    //    entitydts[index].Amount = entitydts[index].SinglePrice * entitydts[index].Yard;
                    //}
                    //半成品入库:金额=单价*公斤数(不以单位作为条件结算)
                    entitydts[index].Amount = entitydts[index].SinglePrice * entitydts[index].Weight;

                    entitydts[index].DLCode         = SysConvert.ToString(gridView1.GetRowCellValue(i, "DLCode"));
                    entitydts[index].GoodsCode      = SysConvert.ToString(gridView1.GetRowCellValue(i, "GoodsCode"));
                    entitydts[index].GoodsLevel     = SysConvert.ToString(gridView1.GetRowCellValue(i, "GoodsLevel"));
                    entitydts[index].VColorNum      = SysConvert.ToString(gridView1.GetRowCellValue(i, "VColorNum"));
                    entitydts[index].VColorName     = SysConvert.ToString(gridView1.GetRowCellValue(i, "VColorName"));
                    entitydts[index].VItemCode      = SysConvert.ToString(gridView1.GetRowCellValue(i, "VItemCode"));
                    entitydts[index].MWidth         = SysConvert.ToString(gridView1.GetRowCellValue(i, "MWidth"));
                    entitydts[index].MWeight        = SysConvert.ToString(gridView1.GetRowCellValue(i, "MWeight"));
                    entitydts[index].WeightUnit     = SysConvert.ToString(gridView1.GetRowCellValue(i, "WeightUnit"));
                    entitydts[index].DtsVendorID    = SysConvert.ToString(drpVendorID.EditValue);
                    entitydts[index].DtsSO          = SysConvert.ToString(gridView1.GetRowCellValue(i, "DtsSO"));
                    entitydts[index].DtsOrderFormNo = SysConvert.ToString(gridView1.GetRowCellValue(i, "DtsOrderFormNo"));
                    entitydts[index].DtsSaleOPID    = SysConvert.ToString(drpSaleOPID.EditValue);
                    entitydts[index].MLType         = SysConvert.ToInt32(gridView1.GetRowCellValue(i, "MLType"));


                    entitydts[index].TotalInQty = SysConvert.ToDecimal(gridView1.GetRowCellValue(i, "TotalInQty"));

                    index++;
                }
            }
            return(entitydts);
        }
예제 #28
0
        /// <summary>
        /// 创建单据
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="sqlTrans"></param>
        /// <returns></returns>
        IOForm RAutoCreateWHForm(FabricWHOutForm entity, IDBTransAccess sqlTrans)
        {
            IOForm        entitywh = new IOForm(sqlTrans);
            FabricProcess entityjg = new FabricProcess(sqlTrans);

            entityjg.ID = entity.MainID;
            entityjg.SelectByID();

            #region 赋值出入库单据主实体
            /*赋值出入库单据主实体 Begin*/
            SaleProcedureRule rulesalePro = new SaleProcedureRule();
            int    saleProcedureID        = rulesalePro.GetSaleProcedureByWOTypeID(entityjg.ProcessTypeID);//加工业务单据类型ID
            string sql = string.Empty;
            sql = "SELECT JGFormListID FROM Enum_SaleProcedure WHERE ID=" + saleProcedureID;
            DataTable dtSalePro = sqlTrans.Fill(sql);//配置表
            if (dtSalePro.Rows.Count != 0)
            {
                entitywh.SubType = SysConvert.ToInt32(dtSalePro.Rows[0]["JGFormListID"]);
                FormListRule ruleformlist = new FormListRule();
                entitywh.HeadType = ruleformlist.GetFormListIDBySubTypeID(entitywh.SubType, sqlTrans);
            }
            else
            {
                throw new Exception("业务单据类型配置异常");
            }
            entitywh.WHID      = entity.WHID;
            entitywh.WHOP      = ParamConfig.LoginName;
            entitywh.VendorID  = entityjg.DyeFactorty;//加工厂
            entitywh.FormDate  = DateTime.Now.Date;
            entitywh.WHType    = entity.WHID;
            entitywh.SpecialNo = entity.FormNo;//源单据号;自动扣料的单据号


            FormNoControlRule formconrule = new FormNoControlRule();
            entitywh.FormNo = formconrule.RGetWHFormNo(entitywh.SubType, "", sqlTrans);
            /*赋值出入库单据主实体End */
            #endregion


            #region 赋值出入库单据明细实体
            /*赋值出入库单据明细实体 Begin*/
            sql = "SELECT * FROM WO_FabricWHOutFormDts WHERE MainID=" + entity.ID;
            DataTable   dtDts       = sqlTrans.Fill(sql);
            IOFormDts[] entityDtswh = new IOFormDts[dtDts.Rows.Count];

            if (dtDts.Rows.Count == 0)
            {
                throw new Exception("没有数据明细,不应进行数据保存");
            }
            for (int i = 0; i < dtDts.Rows.Count; i++)
            {
                entityDtswh[i]           = new IOFormDts();
                entityDtswh[i].Seq       = i + 1;
                entityDtswh[i].WHID      = dtDts.Rows[i]["WHID"].ToString();
                entityDtswh[i].SectionID = dtDts.Rows[i]["SectionID"].ToString();
                entityDtswh[i].SBitID    = dtDts.Rows[i]["SBitID"].ToString();
                entityDtswh[i].ItemCode  = dtDts.Rows[i]["ItemCode"].ToString();
                entityDtswh[i].ItemName  = dtDts.Rows[i]["ItemName"].ToString();
                entityDtswh[i].ItemStd   = dtDts.Rows[i]["ItemStd"].ToString();
                entityDtswh[i].ItemModel = dtDts.Rows[i]["ItemModel"].ToString();

                entityDtswh[i].Batch       = dtDts.Rows[i]["Batch"].ToString();
                entityDtswh[i].VendorBatch = dtDts.Rows[i]["VendorBatch"].ToString();
                entityDtswh[i].ColorNum    = dtDts.Rows[i]["ColorNum"].ToString();
                entityDtswh[i].ColorName   = dtDts.Rows[i]["ColorName"].ToString();
                entityDtswh[i].JarNum      = dtDts.Rows[i]["JarNum"].ToString();
                entityDtswh[i].PieceQty    = SysConvert.ToInt32(dtDts.Rows[i]["PieceQty"]);
                entityDtswh[i].Remark      = dtDts.Rows[i]["Remark"].ToString();
                entityDtswh[i].Qty         = SysConvert.ToDecimal(dtDts.Rows[i]["Qty"]);
                entityDtswh[i].Unit        = dtDts.Rows[i]["Unit"].ToString();
                entityDtswh[i].Weight      = SysConvert.ToDecimal(dtDts.Rows[i]["Weight"]);
                entityDtswh[i].SinglePrice = SysConvert.ToDecimal(dtDts.Rows[i]["SinglePrice"]);
                entityDtswh[i].DYPrice     = SysConvert.ToDecimal(dtDts.Rows[i]["DYPrice"]);
                entityDtswh[i].Amount      = SysConvert.ToDecimal(dtDts.Rows[i]["Amount"]);
                entityDtswh[i].GoodsCode   = dtDts.Rows[i]["GoodsCode"].ToString();
                entityDtswh[i].GoodsLevel  = dtDts.Rows[i]["GoodsLevel"].ToString();

                entityDtswh[i].VColorNum  = dtDts.Rows[i]["VColorNum"].ToString();
                entityDtswh[i].VColorName = dtDts.Rows[i]["VColorName"].ToString();
                entityDtswh[i].VItemCode  = dtDts.Rows[i]["VItemCode"].ToString();
                entityDtswh[i].MWeight    = dtDts.Rows[i]["MWeight"].ToString();
                entityDtswh[i].MWidth     = dtDts.Rows[i]["MWidth"].ToString();
                entityDtswh[i].WeightUnit = dtDts.Rows[i]["WeightUnit"].ToString();
                entityDtswh[i].PackDts    = dtDts.Rows[i]["PackDts"].ToString();
                //entityDtswh[i].DtsSO = dtDts.Rows[i]["DtsSO"].ToString();
                //entityDtswh[i].DtsOrderFormNo = dtDts.Rows[i]["DtsOrderFormNo"].ToString();
                entityDtswh[i].DtsInVendorID = dtDts.Rows[i]["DtsInVendorID"].ToString();
                entityDtswh[i].InSO          = dtDts.Rows[i]["InSO"].ToString();
                entityDtswh[i].InOrderFormNo = dtDts.Rows[i]["InOrderFormNo"].ToString();
                entityDtswh[i].InSaleOPID    = dtDts.Rows[i]["InSaleOPID"].ToString();
                entityDtswh[i].MLType        = SysConvert.ToInt32(dtDts.Rows[i]["MLType"]);
                //entityDtswh[i].LoadDtsID = SysConvert.ToInt32(dtDts.Rows[i]["LoadDtsID"]);



                entityDtswh[i].LoadDtsID      = SysConvert.ToInt32(dtDts.Rows[i]["ID"]); //明细表ID
                entityDtswh[i].DtsSO          = entityjg.FormNo;                         //关联单据
                entityDtswh[i].DtsOrderFormNo = dtDts.Rows[i]["DtsSO"].ToString();       //订单号
            }

            decimal TotalQty    = 0;
            decimal TotalAmount = 0;
            for (int i = 0; i < entityDtswh.Length; i++)
            {
                TotalQty    += SysConvert.ToDecimal(entityDtswh[i].Qty);
                TotalAmount += SysConvert.ToDecimal(entityDtswh[i].Amount);
            }
            entitywh.TotalQty    = TotalQty;
            entitywh.TotalAmount = TotalAmount;
            /*赋值出入库单据明细实体 End*/
            #endregion



            IOFormRule rulewh = new IOFormRule();
            rulewh.RAdd(entitywh, entityDtswh, sqlTrans);//保存主从数据
            #region 保存孙表数据

            /*赋值出入库单据码单明细数据 Begin*/
            sql = "SELECT TOP 1 ID FROM WO_FabricWHOutFormDtsPack WHERE MainID=" + SysString.ToDBString(entity.ID);
            DataTable dtPackCheck = sqlTrans.Fill(sql);
            if (dtPackCheck.Rows.Count != 0)//如果有码单明细表示需要保存码单明细值
            {
                sql         = "SELECT LoadDtsID,ID,Seq FROM WH_IOFormDts WHERE MainID=" + SysString.ToDBString(entitywh.ID);
                dtPackCheck = sqlTrans.Fill(sql);
                for (int i = 0; i < dtPackCheck.Rows.Count; i++)
                {
                    int LoadDtsID = SysConvert.ToInt32(dtPackCheck.Rows[i]["LoadDtsID"]);
                    int Seq       = SysConvert.ToInt32(dtPackCheck.Rows[i]["Seq"]);
                    int ID        = SysConvert.ToInt32(dtPackCheck.Rows[i]["ID"]);
                    int SubSeq    = 1;
                    if (LoadDtsID > 0)
                    {
                        sql = "SELECT * FROM WO_FabricWHOutFormDtsPack WHERE DID=" + SysString.ToDBString(LoadDtsID);
                        DataTable dtfh = sqlTrans.Fill(sql);

                        for (int j = 0; j < dtfh.Rows.Count; j++)
                        {
                            IOFormDtsPackRule rulePack   = new IOFormDtsPackRule();
                            IOFormDtsPack     entityPack = new IOFormDtsPack();
                            entityPack.MainID = entitywh.ID;
                            entityPack.Seq    = Seq;
                            entityPack.DID    = ID;
                            entityPack.SubSeq = SubSeq;
                            entityPack.BoxNo  = SysConvert.ToString(dtfh.Rows[j]["BoxNo"]);
                            entityPack.Remark = SysConvert.ToString(dtfh.Rows[j]["BoxNo"]);
                            entityPack.Qty    = SysConvert.ToDecimal(dtfh.Rows[j]["Qty"]);
                            SubSeq++;
                            rulePack.RAdd(entityPack, sqlTrans);
                        }
                    }
                }
            }
            /*赋值出入库单据码单明细数据 End*/
            #endregion

            rulewh.RSubmit(entitywh.ID, (int)YesOrNo.Yes, sqlTrans);//提交

            return(entitywh);
        }
예제 #29
0
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="p_Entity">实体类</param>
        /// <returns>操作影响的记录行数</returns>
        public override int Update(BaseEntity p_Entity)
        {
            try
            {
                IOFormDts MasterEntity = (IOFormDts)p_Entity;
                if (MasterEntity.ID == 0)
                {
                    return(0);
                }

                //更新主表数据
                StringBuilder UpdateBuilder = new StringBuilder();
                UpdateBuilder.Append("UPDATE WH_IOFormDts SET ");
                UpdateBuilder.Append(" ID=" + SysString.ToDBString(MasterEntity.ID) + ",");
                UpdateBuilder.Append(" MainID=" + SysString.ToDBString(MasterEntity.MainID) + ",");
                UpdateBuilder.Append(" Seq=" + SysString.ToDBString(MasterEntity.Seq) + ",");
                UpdateBuilder.Append(" CompanyTypeID=" + SysString.ToDBString(MasterEntity.CompanyTypeID) + ",");
                UpdateBuilder.Append(" WHTypeID=" + SysString.ToDBString(MasterEntity.WHTypeID) + ",");
                UpdateBuilder.Append(" WHID=" + SysString.ToDBString(MasterEntity.WHID) + ",");
                UpdateBuilder.Append(" SectionID=" + SysString.ToDBString(MasterEntity.SectionID) + ",");
                UpdateBuilder.Append(" SBitID=" + SysString.ToDBString(MasterEntity.SBitID) + ",");
                UpdateBuilder.Append(" DtsVendorID=" + SysString.ToDBString(MasterEntity.DtsVendorID) + ",");
                UpdateBuilder.Append(" FromWHID=" + SysString.ToDBString(MasterEntity.FromWHID) + ",");
                UpdateBuilder.Append(" FromSectionID=" + SysString.ToDBString(MasterEntity.FromSectionID) + ",");
                UpdateBuilder.Append(" FromSBitID=" + SysString.ToDBString(MasterEntity.FromSBitID) + ",");
                UpdateBuilder.Append(" ItemCode=" + SysString.ToDBString(MasterEntity.ItemCode) + ",");
                UpdateBuilder.Append(" ItemName=" + SysString.ToDBString(MasterEntity.ItemName) + ",");
                UpdateBuilder.Append(" ItemStd=" + SysString.ToDBString(MasterEntity.ItemStd) + ",");
                UpdateBuilder.Append(" ItemModel=" + SysString.ToDBString(MasterEntity.ItemModel) + ",");
                UpdateBuilder.Append(" Batch=" + SysString.ToDBString(MasterEntity.Batch) + ",");
                UpdateBuilder.Append(" VendorBatch=" + SysString.ToDBString(MasterEntity.VendorBatch) + ",");
                UpdateBuilder.Append(" ColorNum=" + SysString.ToDBString(MasterEntity.ColorNum) + ",");
                UpdateBuilder.Append(" ColorName=" + SysString.ToDBString(MasterEntity.ColorName) + ",");
                UpdateBuilder.Append(" JarNum=" + SysString.ToDBString(MasterEntity.JarNum) + ",");
                UpdateBuilder.Append(" YarnStatus=" + SysString.ToDBString(MasterEntity.YarnStatus) + ",");
                UpdateBuilder.Append(" YarnTypeID=" + SysString.ToDBString(MasterEntity.YarnTypeID) + ",");
                UpdateBuilder.Append(" SizeName=" + SysString.ToDBString(MasterEntity.SizeName) + ",");
                UpdateBuilder.Append(" Remark=" + SysString.ToDBString(MasterEntity.Remark) + ",");

                if (MasterEntity.Qty != 0)
                {
                    UpdateBuilder.Append(" Qty=" + SysString.ToDBString(MasterEntity.Qty) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" Qty=null,");
                }

                UpdateBuilder.Append(" Unit=" + SysString.ToDBString(MasterEntity.Unit) + ",");

                if (MasterEntity.Weight != 0)
                {
                    UpdateBuilder.Append(" Weight=" + SysString.ToDBString(MasterEntity.Weight) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" Weight=null,");
                }


                if (MasterEntity.SinglePrice != 0)
                {
                    UpdateBuilder.Append(" SinglePrice=" + SysString.ToDBString(MasterEntity.SinglePrice) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" SinglePrice=null,");
                }


                if (MasterEntity.Amount != 0)
                {
                    UpdateBuilder.Append(" Amount=" + SysString.ToDBString(MasterEntity.Amount) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" Amount=null,");
                }


                if (MasterEntity.WAmount != 0)
                {
                    UpdateBuilder.Append(" WAmount=" + SysString.ToDBString(MasterEntity.WAmount) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" WAmount=null,");
                }

                UpdateBuilder.Append(" DtsSO=" + SysString.ToDBString(MasterEntity.DtsSO) + ",");
                UpdateBuilder.Append(" DtsSaleOPID=" + SysString.ToDBString(MasterEntity.DtsSaleOPID) + ",");
                UpdateBuilder.Append(" Needle=" + SysString.ToDBString(MasterEntity.Needle) + ",");
                UpdateBuilder.Append(" YarnType=" + SysString.ToDBString(MasterEntity.YarnType) + ",");

                if (MasterEntity.SourceQty != 0)
                {
                    UpdateBuilder.Append(" SourceQty=" + SysString.ToDBString(MasterEntity.SourceQty) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" SourceQty=null,");
                }


                if (MasterEntity.MoveQty != 0)
                {
                    UpdateBuilder.Append(" MoveQty=" + SysString.ToDBString(MasterEntity.MoveQty) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" MoveQty=null,");
                }


                if (MasterEntity.SourceWeight != 0)
                {
                    UpdateBuilder.Append(" SourceWeight=" + SysString.ToDBString(MasterEntity.SourceWeight) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" SourceWeight=null,");
                }


                if (MasterEntity.MoveWeight != 0)
                {
                    UpdateBuilder.Append(" MoveWeight=" + SysString.ToDBString(MasterEntity.MoveWeight) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" MoveWeight=null,");
                }


                if (MasterEntity.TubeGW != 0)
                {
                    UpdateBuilder.Append(" TubeGW=" + SysString.ToDBString(MasterEntity.TubeGW) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" TubeGW=null,");
                }


                if (MasterEntity.SourceTubeQty != 0)
                {
                    UpdateBuilder.Append(" SourceTubeQty=" + SysString.ToDBString(MasterEntity.SourceTubeQty) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" SourceTubeQty=null,");
                }


                if (MasterEntity.MoveTubeQty != 0)
                {
                    UpdateBuilder.Append(" MoveTubeQty=" + SysString.ToDBString(MasterEntity.MoveTubeQty) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" MoveTubeQty=null,");
                }


                if (MasterEntity.TubeQty != 0)
                {
                    UpdateBuilder.Append(" TubeQty=" + SysString.ToDBString(MasterEntity.TubeQty) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" TubeQty=null,");
                }


                if (MasterEntity.SourcePieceQty != 0)
                {
                    UpdateBuilder.Append(" SourcePieceQty=" + SysString.ToDBString(MasterEntity.SourcePieceQty) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" SourcePieceQty=null,");
                }


                if (MasterEntity.MovePieceQty != 0)
                {
                    UpdateBuilder.Append(" MovePieceQty=" + SysString.ToDBString(MasterEntity.MovePieceQty) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" MovePieceQty=null,");
                }


                if (MasterEntity.PieceQty != 0)
                {
                    UpdateBuilder.Append(" PieceQty=" + SysString.ToDBString(MasterEntity.PieceQty) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" PieceQty=null,");
                }

                UpdateBuilder.Append(" PieceQtyDesc=" + SysString.ToDBString(MasterEntity.PieceQtyDesc) + ",");
                UpdateBuilder.Append(" JarNo=" + SysString.ToDBString(MasterEntity.JarNo) + ",");
                UpdateBuilder.Append(" Twist=" + SysString.ToDBString(MasterEntity.Twist) + ",");
                UpdateBuilder.Append(" DLCode=" + SysString.ToDBString(MasterEntity.DLCode) + ",");
                UpdateBuilder.Append(" GoodsCode=" + SysString.ToDBString(MasterEntity.GoodsCode) + ",");
                UpdateBuilder.Append(" GoodsLevel=" + SysString.ToDBString(MasterEntity.GoodsLevel) + ",");
                UpdateBuilder.Append(" VColorNum=" + SysString.ToDBString(MasterEntity.VColorNum) + ",");
                UpdateBuilder.Append(" VColorName=" + SysString.ToDBString(MasterEntity.VColorName) + ",");
                UpdateBuilder.Append(" VItemCode=" + SysString.ToDBString(MasterEntity.VItemCode) + ",");

                if (MasterEntity.PFPrice != 0)
                {
                    UpdateBuilder.Append(" PFPrice=" + SysString.ToDBString(MasterEntity.PFPrice) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" PFPrice=null,");
                }

                UpdateBuilder.Append(" ToWHID=" + SysString.ToDBString(MasterEntity.ToWHID) + ",");
                UpdateBuilder.Append(" ToSectionID=" + SysString.ToDBString(MasterEntity.ToSectionID) + ",");
                UpdateBuilder.Append(" ToSBitID=" + SysString.ToDBString(MasterEntity.ToSBitID) + ",");

                if (MasterEntity.MWidth != 0)
                {
                    UpdateBuilder.Append(" MWidth=" + SysString.ToDBString(MasterEntity.MWidth) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" MWidth=null,");
                }


                if (MasterEntity.MWeight != 0)
                {
                    UpdateBuilder.Append(" MWeight=" + SysString.ToDBString(MasterEntity.MWeight) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" MWeight=null,");
                }

                UpdateBuilder.Append(" WeightUnit=" + SysString.ToDBString(MasterEntity.WeightUnit) + ",");
                UpdateBuilder.Append(" DtsInVendorID=" + SysString.ToDBString(MasterEntity.DtsInVendorID) + ",");
                UpdateBuilder.Append(" InSO=" + SysString.ToDBString(MasterEntity.InSO) + ",");
                UpdateBuilder.Append(" InOrderFormNo=" + SysString.ToDBString(MasterEntity.InOrderFormNo) + ",");

                if (MasterEntity.InvoiceQty != 0)
                {
                    UpdateBuilder.Append(" InvoiceQty=" + SysString.ToDBString(MasterEntity.InvoiceQty) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" InvoiceQty=null,");
                }


                if (MasterEntity.InvoiceAmount != 0)
                {
                    UpdateBuilder.Append(" InvoiceAmount=" + SysString.ToDBString(MasterEntity.InvoiceAmount) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" InvoiceAmount=null,");
                }


                if (MasterEntity.PayAmount != 0)
                {
                    UpdateBuilder.Append(" PayAmount=" + SysString.ToDBString(MasterEntity.PayAmount) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" PayAmount=null,");
                }

                UpdateBuilder.Append(" DtsInvoiceDelFlag=" + SysString.ToDBString(MasterEntity.DtsInvoiceDelFlag) + ",");
                UpdateBuilder.Append(" DtsInvoiceDelOPID=" + SysString.ToDBString(MasterEntity.DtsInvoiceDelOPID) + ",");

                if (MasterEntity.DtsInvoiceDelTime != SystemConfiguration.DateTimeDefaultValue)
                {
                    UpdateBuilder.Append(" DtsInvoiceDelTime=" + SysString.ToDBString(MasterEntity.DtsInvoiceDelTime.ToString("yyyy-MM-dd HH:mm:ss")) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" DtsInvoiceDelTime=null,");
                }

                UpdateBuilder.Append(" DtsInvoiceNo=" + SysString.ToDBString(MasterEntity.DtsInvoiceNo) + ",");

                if (MasterEntity.DZQty != 0)
                {
                    UpdateBuilder.Append(" DZQty=" + SysString.ToDBString(MasterEntity.DZQty) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" DZQty=null,");
                }


                if (MasterEntity.DZSinglePrice != 0)
                {
                    UpdateBuilder.Append(" DZSinglePrice=" + SysString.ToDBString(MasterEntity.DZSinglePrice) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" DZSinglePrice=null,");
                }


                if (MasterEntity.DZAmount != 0)
                {
                    UpdateBuilder.Append(" DZAmount=" + SysString.ToDBString(MasterEntity.DZAmount) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" DZAmount=null,");
                }

                UpdateBuilder.Append(" DZFlag=" + SysString.ToDBString(MasterEntity.DZFlag) + ",");
                UpdateBuilder.Append(" DZOPID=" + SysString.ToDBString(MasterEntity.DZOPID) + ",");

                if (MasterEntity.DZTime != SystemConfiguration.DateTimeDefaultValue)
                {
                    UpdateBuilder.Append(" DZTime=" + SysString.ToDBString(MasterEntity.DZTime.ToString("yyyy-MM-dd HH:mm:ss")) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" DZTime=null,");
                }

                UpdateBuilder.Append(" DZNo=" + SysString.ToDBString(MasterEntity.DZNo) + ",");

                if (MasterEntity.FreeNum1 != 0)
                {
                    UpdateBuilder.Append(" FreeNum1=" + SysString.ToDBString(MasterEntity.FreeNum1) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" FreeNum1=null,");
                }

                UpdateBuilder.Append(" DtsOrderFormNo=" + SysString.ToDBString(MasterEntity.DtsOrderFormNo) + ",");
                UpdateBuilder.Append(" InSaleOPID=" + SysString.ToDBString(MasterEntity.InSaleOPID) + ",");

                if (MasterEntity.Tax != 0)
                {
                    UpdateBuilder.Append(" Tax=" + SysString.ToDBString(MasterEntity.Tax) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" Tax=null,");
                }


                if (MasterEntity.TaxAmount != 0)
                {
                    UpdateBuilder.Append(" TaxAmount=" + SysString.ToDBString(MasterEntity.TaxAmount) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" TaxAmount=null,");
                }

                UpdateBuilder.Append(" PackDts=" + SysString.ToDBString(MasterEntity.PackDts) + ",");
                UpdateBuilder.Append(" MLType=" + SysString.ToDBString(MasterEntity.MLType) + ",");

                if (MasterEntity.DYPrice != 0)
                {
                    UpdateBuilder.Append(" DYPrice=" + SysString.ToDBString(MasterEntity.DYPrice) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" DYPrice=null,");
                }


                if (MasterEntity.YQQty != 0)
                {
                    UpdateBuilder.Append(" YQQty=" + SysString.ToDBString(MasterEntity.YQQty) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" YQQty=null,");
                }


                if (MasterEntity.AQty != 0)
                {
                    UpdateBuilder.Append(" AQty=" + SysString.ToDBString(MasterEntity.AQty) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" AQty=null,");
                }


                if (MasterEntity.NOKPQty != 0)
                {
                    UpdateBuilder.Append(" NOKPQty=" + SysString.ToDBString(MasterEntity.NOKPQty) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" NOKPQty=null,");
                }


                if (MasterEntity.NoKPAmount != 0)
                {
                    UpdateBuilder.Append(" NoKPAmount=" + SysString.ToDBString(MasterEntity.NoKPAmount) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" NoKPAmount=null,");
                }

                UpdateBuilder.Append(" PackFlag=" + SysString.ToDBString(MasterEntity.PackFlag) + ",");
                UpdateBuilder.Append(" LoadDtsID=" + SysString.ToDBString(MasterEntity.LoadDtsID) + ",");

                if (MasterEntity.InputQty != 0)
                {
                    UpdateBuilder.Append(" InputQty=" + SysString.ToDBString(MasterEntity.InputQty) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" InputQty=null,");
                }

                UpdateBuilder.Append(" InputUnit=" + SysString.ToDBString(MasterEntity.InputUnit) + ",");

                if (MasterEntity.InputSinglePrice != 0)
                {
                    UpdateBuilder.Append(" InputSinglePrice=" + SysString.ToDBString(MasterEntity.InputSinglePrice) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" InputSinglePrice=null,");
                }


                if (MasterEntity.InputAmount != 0)
                {
                    UpdateBuilder.Append(" InputAmount=" + SysString.ToDBString(MasterEntity.InputAmount) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" InputAmount=null,");
                }


                if (MasterEntity.InputConvertXS != 0)
                {
                    UpdateBuilder.Append(" InputConvertXS=" + SysString.ToDBString(MasterEntity.InputConvertXS) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" InputConvertXS=null,");
                }


                if (MasterEntity.QtyConvertXS != 0)
                {
                    UpdateBuilder.Append(" QtyConvertXS=" + SysString.ToDBString(MasterEntity.QtyConvertXS) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" QtyConvertXS=null,");
                }


                if (MasterEntity.Volume != 0)
                {
                    UpdateBuilder.Append(" Volume=" + SysString.ToDBString(MasterEntity.Volume) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" Volume=null,");
                }


                if (MasterEntity.VConvertXS != 0)
                {
                    UpdateBuilder.Append(" VConvertXS=" + SysString.ToDBString(MasterEntity.VConvertXS) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" VConvertXS=null,");
                }

                UpdateBuilder.Append(" CarNo=" + SysString.ToDBString(MasterEntity.CarNo) + ",");
                UpdateBuilder.Append(" DVendorID=" + SysString.ToDBString(MasterEntity.DVendorID));

                UpdateBuilder.Append(" WHERE " + "ID=" + SysString.ToDBString(MasterEntity.ID));



                //执行
                int AffectedRows = 0;
                if (!this.sqlTransFlag)
                {
                    AffectedRows = this.ExecuteNonQuery(UpdateBuilder.ToString());
                }
                else
                {
                    AffectedRows = sqlTrans.ExecuteNonQuery(UpdateBuilder.ToString());
                }
                return(AffectedRows);
            }
            catch (BaseException E)
            {
                throw new BaseException(E.Message, E);
            }
            catch (Exception E)
            {
                throw new BaseException(FrameWorkMessage.GetAlertMessage((int)Message.CommonDBUpdate), E);
            }
        }
예제 #30
0
        /// <summary>
        /// 处理对账回填数据
        /// </summary>
        /// <param name="p_FormID"></param>
        /// <param name="p_Type"></param>
        /// <param name="sqlTrans"></param>
        private void SetCheckOperation(int p_FormID, int p_Type, IDBTransAccess sqlTrans)
        {
            string sql = "SELECT ID,MainID,Seq FROM Finance_CheckOperationDts WHERE MainID=" + SysString.ToDBString(p_FormID);

            sql += " ORDER BY Seq";
            DataTable dt = sqlTrans.Fill(sql);

            if (dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    //对账单
                    CheckOperation entity = new CheckOperation();
                    entity.ID = p_FormID;

                    ///对账单明细
                    CheckOperationDts entityDts = new CheckOperationDts();
                    entityDts.ID = SysConvert.ToInt32(dr["ID"]);
                    entityDts.SelectByID();

                    ///仓库单据明细
                    IOFormDts entityIOF = new IOFormDts(sqlTrans);
                    entityIOF.ID = entityDts.DLOADDtsID;
                    if (entityDts.DLOADDtsID > 0) ///回填仓库出入库数据
                    {
                        if (entityIOF.SelectByID())
                        {
                        }
                        else
                        {
                            throw new Exception("操作异常,没有找到出入库记录 ID:" + entityDts.DLOADDtsID);
                        }
                        if (p_Type == (int)YesOrNo.Yes)//提交
                        {
                            //if (entityIOF.DZFlag == (int)YesOrNo.Yes && entityIOF.Qty == entityDts.DCheckQty)
                            //{
                            //    throw new Exception("不能操作,数据已对账 ID:" + entityDts.DLOADDtsID + " " + entityIOF.ItemCode + " " + entityIOF.ColorNum);
                            //}

                            ///回填数据到出库明细表中:对账数量、对账金额、对账单价、对账标志、对账单、对账日期、对账单号
                            sql  = "UPDATE WH_IOFormDts SET DZQty=ISNULL(DZQty,0)+(" + SysString.ToDBString(entityDts.DCheckQty) + ")";
                            sql += ",DZAmount=ISNULL(DZAmount,0)+(" + SysString.ToDBString(entityDts.DCheckAmount) + ")";
                            sql += ",DZSinglePrice=" + SysString.ToDBString(entityDts.DCheckSinglePrice);
                            sql += ",DZFlag=1";
                            sql += ",DZOPID=" + SysString.ToDBString(entity.SaleOPID);
                            sql += ",DZTime=GetDate()";
                            sql += ",DZNo=" + SysString.ToDBString(entity.FormNo);
                            sql += " WHERE ID=" + SysString.ToDBString(entityDts.DLOADDtsID);
                            sqlTrans.ExecuteNonQuery(sql);
                        }
                        else//撤销提交
                        {
                            //if (entityIOF.InvoiceQty != 0 && entityIOF.Qty == entityDts.DCheckQty)
                            //{
                            //    throw new Exception("不能操作,数据已有开票数据 ID:" + entityDts.DLOADDtsID + " " + entityIOF.ItemCode + " " + entityIOF.ColorNum);
                            //}

                            sql  = "UPDATE WH_IOFormDts SET DZQty=ISNULL(DZQty,0)-(" + SysString.ToDBString(entityDts.DCheckQty) + ")";
                            sql += ",DZAmount=ISNULL(DZAmount,0)-(" + SysString.ToDBString(entityDts.DCheckAmount) + ")";
                            sql += ",DZSinglePrice=NULL";
                            if (entityIOF.DZQty == entityDts.DCheckQty)
                            {
                                sql += ",DZFlag=0";
                            }
                            sql += ",DZOPID=''";
                            sql += ",DZTime=NULL";
                            sql += ",DZNo=''";
                            sql += " WHERE ID=" + SysString.ToDBString(entityDts.DLOADDtsID);
                            sqlTrans.ExecuteNonQuery(sql);
                        }
                    }
                }
            }
        }