Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- timer1.Enabled = false;
- UltraGridRow row = grPrequeue.ActiveRow;
- if (row == null || row.Index==-1)
- {
- Tools.errMsg("Musíte vybrát řádek s dodávkou, kterou chcete přesunout do fronty (již je v závodu)!");
- return;
- }
- if (!Tools.yesNo("Opravdu chcete auto " + (string)row.Cells["regnum"].Value + " přesunout do fronty (do závodu)?"))
- return;
- /*Pokud je vybraný "vrchní řádek, který má index -1"*/
- if (row.Cells["scale11"].Value.ToString() == "0,00" || row.Cells["scale22"].Value.ToString() == "0,00")
- {
- MessageBox.Show("Není zvážené vozidlo", "Upozornění", MessageBoxButtons.OK, MessageBoxIcon.Information);
- return;
- }
- /*Zde musíš dát váhu, jelikož pokud ji necháš dobře...kdo ví proč se váha z row vymaže....padá to při yesnoclick*/
- float scaleWeight1 = float.Parse(row.Cells["scale11"].Value.ToString());
- float scaleWeight2 = float.Parse(row.Cells["scale22"].Value.ToString());
- // Create a new queue record and delete the prequeue record -> move delivery from prequeue to queue
- DODelivery delivery = new DODelivery(row.Cells["deliveryid"].Value);
- delivery.tStatus = 2;
- delivery.tManuallyMovedToQueue = true;
- delivery.tManuallyMovedToQueueOperator = ProgParam.selUserID;
- delivery.saveToDB();
- string lineKey;
- byte[] buff;
- string sql;
- switch (delivery.tLineId)
- {
- case 1:
- lineKey = "LONG_REGNUM";
- break;
- default:
- lineKey = "SHORT_REGNUM";
- break;
- }
- try
- {
- MemoryStream f = Tools.getPhotoFromCamera(lineKey);
- buff = new byte[Convert.ToInt32(f.Length)];
- f.Position = 0;
- f.Read(buff, 0, Convert.ToInt32(f.Length));
- f.Close();
- MSSqlCommand MSCmd;
- SqlParameter[] Params = new SqlParameter[1];
- Params[0] = new SqlParameter("@data", buff);
- sql = "INSERT INTO dbo.deliveryphoto (deliveryid, data) VALUES (" + delivery.sqlDeliveryId + ", @data)";
- MSCmd = new MSSqlCommand(sql, Params, false);
- }
- catch { }
- dsDeliveryMain.FillData(1, 0, 0);
- // Check if an EVK delivery exists and create it after confirmation if not
- if (String.IsNullOrEmpty(delivery.tEklDat) || String.IsNullOrEmpty(delivery.sEklLfNr))
- {
- if (Tools.yesNo("Dodávka nemá vytvořenou fůru v EVK. Chcete ji vytvořit teď?"))
- if (Tools.CreateEVKDelivery(delivery))
- Tools.Info("V EVK byla úspěšně vytvořena dodávka " + delivery.EVKNum);
- else
- Tools.errMsg("Nebylo možno vytvořit dodávku v EVK!");
- }
- int id = (int)delivery.oDeliveryId;
- DOBMScale scale1 = new DOBMScale(id, UserControls.TableEnum.delivery, (int)UserControls.BmScaleRowNR.scale1);
- scale1.oweight = scaleWeight1;
- // scale.orownr = UserControls.BmScaleRowNR.scale1;
- scale1.saveToDB();
- DOBMScale scale2 = new DOBMScale(id, UserControls.TableEnum.delivery, (int)UserControls.BmScaleRowNR.scale2);
- scale2.oweight = scaleWeight2;
- // scale.orownr = UserControls.BmScaleRowNR.scale1;
- scale2.saveToDB();
- // Check if the delivery exists in the Sprecher queue in EVK and if not insert a new record there
- ORASqlQuery Q;
- ORASqlCommand Cmd;
- bool exists;
- Q = new ORASqlQuery("SELECT COUNT(*) FROM shelitrans WHERE uebnr = " + delivery.sqlTakeoverId + " AND mandant = '10'");
- if (Q.Read() && (!Q.Null(0)))
- exists = Q.getInt(0) > 0;
- else
- exists = false;
- Q.Close();
- if (!exists)
- Cmd = new ORASqlCommand("INSERT INTO shelitrans (uebnr, mandant, ekldat, ekllfnr, line, queue) " +
- "VALUES (" + delivery.sqlTakeoverId + ", '" + ProgParam.selMandant + "', " + delivery.sqlEklDat + ", " +
- delivery.sqlEklLfNr + ", " + delivery.sqlLineId + ", 'N')");
- timer1.Enabled = true;
- Tools.Info("Auto bylo přesunuto do fronty v závodu!");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement