Обновление базы для маркировки ЛС — различия между версиями
Материал из wiki.standart-n.ru
Agk (обсуждение | вклад) (→Дополнительно) |
Agk (обсуждение | вклад) |
||
Строка 6: | Строка 6: | ||
<pre> | <pre> | ||
+ | SET TERM ^ ; | ||
+ | create or alter procedure PR_COPY_MARK_DETAIL ( | ||
+ | DOC_ID_IN integer, | ||
+ | DOC_ID_OUT integer) | ||
+ | as | ||
+ | begin | ||
+ | INSERT INTO MARK_DETAIL (DOC_ID, PART_ID, MARK_DATA, QUANT, COMMITDATE, INSERTDT, DOCNUM, DOC_DATE, DDA_ID, | ||
+ | PLACE_ID_IN, PLACE_ID_OUT, GTIN, SERIES_NUMBER, EXPIRATION_DATE, ACTIVEPOS, SERIA, KIZ, EXPIRETION_DATE, SSCC, ACCEPTED) | ||
+ | select :DOC_ID_OUT, PART_ID, MARK_DATA, -QUANT, COMMITDATE, INSERTDT, DOCNUM, DOC_DATE,(select first 1 id from doc_detail_active dd where dd.doc_id=:doc_id_out and dd.part_id=md.part_id), | ||
+ | PLACE_ID_IN, PLACE_ID_OUT, GTIN, SERIES_NUMBER, EXPIRATION_DATE, 2, SERIA, KIZ, EXPIRETION_DATE, SSCC, ACCEPTED | ||
+ | from MARK_DETAIL md where doc_id = :DOC_ID_IN ; | ||
+ | end^ | ||
+ | SET TERM ; ^ | ||
+ | /* Следующие операторы GRANT сгенерированы автоматически */ | ||
+ | GRANT SELECT,INSERT ON MARK_DETAIL TO PROCEDURE PR_COPY_MARK_DETAIL; | ||
+ | GRANT SELECT ON DOC_DETAIL_ACTIVE TO PROCEDURE PR_COPY_MARK_DETAIL; | ||
+ | /* Существующие привилегии на эту процедуру */ | ||
+ | GRANT EXECUTE ON PROCEDURE PR_COPY_MARK_DETAIL TO SYSDBA; | ||
SET TERM ^ ; | SET TERM ^ ; | ||
create or alter procedure PR_DOC_CANCEL ( | create or alter procedure PR_DOC_CANCEL ( | ||
Строка 86: | Строка 104: | ||
if (DELETED_DOC_ID > 0) then | if (DELETED_DOC_ID > 0) then | ||
begin | begin | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
update DOCS | update DOCS | ||
set STATUS = 1, | set STATUS = 1, | ||
COMMITSESSION_ID = :AUDIT_ID | COMMITSESSION_ID = :AUDIT_ID | ||
where ID = :DELETED_DOC_ID; | where ID = :DELETED_DOC_ID; | ||
− | |||
insert into DOC_DETAIL (PART_TYPE, PARENT_ID, DOC_ID, PART_ID, QUANT, DCARD, SUMMA, SUMMA_O, NAC, DISCOUNT, | insert into DOC_DETAIL (PART_TYPE, PARENT_ID, DOC_ID, PART_ID, QUANT, DCARD, SUMMA, SUMMA_O, NAC, DISCOUNT, | ||
SUM_NDSO, SUM_NDSR, SUM_DSC) | SUM_NDSO, SUM_NDSR, SUM_DSC) | ||
Строка 134: | Строка 144: | ||
execute procedure PR_UPDBLOCKINFO_BY_DOC(:DOC_ID, :DOC_STATUS); | execute procedure PR_UPDBLOCKINFO_BY_DOC(:DOC_ID, :DOC_STATUS); | ||
execute procedure PR_DOEVENT('EV_DOCCANCEL'); | execute procedure PR_DOEVENT('EV_DOCCANCEL'); | ||
+ | |||
+ | --Удаляме данные из mark_detail при отмене документа | ||
+ | delete from mark_detail where doc_id = :doc_id; | ||
suspend; | suspend; | ||
end^ | end^ | ||
Строка 149: | Строка 162: | ||
GRANT EXECUTE ON PROCEDURE PR_UPDBLOCKINFO_BY_DOC TO PROCEDURE PR_DOC_CANCEL; | GRANT EXECUTE ON PROCEDURE PR_UPDBLOCKINFO_BY_DOC TO PROCEDURE PR_DOC_CANCEL; | ||
GRANT EXECUTE ON PROCEDURE PR_DOEVENT TO PROCEDURE PR_DOC_CANCEL; | GRANT EXECUTE ON PROCEDURE PR_DOEVENT TO PROCEDURE PR_DOC_CANCEL; | ||
+ | GRANT SELECT,DELETE ON MARK_DETAIL TO PROCEDURE PR_DOC_CANCEL; | ||
/* Существующие привилегии на эту процедуру */ | /* Существующие привилегии на эту процедуру */ | ||
GRANT EXECUTE ON PROCEDURE PR_DOC_CANCEL TO PROCEDURE PR_DOC_CANCELDEFER; | GRANT EXECUTE ON PROCEDURE PR_DOC_CANCEL TO PROCEDURE PR_DOC_CANCELDEFER; | ||
Строка 195: | Строка 209: | ||
примерно так [[Файл:PR EDITCUSTOMDOC.png]] | примерно так [[Файл:PR EDITCUSTOMDOC.png]] | ||
− | ==Проведение с авторасходом== | + | ==ТМС Проведение с авторасходом== |
+ | Для того, чтобы в авторасход автоматически копировались datamatriх коды, нужно: | ||
+ | |||
+ | 1) добавить копирование кодов в расходный документ | ||
<pre> | <pre> | ||
EndIBTransaction(trn1,1); | EndIBTransaction(trn1,1); | ||
Строка 206: | Строка 223: | ||
end; | end; | ||
</pre> | </pre> | ||
+ | |||
+ | 2) убрать автоматическое проведение документа | ||
+ | |||
+ | примерно так [[Файл:Авторасход, маркировка.png]] | ||
Теги: маркировка, МДЛП | Теги: маркировка, МДЛП |
Версия 16:07, 10 июля 2020
Содержание
Заменить версию Менеджера
Заменить ManagerXP2.exe на версию 274_47_8 от июля 2020 г. или более новую.
Выполняем скрипт
SET TERM ^ ; create or alter procedure PR_COPY_MARK_DETAIL ( DOC_ID_IN integer, DOC_ID_OUT integer) as begin INSERT INTO MARK_DETAIL (DOC_ID, PART_ID, MARK_DATA, QUANT, COMMITDATE, INSERTDT, DOCNUM, DOC_DATE, DDA_ID, PLACE_ID_IN, PLACE_ID_OUT, GTIN, SERIES_NUMBER, EXPIRATION_DATE, ACTIVEPOS, SERIA, KIZ, EXPIRETION_DATE, SSCC, ACCEPTED) select :DOC_ID_OUT, PART_ID, MARK_DATA, -QUANT, COMMITDATE, INSERTDT, DOCNUM, DOC_DATE,(select first 1 id from doc_detail_active dd where dd.doc_id=:doc_id_out and dd.part_id=md.part_id), PLACE_ID_IN, PLACE_ID_OUT, GTIN, SERIES_NUMBER, EXPIRATION_DATE, 2, SERIA, KIZ, EXPIRETION_DATE, SSCC, ACCEPTED from MARK_DETAIL md where doc_id = :DOC_ID_IN ; end^ SET TERM ; ^ /* Следующие операторы GRANT сгенерированы автоматически */ GRANT SELECT,INSERT ON MARK_DETAIL TO PROCEDURE PR_COPY_MARK_DETAIL; GRANT SELECT ON DOC_DETAIL_ACTIVE TO PROCEDURE PR_COPY_MARK_DETAIL; /* Существующие привилегии на эту процедуру */ GRANT EXECUTE ON PROCEDURE PR_COPY_MARK_DETAIL TO SYSDBA; SET TERM ^ ; create or alter procedure PR_DOC_CANCEL ( DOC_ID type of DM_ID, DOC_CANCEL type of DM_STATUS, AUDIT_ID type of DM_ID, OWNER_ID type of DM_ID) returns ( CANCEL_RESULT integer) as declare variable DELETED_DOC_ID bigint; declare variable DOC_STATUS type of DM_STATUS; declare variable CONTRACT_ID DM_ID; begin /* cancel_result: 0 - удаление проведенного документа 1 - удаление рабочего/отложенного документа 2 - откладываем рабочий документ 3 - отложенный документ делаем рабочим */ select STATUS, CONTRACT_ID, DELETED_DOC_ID from DOCS where ID = :DOC_ID into :DOC_STATUS, :CONTRACT_ID, :DELETED_DOC_ID; if (DOC_STATUS = 1) then --если документ проведен begin delete from DOC_DETAIL where DOC_ID = :DOC_ID; update DOCS set STATUS = -1, COMMITSESSION_ID = :AUDIT_ID where ID = :DOC_ID; if (CONTRACT_ID <> 0) then begin execute procedure PR_CREDITCOMMIT(:CONTRACT_ID); end CANCEL_RESULT = 0; end else if (DOC_STATUS in (0, 2)) then --документ рабочий или отложенный if (DOC_CANCEL = 1) then --документ отменяем begin insert into DOCS_CANCELED (ID, PARENT_ID, DOC_TYPE, STATUS, AGENT_ID, DOCNUM, DOCDATE, CAPTION, RGUID, INSERTDT, POSTDT, AUDIT_ID, VNUM, VSHIFT, CREATER, OWNER, COMMITDATE, PACKET, DEVICE_NUM, SUMMA, SUMMA_O, SUM_NDSO, SUM_NDSR, CALCSUMMA, COMMENTS, SUMM1, SUMM2, SUMM3, SUMM4, CHECKDATA, COMMITSESSION_ID, SUM_DSC, CASHDATA, PRICE_TYPE, CURRENCY_ID, BASE_AGENT_ID, CONTRACT_ID, LINK_ID, DELETED_DOC_ID, OPLATA, DATE_OPL, MAKE_ID, DOC_PAY_DATE, BONUS, D$UUID, D$SRVUPDDT) select ID, PARENT_ID, DOC_TYPE, STATUS, AGENT_ID, DOCNUM, DOCDATE, CAPTION, RGUID, INSERTDT, POSTDT, AUDIT_ID, VNUM, VSHIFT, CREATER, OWNER, COMMITDATE, PACKET, DEVICE_NUM, SUMMA, SUMMA_O, SUM_NDSO, SUM_NDSR, CALCSUMMA, COMMENTS, SUMM1, SUMM2, SUMM3, SUMM4, CHECKDATA, COMMITSESSION_ID, SUM_DSC, CASHDATA, PRICE_TYPE, CURRENCY_ID, BASE_AGENT_ID, CONTRACT_ID, LINK_ID, DELETED_DOC_ID, OPLATA, DATE_OPL, MAKE_ID, DOC_PAY_DATE, BONUS, D$UUID, D$SRVUPDDT from DOCS where ID = :DOC_ID; insert into DOC_DETAIL_ACTIVE_CANCELED (ID, PARENT_ID, DOC_ID, PART_ID, PART_PARENT_ID, DOC_DETAIL_ID, PRICE, NAC, QUANT, DISCOUNT, SUMMA, SUMMA_O, DCARD, WARE_ID, PRICE_O, PRICE_Z, PRICE_R, BARCODE, BARCODE1, GODENDO, SERIA, NDS, SUM_NDSO, SUM_NDSR, SERT, DATESERT, KEMVSERT, SDSERT, REGN, NGTD, EDIZM, NAME_ID, IZG_ID, COUNTRY_ID, ORIG_CODE, ORIG_NAME_ID, ORIG_IZG_ID, ORIG_COUNTRY_ID, Z_ID, SKLAD_ID, SNAME, SIZG, SCOUNTRY, SORIG_NAME, SORIG_IZG, SORIG_COUNTRY, INSERTDT, INFO, KOEF, MOTHERPART_ID, DEP, BCODE_IZG, HUMAN_QUANT, SUM_DSC, CUSTOMDRAW, STATUS, PART_TYPE, BASE_AGENT_ID, GROUP_ID, PACKET, VPART_ID, GNVLS, MAKE_ID, MNN, ACCOMP_ID, MOTHERPART_UUID) select ID, PARENT_ID, DOC_ID, PART_ID, PART_PARENT_ID, DOC_DETAIL_ID, PRICE, NAC, QUANT, DISCOUNT, SUMMA, SUMMA_O, DCARD, WARE_ID, PRICE_O, PRICE_Z, PRICE_R, BARCODE, BARCODE1, GODENDO, SERIA, NDS, SUM_NDSO, SUM_NDSR, SERT, DATESERT, KEMVSERT, SDSERT, REGN, NGTD, EDIZM, NAME_ID, IZG_ID, COUNTRY_ID, ORIG_CODE, ORIG_NAME_ID, ORIG_IZG_ID, ORIG_COUNTRY_ID, Z_ID, SKLAD_ID, SNAME, SIZG, SCOUNTRY, SORIG_NAME, SORIG_IZG, SORIG_COUNTRY, INSERTDT, INFO, KOEF, MOTHERPART_ID, DEP, BCODE_IZG, HUMAN_QUANT, SUM_DSC, CUSTOMDRAW, STATUS, PART_TYPE, BASE_AGENT_ID, GROUP_ID, PACKET, VPART_ID, GNVLS, MAKE_ID, MNN, ACCOMP_ID, MOTHERPART_UUID from DOC_DETAIL_ACTIVE where DOC_ID = :DOC_ID; delete from DOC_DETAIL_ACTIVE_MMBSH where DOC_ID = :DOC_ID; delete from DOC_DETAIL_ACTIVE where DOC_ID = :DOC_ID; delete from DOCS where ID = :DOC_ID; if (DELETED_DOC_ID > 0) then begin update DOCS set STATUS = 1, COMMITSESSION_ID = :AUDIT_ID where ID = :DELETED_DOC_ID; insert into DOC_DETAIL (PART_TYPE, PARENT_ID, DOC_ID, PART_ID, QUANT, DCARD, SUMMA, SUMMA_O, NAC, DISCOUNT, SUM_NDSO, SUM_NDSR, SUM_DSC) select (select PART_TYPE from PARTS where ID = DDD.PART_ID), PARENT_ID, :DELETED_DOC_ID, PART_ID, QUANT, DCARD, SUMMA, SUMMA_O, NAC, DISCOUNT, SUM_NDSO, SUM_NDSR, SUM_DSC from DOC_DETAIL_DELETED DDD where DOC_ID = :DELETED_DOC_ID; delete from DOC_DETAIL_DELETED where DOC_ID = :DELETED_DOC_ID; end CANCEL_RESULT = 1; end else if (DOC_CANCEL = 0) then --откладываем либо возвращаем документ if (DOC_STATUS = 0) then --откладываем рабочий документ begin update DOCS set STATUS = 2, COMMITSESSION_ID = :AUDIT_ID where ID = :DOC_ID; CANCEL_RESULT = 2; end else --возвращаем отложенный документ begin update DOCS set STATUS = 0, AUDIT_ID = :AUDIT_ID, OWNER = :OWNER_ID where ID = :DOC_ID; CANCEL_RESULT = 3; end else exception EX_WRONGDOCSTATUS; --передали неправильный статус execute procedure PR_UPDBLOCKINFO_BY_DOC(:DOC_ID, :DOC_STATUS); execute procedure PR_DOEVENT('EV_DOCCANCEL'); --Удаляме данные из mark_detail при отмене документа delete from mark_detail where doc_id = :doc_id; suspend; end^ SET TERM ; ^ /* Следующие операторы GRANT сгенерированы автоматически */ GRANT SELECT,DELETE,UPDATE ON DOCS TO PROCEDURE PR_DOC_CANCEL; GRANT SELECT,INSERT,DELETE ON DOC_DETAIL TO PROCEDURE PR_DOC_CANCEL; GRANT EXECUTE ON PROCEDURE PR_CREDITCOMMIT TO PROCEDURE PR_DOC_CANCEL; GRANT INSERT ON DOCS_CANCELED TO PROCEDURE PR_DOC_CANCEL; GRANT INSERT ON DOC_DETAIL_ACTIVE_CANCELED TO PROCEDURE PR_DOC_CANCEL; GRANT SELECT,DELETE ON DOC_DETAIL_ACTIVE TO PROCEDURE PR_DOC_CANCEL; GRANT SELECT,DELETE ON DOC_DETAIL_ACTIVE_MMBSH TO PROCEDURE PR_DOC_CANCEL; GRANT SELECT ON PARTS TO PROCEDURE PR_DOC_CANCEL; GRANT SELECT,DELETE ON DOC_DETAIL_DELETED TO PROCEDURE PR_DOC_CANCEL; GRANT EXECUTE ON PROCEDURE PR_UPDBLOCKINFO_BY_DOC TO PROCEDURE PR_DOC_CANCEL; GRANT EXECUTE ON PROCEDURE PR_DOEVENT TO PROCEDURE PR_DOC_CANCEL; GRANT SELECT,DELETE ON MARK_DETAIL TO PROCEDURE PR_DOC_CANCEL; /* Существующие привилегии на эту процедуру */ GRANT EXECUTE ON PROCEDURE PR_DOC_CANCEL TO PROCEDURE PR_DOC_CANCELDEFER; GRANT EXECUTE ON PROCEDURE PR_DOC_CANCEL TO PROCEDURE PR_DOC_REACTIVATE; GRANT EXECUTE ON PROCEDURE PR_DOC_CANCEL TO PROCEDURE PR_DOC_SPLITBYBASEAGENT; GRANT EXECUTE ON PROCEDURE PR_DOC_CANCEL TO "PUBLIC"; GRANT EXECUTE ON PROCEDURE PR_DOC_CANCEL TO STANDART; GRANT EXECUTE ON PROCEDURE PR_DOC_CANCEL TO SYSDBA;
Дополнительно
поправить процедуру PR_EDITCUSTOMDOC, после строк
if (DOC_BASE_TYPE = 1) then begin if (DOC_STATUS = 1) then -- begin
вставить блок
for select PART_ID, QUANT, SUMMA, DISCOUNT, SUM_DSC, SUM_NDSO, ACCEPTANCE, AGENT_FIRST, DATE_FIRST_PRIHOD, MARKING, DATEPROD, GTIN_SUBJ, ACCEPTTYPE from DOC_DETAIL where DOC_ID = :DOC_ID into :PART_ID, :QUANT, :SUMMA, :DISCOUNT, :SUM_DSC, :SUM_NDSO, :ACCEPTANCE, :AGENT_FIRST, :DATE_FIRST_PRIHOD, :MARKING, :DATEPROD, :GTIN_SUBJ, :ACCEPTTYPE do begin CUR_DDA_ID = gen_id(GEN_DOC_DETAIL_ACTIVE_ID, 1); insert into DOC_DETAIL_ACTIVE (ID, DOC_ID, PART_ID, QUANT, SUMMA, DISCOUNT, KOEF, SUM_DSC, SUM_NDSO, ACCEPTANCE, AGENT_FIRST, DATE_FIRST_PRIHOD, MARKING, DATEPROD, GTIN_SUBJ, ACCEPTTYPE) values (:CUR_DDA_ID, :CUR_DOC_ID, :PART_ID, :QUANT, :SUMMA, :DISCOUNT, 0, :SUM_DSC, :SUM_NDSO, :ACCEPTANCE, :AGENT_FIRST, :DATE_FIRST_PRIHOD, :MARKING, :DATEPROD, :GTIN_SUBJ, :ACCEPTTYPE); update MARK_DETAIL M set M.DOC_ID = :CUR_DOC_ID, M.DDA_ID = :CUR_DDA_ID where M.DOC_ID = :DOC_ID and M.PART_ID = :PART_ID; end
ТМС Проведение с авторасходом
Для того, чтобы в авторасход автоматически копировались datamatriх коды, нужно:
1) добавить копирование кодов в расходный документ
EndIBTransaction(trn1,1); STARTIBTRANSACTION(trn1,1); try query3:=ExecIBQuery(trn1,'execute procedure PR_COPY_MARK_DETAIL('+doc_id2+','+comdoc2+');',1); //провел расход перемещения except EndIBTransaction(trn1,0); exit; end;
2) убрать автоматическое проведение документа
Теги: маркировка, МДЛП