Exemplo n.º 1
0
        /// <summary>
        /// 设置
        /// </summary>
        public override void EntitySet()
        {
            FabricProcess entity = new FabricProcess();

            entity.ID = HTDataID;
            bool findFlag = entity.SelectByID();

            HTDataFormNo = entity.FormNo;

            txtFormNo.Text       = entity.FormNo;
            txtMakeOPName.Text   = entity.MakeOPName.ToString();
            txtMakeDate.DateTime = entity.MakeDate;
            txtFormDate.DateTime = entity.FormDate.Date;
            //drpVendorID.EditValue = entity.VendorID;
            //drpOrderLevelID.EditValue = entity.OrderLevelID;
            //drpOrderTypeID.EditValue = entity.OrderTypeID;
            txtReqDate.DateTime = entity.ReqDate;
            //txtOrderDate.DateTime = entity.OrderDate;
            txtOrderFormNo.Text = entity.OrderFormNo;
            //txtCustomerCode.Text = entity.CustomerCode.ToString();
            //txtPayMethodID.Text = entity.PayMethodID.ToString();
            txtRemark.Text = entity.Remark.ToString();
            //txtContractDesc.Text = entity.ContractDesc.ToString();
            txtTotalAmount.Text        = entity.TotalAmount.ToString();
            txtTotalQty.Text           = entity.TotalQty.ToString();
            HTDataSubmitFlag           = entity.SubmitFlag;
            HTDataDelFlag              = entity.DelFlag;
            drpPayMothodFlag.EditValue = entity.PayMethodFlag;
            //drpWLAmountType.EditValue = entity.WLAmountType;
            //txtWLAmount.Text = entity.WLAmount.ToString();

            drpDyeFactorty.EditValue = entity.DyeFactorty.ToString();
            //txtRSTec.Text = entity.DyeingTec.ToString();
            //txtBuyerReq.Text = entity.DyeingReq.ToString();
            //chkLightSource.Text = entity.LightSource.ToString();
            //txtSGReq.Text = entity.SGReq.ToString();
            //txtSendAddr.Text = entity.SendAddress.ToString();
            drpSaleOPID.EditValue = entity.SaleOPID.ToString();

            txtGYRequire.Text    = entity.GYRequire.ToString();
            txtLoss.Text         = entity.Loss.ToString();
            txtBiLi.Text         = entity.BiLi.ToString();
            drpYHStyle.EditValue = entity.YHStyle;


            if (!findFlag)
            {
            }

            BindGridDts();
            BindOrderInfo();
            BindGridItemDts();


            ProductCommon.JGButtonStatusSet(HTFormStatus, HTDataSubmitFlag, HTDataID, btnJGKL);//设置扣料按钮状态
        }
Exemplo n.º 2
0
        /// <summary>
        /// 设置
        /// </summary>
        public override void EntitySet()
        {
            FabricProcess entity = new FabricProcess();

            entity.ID = HTDataID;
            bool findFlag = entity.SelectByID();

            HTDataFormNo = entity.FormNo;

            txtFormNo.Text       = entity.FormNo;
            txtMakeOPName.Text   = entity.MakeOPName.ToString();
            txtMakeDate.DateTime = entity.MakeDate;
            txtFormDate.DateTime = entity.FormDate.Date;

            drpVendorID.EditValue     = entity.VendorID;
            drpOrderLevelID.EditValue = entity.OrderLevelID;
            drpOrderTypeID.EditValue  = entity.OrderTypeID;
            txtReqDate.DateTime       = entity.ReqDate;
            txtOrderDate.DateTime     = entity.OrderDate;
            txtOrderFormNo.Text       = entity.OrderFormNo;
            txtCustomerCode.Text      = entity.CustomerCode.ToString();
            //txtPayMethodID.Text = entity.PayMethodID.ToString();
            txtRemark.Text             = entity.Remark.ToString();
            txtContractDesc.Text       = entity.ContractDesc.ToString();
            txtTotalAmount.Text        = entity.TotalAmount.ToString();
            txtTotalQty.Text           = entity.TotalQty.ToString();
            HTDataSubmitFlag           = entity.SubmitFlag;
            HTDataDelFlag              = entity.DelFlag;
            drpPayMothodFlag.EditValue = entity.PayMethodFlag;
            drpWLAmountType.EditValue  = entity.WLAmountType;
            txtWLAmount.Text           = entity.WLAmount.ToString();

            drpDyeFactorty.EditValue = entity.DyeFactorty.ToString();
            txtRSTec.Text            = entity.DyeingTec.ToString();
            txtBuyerReq.Text         = entity.DyeingReq.ToString();
            chkLightSource.Text      = entity.LightSource.ToString();
            txtSGReq.Text            = entity.SGReq.ToString();
            txtSendAddr.Text         = entity.SendAddress.ToString();
            drpSaleOPID.EditValue    = entity.SaleOPID.ToString();

            SetCheckWOOtherType(chklWOOtherTypeIDStr, entity.WOOtherTypeIDStr);

            txtGongXu.Text          = entity.GongXu.ToString();
            txtPackMethod.Text      = entity.PackMethod.ToString();
            drpRCVendorID.EditValue = entity.RCVendorID.ToString();

            txtDyeingTec.Text = entity.DyeingTec.ToString();

            if (!findFlag)
            {
            }

            BindGridDts();
            BindOrderInfo();
        }
Exemplo n.º 3
0
        private FabricProcess EntityGet()
        {
            FabricProcess entity = new FabricProcess();

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

            entity.ProductionID = ID;

            entity.FormNo       = txtFormNo.Text.Trim();
            entity.MakeDate     = txtMakeDate.DateTime;
            entity.FormDate     = txtFormDate.DateTime.Date;
            entity.MakeOPID     = FParamConfig.LoginID;
            entity.MakeOPName   = txtMakeOPName.Text.Trim();
            entity.OrderLevelID = SysConvert.ToInt32(drpOrderLevelID.EditValue);
            entity.OrderTypeID  = SysConvert.ToInt32(drpOrderTypeID.EditValue);
            entity.VendorID     = SysConvert.ToString(drpVendorID.EditValue);
            entity.OrderFormNo  = SysConvert.ToString(txtOrderFormNo.Text.Trim());  //销售合同号
            //entity.OrderDate = txtOrderDate.DateTime;
            entity.ReqDate = txtReqDate.DateTime;
            //entity.PayMethodID = txtPayMethodID.Text.Trim();
            entity.TotalQty      = SysConvert.ToDecimal(txtTotalQty.Text.Trim());
            entity.TotalAmount   = SysConvert.ToDecimal(txtTotalAmount.Text.Trim());
            entity.Remark        = txtRemark.Text.Trim();
            entity.ContractDesc  = txtContractDesc.Text.Trim();
            entity.CustomerCode  = txtCustomerCode.Text.Trim();
            entity.PayMethodID   = SysConvert.ToString(drpPayMothodFlag.EditValue);
            entity.PayMethodFlag = SysConvert.ToInt32(drpPayMothodFlag.EditValue);
            entity.WLAmountType  = SysConvert.ToInt32(drpWLAmountType.EditValue);
            entity.WLAmount      = SysConvert.ToDecimal(txtWLAmount.Text.Trim());

            entity.DyeFactorty   = drpDyeFactorty.EditValue.ToString();
            entity.DyeingTec     = txtRSTec.Text.Trim();
            entity.DyeingReq     = txtBuyerReq.Text.Trim();
            entity.LightSource   = chkLightSource.Text.Trim();
            entity.SGReq         = txtSGReq.Text.Trim();
            entity.SendAddress   = txtSendAddr.Text.Trim();
            entity.SaleOPID      = SysConvert.ToString(drpSaleOPID.EditValue);
            entity.ProcessTypeID = (int)EnumProcessType.其他加工单;

            entity.PackMethod  = drpPackMethod.Text.ToString();
            entity.AfterFinish = drpAfterFinish.Text.ToString();

            entity.ShipMethod = SysConvert.ToString(drpShipMethod.EditValue);

            entity.HZTypeID = SysConvert.ToInt32(drpHZType.EditValue);

            return(entity);
        }
Exemplo n.º 4
0
 private void btnDelete_Click(object sender, EventArgs e)
 {
     try
     {
         FabricProcessRule rule   = new FabricProcessRule();
         FabricProcess     entity = new FabricProcess();
         entity.ID = HTID;
         entity.SelectByID();
         rule.RDelete(entity);
         this.Close();
     }
     catch (Exception E)
     {
         this.ShowMessage(E.Message);
     }
 }
