Exemple #1
0
 public Entity.SA_Packs FindSaPacksBySaPacks(Entity.SA_Packs saPacks)
 {
     using (ERP2008Entities erp2008 = new ERP2008Entities())
     {
         SA_Packs saPack = null;
         saPack = (from pack in erp2008.SA_Packs where pack.cPCode == saPacks.cPCode select pack
                   ).SingleOrDefault();
         return(saPack);
     }
 }
Exemple #2
0
 public Entity.SA_Packs FinSaPacksBysaCode(string saCode)
 {
     using (ERP2008Entities erp2008 = new ERP2008Entities())
     {
         SA_Packs saPacks = null;
         saPacks = (from saPack in erp2008.SA_Packs where saPack.cPCode == saCode select saPack
                    ).SingleOrDefault();
         return(saPacks);
     }
 }
Exemple #3
0
        public Entity.SA_Packs FindSaPacksBySaPackCode(string saPackCode)
        {
            SA_Packs saPacks = iSaPackDao.FinSaPacksBysaCode(saPackCode);

            return(saPacks);
        }
        /// <summary>
        /// 查询标签信息按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnQuery_Click(object sender, EventArgs e)
        {
            ClearGroupBoxText();
            if (!string.IsNullOrEmpty(txtCode.Text))
            {
                t_opencardpack parmOpencardpack = new t_opencardpack();
                parmOpencardpack.Fbarcode = txtCode.Text.Trim().ToString();
                t_opencardpack newOpencardpack = openCardPackBll.FindOpencardpackByCode(parmOpencardpack);
                if (newOpencardpack != null)
                {
                    if (newOpencardpack.Flabelqty == null)
                    {
                        MessageBox.Show(@"生成数量为空,请返回开卡包装规格设置!", messageHead, MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }
                    this.txtBatch.Text          = NullTurnEmpty(newOpencardpack.FBatchNoall);
                    this.txtCinvstd.Text        = NullTurnEmpty(newOpencardpack.cinvstd);
                    this.txtCinvName.Text       = NullTurnEmpty(newOpencardpack.cinvname);
                    this.txtClientCode.Text     = NullTurnEmpty(newOpencardpack.cCusCode);
                    this.txtOrder.Text          = NullTurnEmpty(newOpencardpack.cSOCode);
                    this.txtZhuShen.Text        = NullTurnEmpty(newOpencardpack.Fzhushen);
                    this.txtTypeCode.Text       = NullTurnEmpty(newOpencardpack.FProductNo);
                    this.txtFoot.Text           = NullTurnEmpty(newOpencardpack.ffoot);
                    this.txtDpredate.Text       = NullTurnEmpty(newOpencardpack.dPreDate.ToString());
                    this.txtPN.Text             = NullTurnEmpty(newOpencardpack.cPN);
                    this.txtPO.Text             = NullTurnEmpty(newOpencardpack.cPO);
                    this.txtCreateQTY.Text      = (Double.Parse(newOpencardpack.Flabelqty.ToString()) * 1000).ToString(CultureInfo.InvariantCulture);
                    this.txtOrderQty.Text       = (Double.Parse(newOpencardpack.Fqty.ToString()) * 1000).ToString(CultureInfo.InvariantCulture);
                    this.txtFlowCard.Text       = NullTurnEmpty(newOpencardpack.Fsn);
                    this.txtKey.Text            = this.txtCode.Text.Trim().ToUpper();
                    this.txtBatchSuffix.Text    = NullTurnEmpty(newOpencardpack.Fbatchfree);
                    this.txtFlowCardSuffix.Text = NullTurnEmpty(newOpencardpack.fsnfree);
                    if (!string.IsNullOrEmpty(newOpencardpack.CNC))
                    {
                        this.txtFlowCardSuffix.Text = this.txtFlowCardSuffix.Text + @" " + newOpencardpack.CNC;
                    }
                    this.txtNote.Text   = NullTurnEmpty(newOpencardpack.Fnote);
                    this.txtRemark.Text = NullTurnEmpty(newOpencardpack.cFree1);
                    //获取主订单信息
                    SO_SOMain soMain = soMainBll.FindSoMainByCsoCode(NullTurnEmpty(newOpencardpack.cSOCode));
                    if (soMain != null)
                    {
                        this.txtMainClaim.Text = NullTurnEmpty(soMain.cMemo);
                    }
                    else
                    {
                        MessageBox.Show(@"此条码订单号为空的!", messageHead, MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }

                    //获取订单明细信息
                    //SO_SODetails parmSoDetails = new SO_SODetails();
                    //parmSoDetails.cSOCode = newOpencardpack.cSOCode.Trim();
                    //parmSoDetails.cInvCode = newOpencardpack.FProductNo.Trim();
                    //SO_SODetails soDetails = soDetailsBll.FindSoDetailsBySoDetails(parmSoDetails);

                    if (newOpencardpack.FsaID != null)
                    {
                        int sodetailsID = 0;
                        sodetailsID = (int)newOpencardpack.FsaID;
                        if (sodetailsID != 0)
                        {
                            SO_SODetails soDetails = frmCreateLabelsBll.FindSoDetailsById(sodetailsID);
                            if (soDetails != null)
                            {
                                //明细单要求
                                this.txtDetailClaim.Text = soDetails.cMemo.Trim();
                            }
                            else
                            {
                                MessageBox.Show(@"明细订单为空!", messageHead, MessageBoxButtons.OK, MessageBoxIcon.Information);
                                return;
                            }
                        }
                        else
                        {
                            MessageBox.Show(@"开卡表的明细订单的ID为0!", messageHead, MessageBoxButtons.OK, MessageBoxIcon.Information);
                            return;
                        }
                    }
                    else
                    {
                        MessageBox.Show(@"开卡表没有明细订单的ID!", messageHead, MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }
                    //获取包装信息
                    if (string.IsNullOrEmpty(newOpencardpack.cPCode))
                    {
                        MessageBox.Show(@"没有选择包装编码!请返回开卡包装规格设置", messageHead, MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }
                    this.txtPackCode.Text = newOpencardpack.cPCode.Trim();
                    SA_Packs saPacks = frmCreateLabelsBll.FindSaPacksBySaPackCode(newOpencardpack.cPCode.Trim());
                    if (saPacks != null)
                    {
                        this.txtReelQTY.Text   = (Double.Parse(saPacks.FPKminqty.ToString()) * 1000).ToString();
                        this.txtBoxQTY.Text    = (Decimal.ToInt32(saPacks.fSQty) * 1000).ToString();
                        this.txtMaxBoxQTY.Text = (saPacks.fQuantity * 1000).ToString();
                        double createQty = double.Parse(this.txtCreateQTY.Text);
                        int    reelCount = 0;
                        if (!this.cb_pack.Checked)
                        {
                            //计算卷盘数量

                            double reel = Double.Parse(saPacks.FPKminqty.ToString()) * 1000;
                            // double a=order%reel;
                            if (createQty % reel != 0)
                            {
                                reelCount = (int)(createQty / reel) + 1;
                            }
                            else
                            {
                                reelCount = (int)(createQty / reel);
                            }
                        }
                        this.txtReel.Text = reelCount.ToString();
                        int boxCount = 0;
                        if (!this.cb_reel.Checked)
                        {
                            //计算内盒数量
                            boxCount = 0;
                            double box = Double.Parse(saPacks.fSQty.ToString()) * 1000;
                            if (createQty % box != 0)
                            {
                                boxCount = (int)(createQty / box) + 1;
                            }
                            else
                            {
                                boxCount = (int)(createQty / box);
                            }
                        }
                        this.txtBox.Text                      = boxCount.ToString();
                        this.btnCreate.Enabled                = true;
                        this.btnCreateAndPrint.Enabled        = true;
                        this.ToolStripMenuItem_Create.Enabled = true;
                        this.txtCode.Text                     = "";
                    }
                    else
                    {
                        MessageBox.Show(@"包装信息为空,请返回开卡包装规格设置!", messageHead, MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }
                }
                else
                {
                    MessageBox.Show(@"此条码无效,请检查清楚!", messageHead, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            else
            {
                MessageBox.Show(@"条码不能为空!", messageHead, MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            //this.txtCode.Text = "";
        }