Beispiel #1
0
    public List <ShipPlanDocDTO> QueryShipPlanDocInfo(long orgID, string barCode)
    {
        try
        {
            if (string.IsNullOrEmpty(barCode))
            {
                return(null);
            }

            string sql = string.Format(@"
select *, (case when a.SegLength=0 then 0 else a.TotalLength/a.SegLength end)-a.RcvCount as JCount
from(
	select item.ID as ItemID,
		item.Code as ItemCode,
		item.Name as ItemName,
		item.SPECS as ItemSPECS,
		doc.ID as ShipPlanID,
		line.ID as ShipPlanLineID,
		convert(decimal(24,9), (case when line.DescFlexField_PubDescSeg1='' then '0' else line.DescFlexField_PubDescSeg1 end)) as SegLength,
		line.PlanQtyTU*1000 as TotalLength,
		convert(decimal(24,9), (case when line.DescFlexField_PrivateDescSeg2='' then '0' else line.DescFlexField_PrivateDescSeg2 end)) as RcvCount
	from SM_ShipPlanLine as line
	inner join CBO_ItemMaster as item on line.ItemInfo_ItemID=item.ID
	inner join SM_ShipPlan as doc on line.ShipPlan=doc.ID
	where doc.Org='{0}' and doc.DocNo='{1}'
) as a where a.SegLength>0 and a.RcvCount<(a.TotalLength/a.SegLength)", orgID, barCode);

            DataSet dataSet = SQLHelper.ExecuteDataSet(sql);
            if (dataSet == null || dataSet.Tables.Count == 0 || dataSet.Tables[0].Rows.Count == 0)
            {
                return(null);
            }

            List <ShipPlanDocDTO> resultList = new List <ShipPlanDocDTO>();
            foreach (DataRow dataRow in dataSet.Tables[0].Rows)
            {
                ShipPlanDocDTO dto = new ShipPlanDocDTO();
                dto.ItemID    = TypeHelper.ConvertType <long>(dataRow["ItemID"], 0);
                dto.ItemCode  = TypeHelper.ConvertType <string>(dataRow["ItemCode"], string.Empty);
                dto.ItemName  = TypeHelper.ConvertType <string>(dataRow["ItemName"], string.Empty);
                dto.ItemSPECS = TypeHelper.ConvertType <string>(dataRow["ItemSPECS"], string.Empty);

                dto.ShipPlanID     = TypeHelper.ConvertType <long>(dataRow["ShipPlanID"], 0);
                dto.ShipPlanLineID = TypeHelper.ConvertType <long>(dataRow["ShipPlanLineID"], 0);

                dto.SegLength   = (int)TypeHelper.ConvertType <decimal>(dataRow["SegLength"], 0);
                dto.Count       = (int)TypeHelper.ConvertType <decimal>(dataRow["JCount"], 0);
                dto.TotalLength = (int)TypeHelper.ConvertType <decimal>(dataRow["TotalLength"], 0);
                resultList.Add(dto);
            }
            return(resultList);
        }
        catch (Exception ex)
        {
            PDALog.Error(ex);
            throw ExceptionHelper.CreateSoapException(ex.Message, ex.Source);
        }
    }
Beispiel #2
0
        /// <summary>
        /// 扫描条码
        /// </summary>
        private void ScanBarCode()
        {
            try
            {
                string barcode = txtBarCode.Text.Trim();
                if (string.IsNullOrEmpty(barcode))
                {
                    return;
                }

                if (docInfoArray == null || docInfoArray.Length == 0)
                {
                    BuildTabOrder(true);
                    throw new PDAException(txtDocNo, "请先录入出货计划单号或者扫描出货计划单条码");
                }

                BuildTabOrder(false);
                tabOrderManager.Reset();
                BarCodeInfoDTO dto = ServiceAgent.Agent.QueryBarCodeInfo(PDAContext.LoginOrgID, barcode);
                if (dto == null)
                {
                    throw new PDAException(txtBarCode, "没有找到该条形码的料品信息!");
                }

                ShipPlanDocDTO docDTO = MatchCompleteApplyDocDTO(dto);
                if (docDTO == null)
                {
                    throw new PDAException(txtBarCode, "该条码没有匹配到出货计划信息或者录入的条码超过该出货计划单!");
                }
                mainRow = dataSet.ShipBarCode.AddNewRow(dto, docDTO.ShipPlanID, docDTO.ShipPlanLineID);

                ShowInfo();
                // 显示行数
                ShowRowCount();
                // 焦点定位到最后一行
                this.dataGrid1.Focus();
                this.dataGrid1.CurrentRowIndex = this.dataSet.ShipBarCode.Count - 1;
                // 跳转到下一个控件
                tabOrderManager.Next();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ExceptionParser.ParseError(ex));
                tabOrderManager.DealException(ex);
            }
        }