Exemplo n.º 5
0
        public void EntitySet()
        {
            FabricProcess entity = new FabricProcess();

            entity.ID = HTID;
            bool findFlag = entity.SelectByID();

            txtFormNo.Text            = entity.FormNo;
            txtMakeOPName.Text        = entity.MakeOPName.ToString();
            txtMakeDate.DateTime      = entity.MakeDate;
            txtFormDate.DateTime      = entity.FormDate.Date;
            drpVendorID.EditValue     = entity.VendorID;
            drpOrderLevelID.EditValue = entity.OrderLevelID;
            drpOrderTypeID.EditValue  = entity.OrderTypeID;
            txtReqDate.DateTime       = entity.ReqDate;
            txtOrderDate.DateTime     = entity.OrderDate;
            txtOrderFormNo.Text       = entity.OrderFormNo;
            txtCustomerCode.Text      = entity.CustomerCode.ToString();
            txtRemark.Text            = entity.Remark.ToString();
            txtContractDesc.Text      = entity.ContractDesc.ToString();
            txtTotalAmount.Text       = entity.TotalAmount.ToString();
            txtTotalQty.Text          = entity.TotalQty.ToString();

            drpPayMothodFlag.EditValue = entity.PayMethodFlag;
            drpWLAmountType.EditValue  = entity.WLAmountType;
            txtWLAmount.Text           = entity.WLAmount.ToString();

            drpDyeFactorty.EditValue = entity.DyeFactorty.ToString();
            txtRSTec.Text            = entity.DyeingTec.ToString();
            txtBuyerReq.Text         = entity.DyeingReq.ToString();
            chkLightSource.Text      = entity.LightSource.ToString();
            txtSGReq.Text            = entity.SGReq.ToString();
            txtSendAddr.Text         = entity.SendAddress.ToString();
            drpSaleOPID.EditValue    = entity.SaleOPID.ToString();
            drpPackMethod.Text       = entity.PackMethod;
            drpAfterFinish.Text      = entity.AfterFinish;

            drpShipMethod.EditValue = entity.ShipMethod;

            drpHZType.EditValue = entity.HZTypeID;

            if (!findFlag)
            {
            }

            BindGridDts();
        }
