Esempio n. 1
0
        internal void ProcessScanFATHTag(string data)
        {
            GenericCode tempCode = null;

            try
            {
                tempCode = GenericCode.ConvertDataToGenericCode(data);
                code["Delivery Order Tag"] = _deliveryOrderTag;
                code["FATH Part No."]      = tempCode["Part No."];
                code["FATH Tag No."]       = tempCode["Tag No."];
                code["FATH Qty."]          = tempCode["Qty."];
                if (_repository.IsTagNoDuplicate(code))
                {
                    _view.ShowMessage("ERR_05", Properties.Resources.ERR_05);
                    errFlag = true;
                    errMsg  = "ERR_05";
                }
                if (!IsPartNoExists(code["FATH Part No."].ToString()) && !errFlag)
                {
                    _view.ShowMessage("ERR_03", Properties.Resources.ERR_03);
                    errFlag = true;
                    errMsg  = "ERR_03";
                }
            }
            catch (Exception)
            {
                errFlag = true;
                errMsg  = "";
            }

            if (!errFlag)
            {
                #region Update Row

                foreach (var row in _dataSet.Tables[0].Select())
                {
                    if (row["DO Part No."].Equals(code["FATH Part No."].ToString()))
                    {
                        // sum-up  qty
                        int fathQty = 0;
                        fathQty = Convert.ToInt32(row["FATH Qty."]) + Convert.ToInt32(code["FATH Qty."]);
                        if (fathQty > Convert.ToInt32(row["DO Qty."]))
                        {
                            _view.ShowMessage("ERR_04", Properties.Resources.ERR_04);
                            errFlag = true;
                            errMsg  = "ERR_04";
                            break;
                        }
                        else
                        {
                            int rowAffected = 0;
                            //update to db
                            try
                            {
                                rowAffected = _repository.UpdateFATHTag(code);
                            }
                            catch
                            {
                            }
                            if (rowAffected > 0)
                            {
                                row["FATH Part No."] = code["FATH Part No."];
                                row["FATH Qty."]     = fathQty;
                                if (_shipping.CustomerCheckingPoints == 2)
                                {
                                    row["Pass"] = Convert.ToInt32(row["FATH Qty."]) == Convert.ToInt32(row["DO Qty."]) ? "Y" : "N";
                                }
                                else
                                {
                                    row["Pass"] = ((Convert.ToInt32(row["FATH Qty."]) == Convert.ToInt32(row["DO Qty."])) &&
                                                   (Convert.ToInt32(row["Customer Qty."]) == Convert.ToInt32(row["DO Qty."]))) ? "Y" : "N";
                                }
                            }
                        }
                    }
                }

                #endregion
            }
            var value = "";
            if (tempCode == null)
            {
                value = "";
            }
            else
            {
                value = string.Format("{0}/{1}", tempCode["Part No."].ToString(), tempCode["Qty."].ToString());
            }
            SaveLog(OperationLog.LogEvent.Scan, "FATHTag", value);
        }