Exemplo n.º 6
0
        /// <summary>
        /// 审核
        /// </summary>
        /// <param name="p_FormID">单据ID</param>
        /// <param name="p_Type">0/1/2/3:弃审/审核</param>
        public void RSubmit(int p_FormID, int p_Type, IDBTransAccess sqlTrans)
        {
            try
            {
                int           p_TempType = p_Type;//处理状态
                string        sql        = string.Empty;
                FabricProcess entity     = new FabricProcess(sqlTrans);
                entity.ID = p_FormID;
                entity.SelectByID();
                if (entity.SubmitFlag == p_Type)//如果相同异常
                {
                    throw new Exception("单据状态重复设置,请关闭程序重新打开操作");
                }



                sql = "UPDATE WO_PrintingProcess SET SubmitFlag=" + SysString.ToDBString(p_Type);
                //if (p_Type == (int)ConfirmFlag.审核通过 || p_Type == (int)ConfirmFlag.审核拒绝)
                //{
                //sql += ",SubmitOPID=" + SysString.ToDBString(ParamConfig.LoginName) + ",SubmitTime=" + SysString.ToDBString(DateTime.Now);
                //}
                sql += " WHERE ID=" + p_FormID.ToString();//更新单据主表审核状态
                sqlTrans.ExecuteNonQuery(sql);
                //if (p_Type == (int)YesOrNo.Yes)
                //{
                //    sql = "SELECT ItemCode,ColorNum,ColorName FROM WO_PrintingProcessDts WHERE MainID=" + p_FormID;
                //    DataTable dtDts = sqlTrans.Fill(sql);

                //    SaleOrderRule salerule = new SaleOrderRule();
                //    foreach (DataRow dr in dtDts.Rows)
                //    {
                //        salerule.RUpdateStep(entity.OrderFormNo, dr["ItemCode"].ToString(), dr["ColorNum"].ToString(),dr["ColorName"].ToString(), (int)EnumOrderStep.采购, p_Type, true, sqlTrans);
                //    }
                //}
            }
            catch (BaseException)
            {
                throw;
            }
            catch (Exception E)
            {
                throw new BaseException(E.Message);
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// 获得实体
        /// </summary>
        /// <returns></returns>
        private FabricProcess EntityGet()
        {
            FabricProcess entity = new FabricProcess();

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

            entity.FormNo       = txtFormNo.Text.Trim();
            entity.MakeDate     = txtMakeDate.DateTime;
            entity.FormDate     = txtMakeDate.DateTime;
            entity.MakeOPID     = FParamConfig.LoginID;
            entity.MakeOPName   = txtMakeOPName.Text.Trim();
            entity.OrderLevelID = SysConvert.ToInt32(drpOrderLevelID.EditValue);
            entity.OrderTypeID  = SysConvert.ToInt32(drpOrderTypeID.EditValue);
            entity.VendorID     = SysConvert.ToString(drpVendorID.EditValue);
            entity.OrderFormNo  = SysConvert.ToString(txtOrderFormNo.Text.Trim());  //销售合同号
            //entity.OrderDate = txtOrderDate.DateTime;
            entity.ReqDate = txtReqDate.DateTime;
            //entity.PayMethodID = txtPayMethodID.Text.Trim();
            entity.TotalQty      = SysConvert.ToDecimal(txtTotalQty.Text.Trim());
            entity.TotalAmount   = SysConvert.ToDecimal(txtTotalAmount.Text.Trim());
            entity.Remark        = txtRemark.Text.Trim();
            entity.ContractDesc  = txtContractDesc.Text.Trim();
            entity.CustomerCode  = txtCustomerCode.Text.Trim();
            entity.PayMethodID   = SysConvert.ToString(drpPayMothodFlag.EditValue);
            entity.PayMethodFlag = SysConvert.ToInt32(drpPayMothodFlag.EditValue);
            entity.WLAmountType  = SysConvert.ToInt32(drpWLAmountType.EditValue);
            entity.WLAmount      = SysConvert.ToDecimal(txtWLAmount.Text.Trim());

            entity.DyeFactorty = drpDyeFactorty.EditValue.ToString();
            //entity.CustomerReq = txtCustomerReq.Text.Trim();
            //entity.LossQty = SysConvert.ToDecimal(txtLossQty.Text.Trim());
            entity.SendAddress   = txtSendAddr.Text.Trim();
            entity.SaleOPID      = SysConvert.ToString(drpSaleOPID.EditValue);
            entity.ProcessTypeID = 2;
            return(entity);
        }
Exemplo n.º 8
0
        /// <summary>
        /// 设置
        /// </summary>
        public override void EntitySet()
        {
            FabricProcess entity = new FabricProcess();

            entity.ID = HTDataID;
            bool findFlag = entity.SelectByID();

            HTDataFormNo = entity.FormNo;

            txtFormNo.Text            = entity.FormNo;
            txtMakeOPName.Text        = entity.MakeOPName.ToString();
            txtMakeDate.DateTime      = entity.MakeDate;
            txtFormDate.DateTime      = entity.FormDate.Date;
            drpVendorID.EditValue     = entity.VendorID;
            drpOrderLevelID.EditValue = entity.OrderLevelID;
            drpOrderTypeID.EditValue  = entity.OrderTypeID;
            txtReqDate.DateTime       = entity.ReqDate;
            txtOrderDate.DateTime     = entity.OrderDate;
            txtOrderFormNo.Text       = entity.OrderFormNo;
            txtCustomerCode.Text      = entity.CustomerCode.ToString();
            //txtPayMethodID.Text = entity.PayMethodID.ToString();
            txtRemark.Text             = entity.Remark.ToString();
            txtContractDesc.Text       = entity.ContractDesc.ToString();
            txtTotalAmount.Text        = entity.TotalAmount.ToString();
            txtTotalQty.Text           = entity.TotalQty.ToString();
            HTDataSubmitFlag           = entity.SubmitFlag;
            HTDataDelFlag              = entity.DelFlag;
            drpPayMothodFlag.EditValue = entity.PayMethodFlag;
            drpWLAmountType.EditValue  = entity.WLAmountType;
            txtWLAmount.Text           = entity.WLAmount.ToString();

            drpDyeFactorty.EditValue = entity.DyeFactorty.ToString();
            txtRSTec.Text            = entity.DyeingTec.ToString();
            txtBuyerReq.Text         = entity.DyeingReq.ToString();
            chkLightSource.Text      = entity.LightSource.ToString();
            txtSGReq.Text            = entity.SGReq.ToString();
            txtSendAddr.Text         = entity.SendAddress.ToString();
            drpSaleOPID.EditValue    = entity.SaleOPID.ToString();
            drpPackMethod.Text       = entity.PackMethod;
            drpAfterFinish.Text      = entity.AfterFinish;

            drpShipMethod.EditValue = entity.ShipMethod;

            if (!findFlag)
            {
            }


            FabricProcessAdd entityAdd = new FabricProcessAdd();

            entityAdd.ID = HTDataID;
            entityAdd.SelectByID();
            txtASigned.Text      = entityAdd.Signed;
            txtADesizing.Text    = entityAdd.Desizing;
            txtAMercerized.Text  = entityAdd.Mercerized;
            txtAReactive.Text    = entityAdd.Reactive;
            txtAPigment.Text     = entityAdd.Pigment;
            txtANonAzo.Text      = entityAdd.NonAzo;
            txtASoftner.Text     = entityAdd.Softner;
            txtAStentering.Text  = entityAdd.Stentering;
            txtASanfor.Text      = entityAdd.Sanfor;
            txtAWaterwash.Text   = entityAdd.Waterwash;
            txtAAirowash.Text    = entityAdd.Airowash;
            txtACarbonpeach.Text = entityAdd.Carbonpeach;
            txtAMoleskin.Text    = entityAdd.Moleskin;

            txtPHValue.Text           = entityAdd.PHValue;
            txtSL.Text                = entityAdd.SL;
            txtGC.Text                = entityAdd.GC;
            txtSC.Text                = entityAdd.SC;
            txtLight.Text             = entityAdd.Light;
            txtXSHZSLD.Text           = entityAdd.XSHZSLD;
            txtPillingMartindale.Text = entityAdd.PillingMartindale;
            txtDSGY1.Text             = entityAdd.DSGY1;
            txtDSGY2.Text             = entityAdd.DSGY2;
            txtDSGY3.Text             = entityAdd.DSGY3;
            txtDSGY4.Text             = entityAdd.DSGY4;
            txtDSGY5.Text             = entityAdd.DSGY5;


            txtTensileStrength.Text = entityAdd.TensileStrength;
            txtTearingStrength.Text = entityAdd.TearingStrength;
            txtSeamSlippage.Text    = entityAdd.SeamSlippage.ToString();
            txtXSLD.Text            = entityAdd.XSLD;
            txtXDLD.Text            = entityAdd.XDLD;
            txtWX.Text             = entityAdd.WX;
            txtShipmentSample.Text = entityAdd.ShipmentSample;
            txtApprovedLab.Text    = entityAdd.ApprovedLab;
            txtHandFeelSample.Text = entityAdd.HandFeelSample;


            txtSmooth.Text               = entityAdd.Smooth;
            txtRough.Text                = entityAdd.Rough;
            txtRolledOnTube.Text         = entityAdd.RolledOnTube;
            txtPolyBagWrapped.Text       = entityAdd.PolyBagWrapped;
            txtYardFolded.Text           = entityAdd.YardFolded;
            txtDoublePolyBagWrapped.Text = entityAdd.DoublePolyBagWrapped;
            txtCartonPack.Text           = entityAdd.Carbonpeach;
            txtForBales.Text             = entityAdd.ForBales;

            BindGridDts();
            BindOrderInfo();
            BindGridPBDts();
        }
Exemplo n.º 9
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);
        }
Exemplo n.º 10
0
        /// <summary>
        /// 审核
        /// </summary>
        /// <param name="p_FormID">单据ID</param>
        /// <param name="p_Type">0/1/2/3:弃审/审核</param>
        public void RSubmit(int p_FormID, int p_Type, IDBTransAccess sqlTrans)
        {
            try
            {
                int           p_TempType = p_Type;//处理状态
                string        sql        = string.Empty;
                FabricProcess entity     = new FabricProcess(sqlTrans);
                entity.ID = p_FormID;
                entity.SelectByID();
                if (entity.SubmitFlag == p_Type)//如果相同异常
                {
                    throw new Exception("单据状态重复设置,请关闭程序重新打开操作");
                }
                if (p_Type == (int)ConfirmFlag.未提交)                                  //撤销提交验证
                {
                    if (SysConvert.ToBoolean(ProductParamSet.GetIntValueByID(5809))) //加工单有仓库单据不允许修改
                    {
                        bool      allowOPFlag   = true;
                        string    refuseMessage = string.Empty;
                        DataTable dtSOFlow;
                        if (allowOPFlag)
                        {
                            //仓库流程单据
                            sql      = "SELECT TOP 1 ID,FormNo FROM UV1_WH_IOFormDts WHERE DtsSO=" + SysString.ToDBString(entity.FormNo);
                            dtSOFlow = SysUtils.Fill(sql);
                            if (dtSOFlow.Rows.Count != 0)
                            {
                                allowOPFlag   = false;
                                refuseMessage = "此单已有仓库单据(单号):" + dtSOFlow.Rows[0]["FormNo"].ToString() + ",不允许撤销";
                            }
                        }

                        if (!allowOPFlag)//不允许操作
                        {
                            throw new Exception(refuseMessage);
                        }
                    }
                }


                sql = "UPDATE WO_FabricProcess SET SubmitFlag=" + SysString.ToDBString(p_Type);
                //if (p_Type == (int)ConfirmFlag.审核通过 || p_Type == (int)ConfirmFlag.审核拒绝)
                //{
                //sql += ",SubmitOPID=" + SysString.ToDBString(ParamConfig.LoginName) + ",SubmitTime=" + SysString.ToDBString(DateTime.Now);
                //}
                sql += " WHERE ID=" + p_FormID.ToString();//更新单据主表审核状态
                sqlTrans.ExecuteNonQuery(sql);



                int tempSaleProcedureID = 0;
                switch (entity.ProcessTypeID)//2:织造;1:染整;3:印花;4:其它
                {
                case 1:
                    tempSaleProcedureID = (int)EnumSaleProcedure.染整加工单;
                    break;

                case 2:
                    tempSaleProcedureID = (int)EnumSaleProcedure.织胚加工单;    //织造加工单
                    break;

                case 3:
                    tempSaleProcedureID = (int)EnumSaleProcedure.印花加工单;
                    break;

                case 4:    //其它  改为后整加工
                    tempSaleProcedureID = (int)EnumSaleProcedure.其它加工单;
                    break;

                case 5:
                    tempSaleProcedureID = (int)EnumSaleProcedure.合加工单;
                    break;
                }


                //if (p_Type == (int)YesOrNo.Yes)
                if (p_Type == (int)ConfirmFlag.已提交)
                {
                    sql = "SELECT DtsSO,ItemCode,ColorNum,ColorName,DtsSO,CPItemCode FROM WO_FabricProcessDts WHERE MainID=" + p_FormID;
                    DataTable dtDts = sqlTrans.Fill(sql);
                    if (tempSaleProcedureID == (int)EnumSaleProcedure.织胚加工单)//织造加工单
                    {
                        SaleOrderRule salerule = new SaleOrderRule();
                        foreach (DataRow dr in dtDts.Rows)
                        {
                            salerule.RUpdateStep(dr["DtsSO"].ToString(), dr["CPItemCode"].ToString(), dr["ColorNum"].ToString(), dr["ColorName"].ToString(), tempSaleProcedureID, 0, 0, 0, p_Type, true, sqlTrans);
                        }
                    }
                    else
                    {
                        SaleOrderRule salerule = new SaleOrderRule();
                        foreach (DataRow dr in dtDts.Rows)
                        {
                            salerule.RUpdateStep(dr["DtsSO"].ToString(), dr["ItemCode"].ToString(), dr["ColorNum"].ToString(), dr["ColorName"].ToString(), tempSaleProcedureID, 0, 0, 0, p_Type, true, sqlTrans);
                        }
                    }
                }
            }
            catch (BaseException)
            {
                throw;
            }
            catch (Exception E)
            {
                throw new BaseException(E.Message);
            }
        }